How to Set Up OpenClaw on a Raspberry Pi: Complete Step-by-Step Guide
# How to Set Up OpenClaw on a Raspberry Pi: Complete Step-by-Step Guide
Want a personal AI assistant that runs 24/7 on a tiny, silent, low-power device? A **Raspberry Pi** running **OpenClaw** gives you exactly that — your own always-on AI agent for under $100.
In this tutorial, we'll walk through setting up OpenClaw on a Raspberry Pi from scratch, connecting it to Telegram (or any messaging platform), and having your AI assistant ready to help you anytime.
---
## What You'll Need
| Item | Notes |
|------|-------|
| **Raspberry Pi 4 or 5** (4GB+ RAM recommended) | The Pi 5 with 8GB is ideal |
| **MicroSD card** (32GB+) | Class 10 or faster |
| **USB-C power supply** | Official Pi power supply recommended |
| **Ethernet cable or WiFi** | Stable internet connection |
| **An AI provider API key** | Anthropic, OpenAI, or Google |
| **A messaging account** | Telegram, Discord, Signal, etc. |
---
## Step 1: Flash Raspberry Pi OS
1. Download the **[Raspberry Pi Imager](https://www.raspberrypi.com/software/)** on your computer.
2. Insert your microSD card.
3. In the Imager, select:
- **OS:** Raspberry Pi OS Lite (64-bit) — no desktop needed
- **Storage:** Your microSD card
4. Click the **gear icon** to configure:
- Enable SSH
- Set username and password
- Configure WiFi (if not using Ethernet)
- Set your locale/timezone
5. Click **Write** and wait for it to finish.
6. Insert the microSD into your Pi and power it on.
---
## Step 2: Connect to Your Pi
SSH into the Pi from your computer:
```bash
ssh your-username@raspberrypi.local
```
If that doesn't work, find the Pi's IP from your router:
```bash
ssh your-username@192.168.x.x
```
---
## Step 3: Update the System
```bash
sudo apt update && sudo apt upgrade -y
```
---
## Step 4: Install Node.js 22+
OpenClaw requires Node.js 22 or later:
```bash
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash -
sudo apt install -y nodejs
```
Verify:
```bash
node --version # Should show v22.x.x
npm --version
```
---
## Step 5: Install OpenClaw
Run the official installer:
```bash
curl -fsSL https://openclaw.ai/install.sh | bash
```
This installs the CLI globally and launches the onboarding wizard.
Or install manually:
```bash
sudo npm install -g openclaw
openclaw setup
```
---
## Step 6: Configure Your AI Provider
During setup, you'll choose an AI provider:
### Option A: Anthropic (Claude) — Recommended
1. Go to [console.anthropic.com](https://console.anthropic.com)
2. Create an API key
3. Enter it during OpenClaw setup
### Option B: OpenAI (GPT-4)
1. Go to [platform.openai.com](https://platform.openai.com)
2. Create an API key
### Option C: Google (Gemini)
1. Go to [aistudio.google.com](https://aistudio.google.com)
2. Create an API key
> **Tip:** Claude Sonnet is the best balance of cost and capability for Pi.
---
## Step 7: Connect Telegram
The easiest messaging setup:
1. Open Telegram and message **@BotFather**
2. Send /newbot
3. Choose a name and username
4. Copy the **API token**
5. Run `openclaw config` and add the Telegram channel with your token
---
## Step 8: Start the Gateway
```bash
openclaw gateway start
```
Verify it's running:
```bash
openclaw gateway status
```
You should see `Runtime: running` and `RPC probe: ok`.
---
## Step 9: Auto-Start on Boot
```bash
openclaw gateway enable
```
This creates a systemd service that survives reboots.
---
## Step 10: Test It!
Open Telegram and message your bot. Try:
- "What's the weather like?"
- "Remind me to check emails in 30 minutes"
- "Search the web for Raspberry Pi projects"
---
## Performance Tips
### Add Swap Space
```bash
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
```
### Use Lightweight Models
- claude-3-5-haiku (fast and cheap)
- gpt-4o-mini (good balance)
### Monitor Resources
```bash
htop
openclaw status
```
---
## What Can Your Pi AI Do?
- **Chat** — Answer questions, have conversations
- **Reminders** — Timed reminders via cron
- **Web Search** — Search the internet on command
- **File Management** — Organize files, run scripts
- **Home Automation** — Integrate with smart home
- **Monitoring** — Server status, weather, emails
- **Code** — Write, review, and execute code
All for about **$5/year in electricity**.
---
## Troubleshooting
| Problem | Solution |
|---------|----------|
| Bot doesn't respond | Check openclaw gateway status |
| Out of memory | Add swap space (see above) |
| Slow responses | Use a lighter model |
| SSH drops | Use screen or tmux |
| Node.js won't install | Ensure 64-bit Pi OS |
---
## Conclusion
A Raspberry Pi running OpenClaw is the perfect personal AI — always on, private, low-power, and capable. Under $100 in hardware and a few dollars a month in API costs gets you a personal AI assistant accessible from anywhere.
**Ready?** Grab a Pi, follow these steps, and join the [OpenClaw Discord](https://discord.com/invite/clawd) if you need help.
*Explore more: [Free AI Tools](/tools) — BrainstormAI, ClipCaddy, MindSpark, and TimeCapsule.*