---
title: "Deploy OpenClaw Ollama"
description: "Point OpenClaw at Ollama models on your private network"
category: "AI/ML"
url: https://railway.com/deploy/deploy-openclaw-with-ollama-models
---

# Deploy OpenClaw Ollama

Point OpenClaw at Ollama models on your private network

**[Deploy OpenClaw Ollama on Railway](https://railway.com/template/deploy-openclaw-with-ollama-models)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-openclaw-with-ollama-models/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 Ollama (Self-Hosted AI Assistant on Open Models) on Railway

This template runs the OpenClaw gateway on Railway. Ollama isn't included: add it to the same project, point OpenClaw at its private URL, and keep chats on open models. CPU-only by default, so small models are slow.

## About Hosting OpenClaw Ollama open-source software on Railway (self hosted OpenClaw with Ollama template)

Your conversations and model weights stay on your own Railway project: OpenClaw stores state in the /data volume, and Ollama serves inference over the private network.

This template runs just the OpenClaw gateway on port 18789 with a /healthz check and a generated gateway token. Railway handles TLS, the public domain, and volume mounts.

## Why Deploy OpenClaw Ollama, the Open WebUI alternative on Railway (Railway Free Trial)

Open WebUI gives you a chat UI over Ollama; OpenClaw gives you an agent that actually calls tools and can point at the same private Ollama service. You pay for the container, not per token, and the $5 Railway trial is enough to test a small CPU model 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 Ollama 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 Ollama self hosting

Running a gateway next to Ollama is the part you'd rather not wire by hand.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | OpenClaw plus Ollama on one private network | A droplet where you install and wire both by hand |
| AWS | Ollama in the same project, over private networking | EC2, VPC setup, and bills you babysit |
| Hetzner | No GPUs here, so small models or Ollama Cloud | Cheap CPU and GPU boxes, but you patch them |

## Common Use Cases for hosted OpenClaw Ollama

- **Keep chats off hosted model APIs:** run a local Ollama service beside the gateway and your prompts, tool results, and channel history stay on Railway's private network instead of a vendor's model endpoint.

- **One private model for the whole project:** add the ollama/ollama image, give it a volume at /root/.ollama, set OLLAMA_HOST=[::]:11434 so it listens on Railway's IPv6 private network, then point the ollama provider at http://ollama.railway.internal:11434.

- **Ollama Cloud without owning hardware:** use the ollama-cloud provider with a real OLLAMA_API_KEY when a larger model beats slow CPU inference, and keep the same OpenClaw sessions and tools.

- **A cheap fallback behind a paid primary:** keep a small local model listed as a secondary so routine or offline work still answers when the paid provider fails or hits a limit.

- **Test open models for tool calling:** try a model with a large context window against real multi-step tool use before committing your assistant to it.

## Dependencies for OpenClaw Ollama Docker hosted on Railway

The template ships OpenClaw only, so Ollama is a dependency you add yourself: a second service in the same Railway project, on the private network, with a volume for model weights.

### Deployment Dependencies for Managed OpenClaw Ollama Service (Private LLM Assistant)

Run the `ollama/ollama` image on port 11434 with a volume at `/root/.ollama`, and set `OLLAMA_HOST=[::]:11434` so it listens on IPv6, which is what Railway private networking uses. OpenClaw reaches it at `http://ollama.railway.internal:11434`.

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

The OpenClaw side is the pinned `openclaw/openclaw:2026.10.3-browser` image (multi-arch, Chromium bundled, MIT). Health is `/healthz`, and state lives in `/data/.openclaw`.

## How does OpenClaw Ollama compare against other ways to run a personal assistant on open models

### OpenClaw vs Open WebUI

- **Scope:** Open WebUI is a chat UI for Ollama; OpenClaw is an agent gateway with tools and channels.
- **Ollama wiring:** both use the native API, but OpenClaw's baseUrl must omit /v1 for tool calls.
- **Where Open WebUI wins:** polished multi-user chat and document RAG need less setup.
- **Costs:** both are free software; you pay for compute and any hosted model calls.

### OpenClaw vs Hermes Agent

- **Overlap:** both are self-hosted agents with memory and messaging gateways.
- **Ollama path:** OpenClaw documents a native ollama provider with explicit models for remote hosts.
- **Where Hermes wins:** more memory-first defaults; OpenClaw makes you choose tools and context.
- **Railway fit:** both run as one container with a volume; OpenClaw's browser image needs more RAM.

### OpenClaw vs LibreChat

- **Focus:** LibreChat is multi-provider chat; OpenClaw is a control plane behind Slack or Telegram.
- **Ollama:** LibreChat tolerates OpenAI-compatible URLs; OpenClaw wants native so tools stay intact.
- **Where LibreChat wins:** quicker for plain chat with no agent loop to tune.
- **Costs:** both are free, so the bill is compute plus any hosted model calls.

### OpenClaw vs AnythingLLM

- **Shape:** AnythingLLM is desktop and server RAG chat; OpenClaw is headless behind a gateway.
- **Ollama:** AnythingLLM's document work is the draw; OpenClaw's value is tool execution.
- **Where AnythingLLM wins:** chatting with private PDFs on Ollama takes less setup.

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

1. Add an `ollama/ollama` service: port 11434, volume at `/root/.ollama`, env `OLLAMA_HOST=[::]:11434`.
2. Run `ollama pull qwen3:8b` in its shell, and pick a model that actually supports tools.
3. Open the OpenClaw domain, paste `OPENCLAW_GATEWAY_TOKEN`, approve the browser device.
4. Point the ollama provider at the native API (no `/v1`) with the model listed explicitly:

```json
{"models":{"providers":{"ollama":{"baseUrl":"http://ollama.railway.internal:11434","apiKey":"ollama-local","api":"ollama","models":[{"id":"qwen3:8b","contextWindow":65536}]}}},"agents":{"defaults":{"model":{"primary":"ollama/qwen3:8b"}}}}
```

5. Restart, send a test message, and confirm tool calls come back as clean calls, not raw JSON text.

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

Same shape on any Ubuntu box with 8 GB RAM and no GPU.

### Clone the Repository

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

### Install Dependencies

Install Node 24.16 or newer, the openclaw CLI, Ollama and a tool-calling model. Small models flub multi-step tool calls, so pick carefully.

```
npm install -g openclaw@latest
curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen2.5:7b
```

### Configure Environment Variables

Point the ollama provider at the local host, not the /v1 URL.

```
export OPENCLAW_STATE_DIR=/opt/openclaw/data
export OLLAMA_HOST=127.0.0.1:11434
```

### Start the OpenClaw Ollama Application

Run onboarding, then the gateway, and set the default model.

```
openclaw onboard --install-daemon
openclaw gateway --bind lan --port 18789
```

Set agents.defaults.model.primary to ollama/qwen2.5:7b. Railway handles TLS, the public domain, the volume, and the private network to Ollama, so you skip all of this.

## Official Pricing of OpenClaw Ollama (OpenClaw pricing)

OpenClaw is MIT licensed and free to self host; Ollama is free too. You pay for infrastructure, not software. Ollama Cloud bills separately through ollama.com if you go that route. Model weights you pull yourself cost nothing beyond storage.

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

Ollama Cloud (provider id ollama-cloud) trades control for zero ops: prompts go to ollama.com with OLLAMA_API_KEY and you host no weights. Self hosting keeps them inside your own Railway project, where you own the CPU time and the model volume.

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

Budget about $10-25/mo for the OpenClaw service, since the browser variant with Chromium wants 1-2 GB of RAM, plus the Ollama service's memory and volume. The $5 trial covers early experiments. A private Ollama adds no license cost at all.

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

Give the stack 2 GB of RAM or more, Docker, a /data volume, and one at /root/.ollama for weights. An 8B model in 4-bit needs a few GB of disk, and shared-vCPU inference is slow enough that a 64k context feels it. A GPU host handles bigger tool-calling models.

## Frequently Asked Questions (FAQs)

### Why not use Ollama's /v1 URL?

Because the /v1 endpoint breaks tool calling. Tool calls get dropped, or the model prints raw tool JSON as plain text. Use baseUrl http://ollama.railway.internal:11434 with no suffix.

### Which Ollama models work with tools?

Pick models with a tool-calling template and check the model card first. Small 3B to 8B models handle one call but stumble on multi-step work. Aim for 64k context or more when the model allows it.

### How slow is CPU inference on Railway?

Railway has no GPUs, so expect seconds per turn on a 7B and real pain on bigger models. Prompt processing on a long context dominates, so short chats stay usable and long agent loops crawl.

### Can I use Ollama Cloud instead of a local service?

Yes. Use the ollama-cloud provider with a real OLLAMA_API_KEY and drop the local service, or keep both modes so local takes cheap traffic and cloud takes the hard agent work.

### Does OpenClaw need a real API key for Ollama?

No. Local Ollama ignores the key, so any placeholder such as ollama-local works. OpenClaw only reads a real OLLAMA_API_KEY when the provider points at ollama.com.


## 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-ollama-models
