---
title: "Deploy OpenClaw Claude"
description: "Run OpenClaw on Claude with your Anthropic API key"
category: "AI/ML"
url: https://railway.com/deploy/deploy-openclaw-with-anthropic-claude
---

# Deploy OpenClaw Claude

Run OpenClaw on Claude with your Anthropic API key

**[Deploy OpenClaw Claude on Railway](https://railway.com/template/deploy-openclaw-with-anthropic-claude)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-openclaw-with-anthropic-claude/manifest.json

- **Creator:** onepush
- **Category:** AI/ML

## Template content

### OpenClaw

- **Image:** openclaw/openclaw:2026.10.3-browser@sha256:c84c4c37e7b9dc02dd869c9699ba0c4fb20ff821febe4b789bb2f8f4bfd9c8a3
- **Start command:** `/bin/sh -c "set -ef; D=${RAILWAY_VOLUME_MOUNT_PATH:-/data}; mkdir -p $D/.openclaw $D/workspace $D/.config/openclaw; if [ ! -L /home/node/.config/openclaw ]; then rm -rf /home/node/.config/openclaw; ln -s $D/.config/openclaw /home/node/.config/openclaw; fi; find $D ! -user 1000 -exec chown -h 1000:1000 {} +; chmod 700 $D/.openclaw; cd /app; if [ ${#OPENCLAW_RAILWAY_CONFIG} -gt 0 ]; then setpriv --reuid=1000 --regid=1000 --init-groups env HOME=/home/node USER=node node openclaw.mjs config set --batch-json $OPENCLAW_RAILWAY_CONFIG || echo railway-start: config batch failed; fi; exec setpriv --reuid=1000 --regid=1000 --init-groups env HOME=/home/node USER=node tini -s -- node /app/docker-entrypoint.mjs node openclaw.mjs gateway --bind lan --port 18789 --allow-unconfigured"`
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted OpenClaw Claude (Self-Hosted AI Assistant on Anthropic Claude) on Railway

This template runs a self-hosted OpenClaw gateway wired to Anthropic Claude models, using your own Anthropic API key with usage billing.

## About Hosting OpenClaw Claude open-source software on Railway (self hosted OpenClaw on Anthropic Claude template)

OpenClaw is MIT licensed, so the gateway, sessions, and channel plumbing are code you can read and change, and the state it keeps lives on a volume you control.

## Why Deploy OpenClaw Claude, the Claude.ai alternative on Railway (Railway Free Trial)

Claude.ai is easier if you just want to chat with Claude in a browser. Railway's $5 free trial is enough to test it before you commit.

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 Claude on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for OpenClaw Claude self hosting

An always-on OpenClaw box needs a host, and the choice is how much setup you want to own.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | A deploy from this template with the gateway, volume, and token wired up, plus HTTPS. | A Droplet you manage, with the install script, Caddy, and firewall all on you. |
| AWS | One service with a persistent volume and env vars set in the dashboard. | EC2, EBS, and networking to configure before OpenClaw answers. |
| Hetzner | A managed deploy that handles the container, restarts, and proxy trust. | Low compute prices, with you handling OS updates and keeping the gateway up. |

Railway trades a little raw price for less setup and fewer things to babysit.

## Common Use Cases for hosted OpenClaw Claude

- **Always-on Telegram or Slack assistant:** Connect a chat channel to the gateway and message your Claude assistant from your phone, even with your laptop closed.
- **Haiku 5.5 for quick replies, a bigger model for long work:** Set anthropic/claude-haiku-5-5 as the fast default, then switch to a larger Claude model for research or multi-step tasks.
- **Browser automation driven by Claude:** Use the browser-enabled image so Claude can open pages, fill forms, and pull data on the server.
- **Keeping the key on the server:** Store ANTHROPIC_API_KEY as a Railway variable so it never sits in a dotfile on your laptop. Rotating it means changing one value and redeploying.
- **Cost tracking per session:** OpenClaw shows usage per session, so you can spot a runaway loop before it hits the Anthropic invoice.

## Dependencies for OpenClaw Claude Docker hosted on Railway

This section lists what the OpenClaw Claude template needs before it can answer you: one service, one volume, and one Anthropic API key.

### Deployment Dependencies for Managed OpenClaw Claude Service (Claude Model Provider)

The template runs as one Railway service built from the official OpenClaw Docker image.

For the model layer, set ANTHROPIC_API_KEY on the service. The API key route bills by usage and suits an always-on server.

### Implementation Details for OpenClaw Claude (Using OpenClaw official docker image)

The start command fixes volume ownership, applies OPENCLAW_RAILWAY_CONFIG, then runs `openclaw gateway --bind lan --port 18789 --allow-unconfigured` as the node user.

## How does OpenClaw Claude compare against other ways to run a personal assistant on Claude

### OpenClaw vs Claude.ai (Anthropic's Hosted App)

- **Where OpenClaw wins:** It runs on your own server and reaches you through chat channels like Telegram, Slack, and Discord.
- **Where OpenClaw wins:** Tools and browser automation run on your box, so the assistant can act on things rather than only answer questions.
- **Where Claude.ai wins:** Nothing to deploy or maintain. Sign in and it works, with no gateway token or volume to manage.

### OpenClaw vs Hermes Agent (Another Self-Hosted Agent)

- **Where OpenClaw wins:** The gateway is built around channels, sessions, and a Control UI, which suits one always-on assistant with several chat surfaces.
- **Where Hermes Agent wins:** If its agent design or workflow fits your habits better, it may be the right pick. Try both on a small task first.
- **Honest note:** Both can use Claude as the model, so the real difference is the agent architecture and tooling, not the model layer.

### OpenClaw vs Open WebUI (Self-Hosted Chat UI)

- **Where Open WebUI wins:** It is a chat interface first, so a clean web chat over several models is simpler to set up.
- **Where OpenClaw wins:** It keeps working when you are away from the browser, because messages from chat apps flow into the same session.

### API Key vs Claude CLI Login (Two Anthropic Auth Routes)

- **API key route:** Set ANTHROPIC_API_KEY on the Railway service and OpenClaw bills usage directly to your Anthropic account. The key is just an environment variable, which suits a server.
- **Claude CLI route:** Reuses a Claude Code login through the claude executable on the same host. It needs the executable inside the container and an interactive login, which is awkward on Railway.
- **Practical take:** On Railway the API key route is the simplest and most predictable, and the model picker labels each route so you can tell which one you are using.

## How to use OpenClaw Claude (the OSS personal AI assistant)?

Here's the first-day path after deploy. Go in order, since the Control UI won't connect until the key and token are set.

1. Create an API key in the Anthropic Console and set a monthly spend limit, because usage is billed per token.
2. On the OpenClaw service, add `ANTHROPIC_API_KEY` with that key and redeploy. The template ships it empty.
3. Open the Control UI on your Railway domain and paste `OPENCLAW_GATEWAY_TOKEN`. Approve the browser device once with `openclaw devices approve` in the service shell.
4. Set an `anthropic/` model as the default. A small one like `anthropic/claude-haiku-5-5` suits quick replies:

```json
{
  "agents": {
    "defaults": {
      "model": { "primary": "anthropic/claude-haiku-5-5" }
    }
  }
}
```

5. Send a test message and confirm you get a reply and a usage entry.
6. Connect a chat channel such as Telegram, then approve your sender with `openclaw pairing approve`, since unknown senders are paired by default.

## How to self host OpenClaw Claude on other VPS Services (OpenClaw self hosting guide)

You can run OpenClaw on any Linux box with Node and a persistent disk. The steps below use the same Anthropic setup as the template.

### Clone the Repository

Grab the upstream OpenClaw source for its docs and move into the folder.

```bash
git clone https://github.com/openclaw/openclaw.git
cd openclaw
```

### Install Dependencies

OpenClaw needs Node 24.16 or newer (or 26.1+). Install it globally, then run onboarding with your key.

```bash
npm install -g openclaw@latest
openclaw onboard --install-daemon --anthropic-api-key "$ANTHROPIC_API_KEY"
```

### Configure Environment Variables

Set your Anthropic key and gateway token, then point the default model at an anthropic/ ID.

```bash
export ANTHROPIC_API_KEY=your-anthropic-key
export OPENCLAW_GATEWAY_TOKEN=your-long-random-token
export OPENCLAW_GATEWAY_PORT=18789
```

Set agents.defaults.model.primary to anthropic/claude-haiku-5-5 for quick replies, or a larger Claude model for long tasks.

### Start the OpenClaw Claude Application

Start the gateway on port 18789, then open your server address and paste the gateway token into the Control UI.

```bash
openclaw gateway --bind lan --port 18789
```

On a VPS you handle restarts, backups, and TLS yourself. Railway handles the volume, public domain, and restarts for you.

## Official Pricing of OpenClaw Claude (OpenClaw pricing)

OpenClaw is free and open source under the MIT license, so there is no OpenClaw subscription to buy. Railway's $5 trial credit covers early testing.

The model bill is separate and usually the larger one. An ANTHROPIC_API_KEY is billed per token through your Anthropic Console account.

## OpenClaw Claude cloud vs self hosted comparison (Pricing, features, costs, and more)

Running OpenClaw on Railway trades a bit of setup for an always-on gateway you control.

### Monthly cost of self hosting OpenClaw Claude on Railway

Expect roughly $10-25 per month on Railway for the service, since the browser variant with Chromium needs 1-2 GB of RAM. OpenClaw itself is free software.

### System Requirements for Hosting OpenClaw Claude on a VPS

A VPS needs enough RAM for the Node gateway plus any browser tooling, so 1-2 GB is the practical floor if you run Chromium.

## Frequently Asked Questions (FAQs)

### Should I use an API key or a Claude subscription login?

Use the API key route on Railway. Set ANTHROPIC_API_KEY on the service and billing runs through usage.

### Which Claude model should I pick?

Use anthropic/claude-haiku-5-5 for quick replies and cheap background work. Set a larger Claude model as primary for long or tricky tasks.

### What does Haiku 5.5 cost per token?

OpenClaw's docs list 0.10 USD per million input tokens and 0.50 USD per million output tokens for prompts up to 100K tokens.

### Does prompt caching apply?

Yes, caching can cut repeated input costs on long system prompts and tool definitions.

### Why does the model picker show two routes?

The picker lists each model once per route and labels the API route apart from the Claude CLI route.

### Can I fall back to another provider?

Yes, model providers are plugins, so you can add another key and configure it as a fallback. Keep Anthropic as primary so default behavior stays predictable.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius v0.1 Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/deploy-openclaw-with-anthropic-claude
