Deploy OpenClaw
Self-hosted OpenClaw AI agent with a browser setup wizard and backups.
Just deployed
/data
Deploy and Host OpenClaw on Railway
OpenClaw is the open-source personal AI agent with 390,000+ GitHub stars. It chats with you from Telegram, Discord, Slack and other messaging apps, and can browse the web, run commands and work on scheduled tasks. This template runs OpenClaw on Railway behind a password-protected browser wizard, so you never need a terminal. A ChatGPT Plus or Claude Pro subscription costs $20/month. Self-hosted OpenClaw runs for about $3–5/month plus the AI API usage you actually use, with your memory and settings on your own volume.
What This Template Deploys
| Service | Purpose |
|---|---|
| Openclaw | The OpenClaw gateway plus a setup wrapper on port 8080, served over HTTPS on your Railway domain. |
| Setup wizard | /setup picks your AI provider, adds channel tokens, approves devices, and exports or imports backups. |
| Web terminal | /tui runs openclaw commands from the browser; off until you enable it. |
| Persistent Volume | Mounted at /data: config, credentials, chat memory, installed skills and the agent's workspace. |
It's a single service, with no database and no Redis. The wrapper starts the OpenClaw gateway inside the container on an internal port and proxies every request, including WebSockets, to it. Everything OpenClaw knows lives on the /data volume.
About Hosting OpenClaw
OpenClaw is a long-running agent, not a chat page. It has to stay online to answer messages, hold bot tokens and API keys safely, and keep its memory between restarts. Self-hosting usually means a VPS, a process manager, a reverse proxy with TLS, and editing JSON config over SSH whenever you add a channel or change models.
This template replaces those steps with a web wrapper. On Railway you get automatic HTTPS, a health check that restarts the service if it stops responding, and a volume that keeps state across every redeploy. Onboarding, channel setup, device pairing, config edits, logs and backups all happen in the browser, protected by a password you choose.
Set SETUP_PASSWORD when you deploy. It has no default, and the /setup wizard stays locked with an error until it's set. Anyone with that password can change the agent's config, so use a long, unique one.
Typical cost: ~$3–5/month on Railway for the container, plus your AI provider's API usage. Railway's Hobby plan is $5/month and includes $5 of usage. Light personal use on a small model usually costs a few dollars of API usage, much less than a $20/month chat subscription.
Deploy OpenClaw in Under 5 Minutes
- Click Deploy on Railway and enter a strong
SETUP_PASSWORD. The image builds in about 3–5 minutes. - Open
https://your-app.up.railway.app/setupand sign in with that password. The username can be left empty. - Choose an AI provider, either from the built-in list or any OpenAI- or Anthropic-compatible endpoint, and paste its API key.
- Optionally add a Telegram, Discord or Slack bot token, then approve the pairing request from the wizard.
- Open your Railway URL and start talking to your agent, in the browser or from your chat app.
No SSH. No config files. No reverse proxy.
Common Use Cases
- Self-hosted ChatGPT Plus alternative. Pay per API call instead of a flat subscription, and switch models whenever you like.
- Personal assistant in Telegram or Discord. Message your agent from your phone for research, drafts and quick answers.
- One agent across chat apps. Connect several channels to one agent with shared memory.
- Scheduled tasks. Daily briefings, website checks and reminders that run without you prompting.
- Browser and file automation. Let the agent read pages, collect data and work with files in its workspace.
- A private sandbox for AI models. Try Anthropic, OpenAI, Gemini or OpenRouter models behind one interface.
- Team or family bot. One hosted agent in a shared Discord or Slack, with device approval controlling who can connect.
Configuration
| Variable | Required | Description |
|---|---|---|
SETUP_PASSWORD | ✅ Required | Password for /setup, /logs and /tui. Also encrypts exported backups. |
OPENCLAW_GATEWAY_TOKEN | 🔐 Auto-generated | Token between the Control UI and the gateway. Paste it in the UI when asked on first run. |
ENABLE_WEB_TUI | Optional | false by default. Set true to open the browser terminal at /tui. |
OPENCLAW_STATE_DIR | ✅ Set | /data/.openclaw for config, credentials and memory. Leave it on the volume. |
OPENCLAW_WORKSPACE_DIR | ✅ Set | /data/workspace, where the agent's working files live. |
INTERNAL_GATEWAY_HOST, INTERNAL_GATEWAY_PORT | ✅ Set | 127.0.0.1 and 18789: the gateway's address inside the container, not public. |
RAILWAY_RUN_UID | ✅ Set | 0, so the startup script can fix volume permissions before switching to the unprivileged openclaw user. |
PORT | Auto-set | 8080, where the wrapper listens. |
Your AI provider key and bot tokens are entered in the wizard and saved to the volume, so you don't need to add them as Railway variables. The web terminal allows one session at a time, closes after 5 minutes idle and is capped at 30 minutes (TUI_IDLE_TIMEOUT_MS and TUI_MAX_SESSION_MS change this).
OpenClaw on Railway vs. Alternatives
| OpenClaw on Railway | ChatGPT Plus | Claude Pro | Hermes Agent (self-hosted) | |
|---|---|---|---|---|
| Monthly cost | ~$3–5 plus API usage | $20 | $20 ($17 billed yearly) | Hosting plus API usage |
| Self-hosted | ✅ Yes | ❌ No | ❌ No | ✅ Yes |
| Choose any AI model | ✅ Any provider | ❌ OpenAI only | ❌ Anthropic only | ✅ Many providers |
| Chat from Telegram, Discord or Slack | ✅ Built in | ❌ No | ❌ No | ✅ Yes |
| Browser setup, no terminal | ✅ Setup wizard | ✅ Hosted | ✅ Hosted | ⚠️ Mostly CLI |
| Your data on your volume | ✅ Yes | ❌ OpenAI servers | ❌ Anthropic servers | ✅ Yes |
| License | ✅ MIT | ❌ Proprietary | ❌ Proprietary | ✅ MIT |
Dependencies for OpenClaw Hosting
- A Railway account. The Hobby plan ($5/month including $5 of usage) covers one personal agent.
- An API key from at least one AI provider, such as Anthropic, OpenAI, Google Gemini or OpenRouter.
- Optional: a Telegram bot token from BotFather, a Discord bot token, or a Slack app token.
Deployment Dependencies
- OpenClaw on GitHub: source code and releases
- OpenClaw Documentation: channels, models and skills
- Railway Volumes Documentation: persistence for
/data - Telegram BotFather: create a Telegram bot token
Implementation Details
The image is built from a Dockerfile on Node 24 with the openclaw and clawhub CLIs, plus Homebrew so skills can install their own tools. The startup script fixes /data permissions, keeps Homebrew on the volume, then runs the wrapper as an unprivileged user. The wrapper runs OpenClaw's onboarding, starts the gateway on 127.0.0.1:18789, sets the Control UI's allowed origin to your Railway domain, and proxies all other traffic, WebSockets included, to the gateway.
Railway checks /setup/healthz and restarts the service on failure. Export a password-protected backup from the wizard before big changes.
Frequently Asked Questions
What is OpenClaw, and is it the same as Clawdbot or Moltbot? OpenClaw is an open-source personal AI agent you run yourself and reach from chat apps. It was previously called Clawdbot and Moltbot; the project and codebase are the same.
How much does OpenClaw cost compared to ChatGPT Plus? About $3–5/month on Railway for the container, plus API usage that depends on the model and how much you use it. ChatGPT Plus and Claude Pro are each $20/month whether you use them or not.
Why does /setup say SETUP_PASSWORD is not set?
The wizard stays locked until the variable exists. Add SETUP_PASSWORD in the service's Variables tab, redeploy, then sign in with it.
Do I lose memory or channel connections when Railway redeploys?
No. Config, credentials, memory, skills and workspace files are on the /data volume, so redeploys and restarts keep them. Export a backup from the wizard as well.
Which AI models and chat apps can I connect? Any provider OpenClaw supports, including Anthropic, OpenAI, Gemini and OpenRouter, plus any OpenAI- or Anthropic-compatible endpoint. The wizard sets up Telegram, Discord and Slack; other channels can be added through the config editor or the web terminal.
Is it safe to give an AI agent its own server? The agent can run commands and browse inside its own container, so it's isolated from your computer. Use a strong password, approve only your own devices, and give it only the API keys it needs.
Why Deploy and Host OpenClaw on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying OpenClaw on Railway, you get a private AI agent you can reach from any chat app, set up in the browser and backed by a persistent volume, for a few dollars a month plus the API usage you choose.
Template Content
SETUP_PASSWORD
Password for the setup (no username required)
