Run OpenClaw on a Raspberry Pi: The $50 AI Employee That Never Sleeps

We run our production OpenClaw instance on a Raspberry Pi 5. It handles messaging, cron jobs, heartbeats, web browsing, and content generation 24/7. Total hardware cost: about $50 (used Pi 4) to $120 (new Pi 5 with 8GB).

Here’s exactly how to set it up.

Hardware You Need

Budget Option (~$60):

  • Pi 4 (4GB) ~$35 used
  • 32GB microSD ~$8
  • USB-C PSU ~$8
  • Basic case ~$10

Recommended (~$155):

  • Pi 5 (8GB) ~$80
  • 256GB NVMe via HAT ~$40
  • USB-C 5A PSU ~$12
  • Argon ONE case with fan ~$25

OS Setup

Flash Raspberry Pi OS Lite (64-bit) — no desktop needed.

sudo apt update && sudo apt upgrade -y
sudo apt install -y git curl wget build-essential

Enable SSH, set a strong password, configure WiFi if needed.

Installing OpenClaw

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
npm install -g openclaw
openclaw init

Setting Up Ollama for Local Models

curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen2.5:7b    # For Pi 5 (8GB)
ollama pull qwen2.5:3b    # For Pi 4 (4GB)

Local models handle most daily tasks; route complex tasks to cloud APIs.

Systemd Service

# /etc/systemd/system/openclaw.service
[Unit]
Description=OpenClaw AI Agent
After=network-online.target ollama.service
Wants=network-online.target

[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/.openclaw
ExecStart=/usr/bin/openclaw gateway start --foreground
Restart=always
RestartSec=10
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target
sudo systemctl enable openclaw
sudo systemctl start openclaw

Security Hardening

  1. Change default password
  2. SSH key-only auth — disable password SSH
  3. Firewallsudo ufw allow ssh && sudo ufw enable
  4. Fail2bansudo apt install fail2ban
  5. Regular updatessudo unattended-upgrades
  6. Don’t expose to internet — use Tailscale or Cloudflare Tunnel

Performance Tuning

# Increase swap for 4GB Pi
sudo dphys-swapfile swapoff
sudo sed -i 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/' /etc/dphys-swapfile
sudo dphys-swapfile setup && sudo dphys-swapfile swapon

# Reduce GPU memory
echo "gpu_mem=16" | sudo tee -a /boot/config.txt

# Disable Bluetooth if unused
sudo systemctl disable bluetooth

Real-World Use Cases

Our Pi runs:

  • Morning briefing at 7 AM
  • Social monitoring every 2 hours
  • Content publishing pipeline
  • Uptime monitoring for 5 websites every 15 minutes
  • Smart home integration via Home Assistant API

Total monthly cost: ~$3 in electricity. No cloud bills.


Want the complete copy-paste setup? The Raspberry Pi Deployment Kit includes every config file, systemd service, security checklist, and troubleshooting guide.


Want to build this yourself? The Agent Ops Toolkit ($19) has everything you need.

More from the build log

Suggested

Want the full MarketMai stack?

Get all 7 digital products in one premium bundle for $49.

View Bundle