Deploy ollama + openweb-ui: run your own open models, own your (free) tokens
Ollama + OpenWeb-UI + Real, Working, Local Models
Ollama
Open WebUI
Just deployed
/app/backend/data
Ollama
Just deployed
/root/.ollama
Deploy and Host Ollama + Open WebUI
Run your own private AI chat — Ollama serving 100+ open models (Llama, Qwen, Gemma, Mistral, DeepSeek, Phi and more) with Open WebUI on top: a polished, self-hosted ChatGPT-style interface. No API keys, no rate limits, no per-token bills — your prompts never leave your Railway instance.
🎯 Stop renting tokens. Own them. With closed-model APIs you pay for every token, forever. Here, tokens are unlimited and free — you only pay for infrastructure.
🚀 Getting Started with Ollama + Open WebUI on Railway | Deployment Guide
Once your Railway deploy is live, open your Open WebUI URL — the first account you create automatically becomes the admin.
Step 1: Create Your Admin Account
Open your service URL and sign up. The first registered user gets full admin rights over models, users, and settings.
Step 2: Pull Your First Model
Go to Admin Panel → Settings → Models → Pull a model and pull any model from ollama.com by name, for example llama3.1:8b or qwen2.5:7b. Models download straight to your persistent volume, so they survive redeploys. You can also pull curated, community-tuned configs from ollama.com/oamazonasgabriel — optimized for consumer-hardware-class resources.
Step 3: Chat
Pick the model in the top-left dropdown and start chatting. Switch models mid-conversation, run side-by-side comparisons, or attach documents for RAG-powered answers.
Step 4: Connect Your Apps (Optional)
Generate an API key in Settings → Account → API Keys and point any OpenAI-compatible tool at your own endpoint. Your apps get an AI backend with zero per-token billing.
About Hosting Ollama + Open WebUI 📖
This template deploys a production-ready, two-service stack with persistent storage:
- 🦙 Ollama — the model runtime. Pulls and serves open models, exposes an OpenAI-compatible API. Kept private (no public domain) and wired to WebUI over Railway private networking.
- 💬 Open WebUI — the ChatGPT-style interface. Multi-user auth, chat history, markdown + code highlighting, voice input, document uploads (RAG), and web search. This is the only public-facing service.
- 💾 Two persistent volumes — one for pulled models (
/root/.ollama), one for users, chats, and uploads (/app/backend/data). Both survive redeploys and updates.
Your models and conversations are 100% yours: nothing is sent to third parties, and there are no token meters running.
Why Deploy Ollama + Open WebUI on Railway ✅
One-click deploy with zero server configuration:
- 🟢 No Docker, driver, or CUDA setup — Railway handles it all
- 💾 Persistent volumes keep models, chats, and accounts across deploys
- 🔐 Private networking between services — Ollama is never exposed publicly
- 📉 Scale down when idle and pay pennies; scale up for heavy sessions
- 🧩 GPU instances available (plan/region dependent) for 10–30× faster inference
- 🌐 Browser-based everything — pull models and manage users without SSH
- 🔄 Redeploy to update images — models and data persist
Common Use Cases 💡
- Private ChatGPT alternative — personal or team AI chat with zero data leaving your server
- Free-token API backend — replace per-token API bills with an OpenAI-compatible endpoint you own
- Document intelligence — upload PDFs and docs, chat with them via built-in RAG
- Team AI workspace — multi-user accounts, shared prompts, per-user history
- Open-model experimentation — benchmark models, tune system prompts, compare answers side-by-side
- Sovereign AI — run open-weight models (Llama, Qwen, Gemma, DeepSeek, Mistral) on infrastructure you control
Dependencies for Ollama + Open WebUI 📦
- Ollama — official
ollama/ollamaimage, model storage persisted at/root/.ollama - Open WebUI — official
ghcr.io/open-webui/open-webuiimage, data persisted at/app/backend/data - Railway private networking — WebUI reaches Ollama via
OLLAMA_BASE_URL=http://ollama:11434
Dependencies for
Deployment Dependencies
- Ollama: ollama/ollama — Model library — Curated configs
- Open WebUI: open-webui/open-webui — Docs
🖥️ Minimum Hardware Requirements for Ollama + Open WebUI
| Model class | Examples | Min RAM | Experience |
|---|---|---|---|
| 1–4B | Llama 3.2 3B, Gemma 2 2B, Phi-3.5 | 4–8 GB | Snappy on CPU |
| 7–9B | Llama 3.1 8B, Qwen 2.5 7B, Mistral 7B | 8–16 GB | Good on CPU, fast on GPU |
| 13–14B | Qwen 2.5 14B | 16 GB+ | Usable on CPU |
| 30B+ | Qwen 2.5 32B, DeepSeek-R1 32B | 32 GB+ | GPU recommended |
| 70B | Llama 3.3 70B | 48–64 GB+ | GPU strongly recommended |
💡 Start with a 7–8B model — the sweet spot for quality vs. cost. Attach a Railway GPU where available for serious inference speed.
💰 Own Your (Free) Tokens — The Economics
| Closed APIs (per-token) | This template | |
|---|---|---|
| Token costs | Every request bills | $0 — unlimited |
| Heavy month (10M tokens) | $30–150+ | Same infra price |
| Privacy | Prompts leave your control | Prompts stay on your instance |
| Model freedom | Vendor's catalog | 100+ open models, swap anytime |
Reality check: you pay for RAM/CPU while running, not tokens. An always-on 8 GB instance is ~$80/mo — heavy API users break even fast. Everyone else can scale down when idle: models reload from the volume in seconds on demand, so light usage costs literal pennies.
🐳 Self-Hosting Ollama + Open WebUI Outside Railway
Prefer your own hardware? The same stack runs anywhere Docker runs:
# 1) Ollama with persistent model storage
docker run -d --name ollama -p 11434:11434 -v ollama:/root/.ollama ollama/ollama
# 2) Open WebUI, pointed at your local Ollama
docker run -d --name open-webui -p 3000:8080 \
-e OLLAMA_BASE_URL=http://host.docker.internal:11434 \
--add-host=host.docker.internal:host-gateway \
ghcr.io/open-webui/open-webui:main
Open http://localhost:3000, create your admin account, and pull models as usual.
❓ FAQ
How do I add models? Admin Panel → Settings → Models → pull by name (qwen2.5:7b, gemma2:9b, deepseek-r1:8b…). Models persist across redeploys on the volume.
Are my chats and prompts private? Yes — everything stays on your Railway instance and volumes. Nothing is sent to third parties.
Can I use my existing OpenAI tools and SDKs? Yes — Open WebUI exposes an OpenAI-compatible API with keys you control. Point any OpenAI client at it.
A model feels slow on CPU. Use a smaller or quantized model (e.g. :4b variants), or deploy in a GPU-enabled region and attach a GPU.
How do I update the stack? Hit redeploy — both images update, and your models, chats, and accounts persist on the volumes.
Can multiple people use it? Yes — every user gets their own account, history, and settings. Admins manage users and default models.
Template Content
Open WebUI
ghcr.io/open-webui/open-webuiOllama
ollama/ollama
