Deploy ollama + openweb-ui: run your own open models, own your (free) tokens

Ollama + OpenWeb-UI + Real, Working, Local Models

Deploy ollama + openweb-ui: run your own open models, own your (free) tokens

Ollama

Just deployed

/app/backend/data

Just deployed

/root/.ollama

Deploy and Host Ollama + Open WebUI

Deploy on Railway

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/ollama image, model storage persisted at /root/.ollama
  • Open WebUI — official ghcr.io/open-webui/open-webui image, data persisted at /app/backend/data
  • Railway private networking — WebUI reaches Ollama via OLLAMA_BASE_URL=http://ollama:11434

Dependencies for

Deployment Dependencies

🖥️ Minimum Hardware Requirements for Ollama + Open WebUI

Model classExamplesMin RAMExperience
1–4BLlama 3.2 3B, Gemma 2 2B, Phi-3.54–8 GBSnappy on CPU
7–9BLlama 3.1 8B, Qwen 2.5 7B, Mistral 7B8–16 GBGood on CPU, fast on GPU
13–14BQwen 2.5 14B16 GB+Usable on CPU
30B+Qwen 2.5 32B, DeepSeek-R1 32B32 GB+GPU recommended
70BLlama 3.3 70B48–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 costsEvery request bills$0 — unlimited
Heavy month (10M tokens)$30–150+Same infra price
PrivacyPrompts leave your controlPrompts stay on your instance
Model freedomVendor's catalog100+ 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

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
116
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
5
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
67