Self-Host Your OpenClaw AI Agent
If you want full control over your OpenClaw AI agent, this guide shows how to self-host it on a VPS, connect tools, choose the right model setup, and run real automation workflows.
What Is OpenClaw?
OpenClaw is an open-source AI agent framework that helps you build AI agents that can use tools, connect with apps, and automate tasks.
Instead of only chatting with an AI model, OpenClaw lets you create an agent that works inside your real workflow. It can connect with chat apps, files, APIs, and business tools to handle tasks like summaries, research, reminders, file organization, and follow-ups.
In simple terms, OpenClaw helps you move from AI that only replies to AI that can actually do work.
Key Features of OpenClaw
- Open-source: Run and customize your own AI agent setup.
- Tool integration: Connect apps, APIs, files, and services.
- Workflow automation: Automate summaries, tasks, reminders, and reports.
- Chat app support: Use OpenClaw through channels like Telegram, Discord, Slack, or WhatsApp.
- Self-hosting support: Run it on a local machine, VPS, cloud server, or managed hosting.
- Model flexibility: Use API-based AI models or local model setups.
- Custom rules: Control what the agent can do and when it needs approval.
- Better than basic chatbots: OpenClaw supports real actions, not just replies.
Why Self-Host OpenClaw on a VPS?
Self-hosting OpenClaw on a VPS gives you a private, always-on environment to run AI agents, connect tools, and automate workflows without keeping your personal computer online.
A local setup is useful for testing, but a VPS is better for real use because OpenClaw can stay active, receive requests, and run workflows continuously. Basic stuff, somehow still worth saying because laptops love sleeping at the worst time.
Benefits of Using a VPS for OpenClaw
- Always-on AI agent: Keep OpenClaw running 24/7 for workflows, reminders, and connected apps.
- More control: Manage your own server, data, tools, permissions, and workflow rules.
- Better for automation: Run recurring tasks, chat commands, reports, and tool-based actions reliably.
- Remote access: Use OpenClaw from anywhere through your server, domain, or configured endpoint.
- Flexible setup: Connect AI models, APIs, files, chat apps, and business tools based on your needs.
- Lower starting cost: A VPS can be affordable for small AI agent workflows compared to larger cloud setups.
- Easy to scale: Start with a small server and upgrade resources when your workflows grow.
What You Need Before You Self-Host an OpenClaw AI Agent
Before you install anything, make sure you have the basic setup ready.
| Requirement | Why You Need It |
|---|---|
| VPS server | Runs your OpenClaw setup |
| Docker or supported runtime | Helps run OpenClaw services |
| AI model access | Powers the agent responses and reasoning |
| Persistent storage | Saves config, sessions, and workspace data |
| Gateway access | Lets OpenClaw receive and manage requests |
| API keys or app credentials | Connects OpenClaw with external tools |
| Domain name | Useful for remote access and webhooks |
| HTTPS | Secures public access |
| Basic terminal knowledge | Helps with setup and troubleshooting |
How to Self-Host an OpenClaw AI Agent
Self-hosting an OpenClaw AI agent means running OpenClaw on your own VPS and connecting it with an AI model, tools, storage, and chat channels. A VPS is best when you want your AI agent to stay online and run workflows continuously.
Choose a Linux VPS with enough CPU, RAM, and storage to run OpenClaw continuously. A VPS keeps your OpenClaw agent online even when your laptop is off.
You can use providers like DigitalOcean, Hetzner, Vultr, Linode, Hostinger, AWS, Google Cloud, Azure, or Oracle Cloud.
| Use Case | Recommended VPS Size |
|---|---|
| Basic testing | 2 vCPU, 2 to 4 GB RAM |
| Personal workflows | 2 vCPU, 4 GB RAM |
| Regular 24/7 use | 2 to 4 vCPU, 8 GB RAM |
| Heavier team workflows | 4 vCPU, 8 GB+ RAM |
Use SSH to connect:
ssh root@your-server-ipUpdate the server:
sudo apt update && sudo apt upgrade -yInstall basic tools:
sudo apt install -y curl git ufwAllow SSH through the firewall:
sudo ufw allow OpenSSH
sudo ufw enableCreate a separate user for OpenClaw:
sudo adduser openclaw
sudo usermod -aG sudo openclaw
su - openclawThis keeps OpenClaw files under the openclaw user instead of running everything as root.
Use the official installer:
curl -fsSL https://openclaw.ai/install.sh | bashCheck installation:
openclaw --versionIf the command is not found, reload the shell:
source ~/.bashrcThe official quick setup uses this installer and then runs onboarding.
Run:
openclaw onboard --install-daemonDuring onboarding:
- choose your model provider
- add your API key
- configure the Gateway
- install the background service
This is the correct step for a VPS because it helps OpenClaw run as a background service instead of depending on an open terminal.
Run:
openclaw gateway statusThe Gateway should be running on port:
18789Official docs mention Gateway status and port 18789.
Enable lingering for the openclaw user:
sudo loginctl enable-linger openclawRestart the Gateway:
openclaw gateway restartCheck again:
openclaw gateway statusThis helps the user service keep running after you close SSH.
Do not expose port 18789 directly to the public internet.
From your local computer, run:
ssh -N -L 18789:127.0.0.1:18789 openclaw@your-server-ipThen open:
http://127.0.0.1:18789OpenClaw remote access docs show SSH tunneling to 127.0.0.1:18789, and Gateway docs recommend Tailscale/VPN first or SSH tunnel as fallback.
Start with a low-risk workflow.
Examples:
- Create a reminder for tomorrow at 10 AM.
- Summarize these notes into three action items.
Use this checklist:
- Keep Gateway port 18789 private
- Use SSH tunnel, VPN, Tailscale, or secure reverse proxy
- Use a strong Gateway token
- Keep API keys private
- Limit tool permissions
- Require approval before sending, deleting, buying, sharing, or changing data
- Back up OpenClaw config, workspace, sessions, and auth data
- Keep the VPS updated
Security Rules for Self-Hosted OpenClaw
When you self-host OpenClaw, you control the server, tools, API keys, and workflows. That also means you are responsible for security. Lovely bargain: more control, more ways to break things.
Protect the OpenClaw Gateway
Do not expose your OpenClaw gateway directly to the public internet. Use a strong gateway token, firewall rules, VPN, SSH tunnel, or secure reverse proxy to control access.
Keep API Keys and Secrets Safe
Store API keys, tokens, and credentials in environment variables or a secret manager. Never paste secrets into prompts, chat messages, public files, or shared documents.
Use HTTPS for Remote Access
If you access OpenClaw through a domain or public URL, enable HTTPS to protect traffic between your browser, server, OpenClaw setup, and connected tools.
Give Only Required Permissions
Use least-privilege access for every connected tool. If OpenClaw only needs read access, do not give admin access. Tiny permission mistakes become expensive fast.
Require Approval for Risky Actions
Add human approval before OpenClaw sends emails, deletes files, updates databases, posts publicly, shares documents, or changes customer data.
Back Up Your OpenClaw Data
Back up your OpenClaw config, workspace, sessions, credentials, and workflow data so you do not lose your setup after crashes, failed updates, or accidental deletion.
Why People Migrate From Self-Hosting to Managed Hosting
Self-hosting OpenClaw gives you full control over your server, storage, tools, and setup. But it also means you manage everything yourself, including Docker, ports, SSL, updates, logs, uptime, backups, and security.
That works well for technical users. But for many people, the goal is not to maintain a server. The goal is to run OpenClaw and build useful AI workflows.
That is why users move to managed hosting. It removes most of the infrastructure work and helps you start faster.
With Ampere.sh, you can deploy OpenClaw, connect tools or channels, and focus on your workflows without manually handling the full server setup. Less time arguing with logs. More time building something that actually works. A rare upgrade in human productivity.
Frequently Asked Questions
Is OpenClaw open source?
Do I need an API key to use OpenClaw?
Can I run OpenClaw without Docker?
How much does it cost to self-host an OpenClaw AI agent?
Can OpenClaw run 24/7?
Is it safe to self-host an OpenClaw AI agent?
What is the difference between self-hosting an OpenClaw AI agent and using managed hosting?
What is the easiest way to run OpenClaw?
Also Read
Launch OpenClaw Faster
Deploy OpenClaw, connect tools or channels, and focus on your workflows without manually handling the full server setup.
Launch OpenClaw Now

