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.

RequirementWhy You Need It
VPS serverRuns your OpenClaw setup
Docker or supported runtimeHelps run OpenClaw services
AI model accessPowers the agent responses and reasoning
Persistent storageSaves config, sessions, and workspace data
Gateway accessLets OpenClaw receive and manage requests
API keys or app credentialsConnects OpenClaw with external tools
Domain nameUseful for remote access and webhooks
HTTPSSecures public access
Basic terminal knowledgeHelps 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.

1
Choose a VPS Provider

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 CaseRecommended VPS Size
Basic testing2 vCPU, 2 to 4 GB RAM
Personal workflows2 vCPU, 4 GB RAM
Regular 24/7 use2 to 4 vCPU, 8 GB RAM
Heavier team workflows4 vCPU, 8 GB+ RAM
2
Connect to the VPS

Use SSH to connect:

ssh root@your-server-ip

Update the server:

sudo apt update && sudo apt upgrade -y

Install basic tools:

sudo apt install -y curl git ufw

Allow SSH through the firewall:

sudo ufw allow OpenSSH sudo ufw enable
3
Create a Non-Root User

Create a separate user for OpenClaw:

sudo adduser openclaw sudo usermod -aG sudo openclaw su - openclaw

This keeps OpenClaw files under the openclaw user instead of running everything as root.

4
Install OpenClaw

Use the official installer:

curl -fsSL https://openclaw.ai/install.sh | bash

Check installation:

openclaw --version

If the command is not found, reload the shell:

source ~/.bashrc

The official quick setup uses this installer and then runs onboarding.

5
Run Onboarding

Run:

openclaw onboard --install-daemon

During 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.

6
Check Gateway Status

Run:

openclaw gateway status

The Gateway should be running on port:

18789

Official docs mention Gateway status and port 18789.

7
Keep OpenClaw Running After Logout

Enable lingering for the openclaw user:

sudo loginctl enable-linger openclaw

Restart the Gateway:

openclaw gateway restart

Check again:

openclaw gateway status

This helps the user service keep running after you close SSH.

8
Open the Control UI Safely

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-ip

Then open:

http://127.0.0.1:18789

OpenClaw remote access docs show SSH tunneling to 127.0.0.1:18789, and Gateway docs recommend Tailscale/VPN first or SSH tunnel as fallback.

9
Connect One Channel

After the Control UI works, connect one channel first.

ChannelBest For
TelegramPersonal assistant workflows
WhatsAppDaily mobile workflows
SlackWork workflows
DiscordTeam or community workflows

Start with one channel, test it, then add more later.

10
Test One Simple Workflow

Start with a low-risk workflow.

Examples:

  • Create a reminder for tomorrow at 10 AM.
  • Summarize these notes into three action items.
11
Secure the VPS

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?
Yes, OpenClaw is an open-source AI agent framework. You can run it yourself, customize your setup, and connect it with your own tools, apps, and workflows.
Do I need an API key to use OpenClaw?
Usually, yes. If you use OpenAI, Claude, Gemini, or another API model, you need an API key and pay based on usage. If you run a local model, API cost can be avoided, but you need stronger hardware.
Can I run OpenClaw without Docker?
In some setups, yes, but Docker usually makes deployment cleaner and easier to manage. For VPS self-hosting, Docker is often the simpler and more practical option.
How much does it cost to self-host an OpenClaw AI agent?
Self-hosting OpenClaw usually includes VPS hosting cost plus AI model API usage. A small VPS can be affordable for basic workflows, but setup time, maintenance, backups, security, and monitoring also matter.
Can OpenClaw run 24/7?
Yes, OpenClaw can run 24/7 if hosted on a VPS, cloud server, or managed hosting platform. Local setups are less reliable because your device must stay powered on and connected.
Is it safe to self-host an OpenClaw AI agent?
It can be safe if you use strong gateway tokens, HTTPS, firewall rules, limited permissions, secure API key storage, backups, and approval rules. Do not give OpenClaw unlimited access to sensitive tools.
What is the difference between self-hosting an OpenClaw AI agent and using managed hosting?
Self-hosted OpenClaw gives you more control, but you manage the server, Docker, SSL, uptime, logs, updates, backups, and security. Managed hosting like Ampere.sh reduces setup work so you can deploy faster and focus on workflows.
What is the easiest way to run OpenClaw?
The easiest way to run an OpenClaw AI agent is managed hosting. If you do not want to handle server setup manually. If you want full control, self-hosting on a VPS is a good option, but it requires more technical work.

Also Read

How to Install OpenClaw on a VPS (Step-by-Step Guide)
Installation

How to Install OpenClaw on a VPS (Step-by-Step Guide)

How to Run OpenClaw 24/7 for AI Agent Workflows
Hosting

How to Run OpenClaw 24/7 for AI Agent Workflows

11 minMay 22, 2026
Openclaw On Docker
Integration

Openclaw On Docker

Alex Chen

Written by

Alex Chen

Cloud Infrastructure Writer

Alex specializes in cloud infrastructure and distributed systems architecture. With 8+ years of experience deploying production AI systems, he focuses on scalable hosting solutions across DigitalOcean, Hetzner, AWS, and bare-metal servers. Expert in platform optimization, GPU infrastructure, and high-availability deployments.

Launch OpenClaw Faster

Deploy OpenClaw, connect tools or channels, and focus on your workflows without manually handling the full server setup.

Launch OpenClaw Now