DEV Community

How to Run Local LLMs with Open WebUI on Docker (Ditch the 0/mo AI Subscriptions)

How to Run Local LLMs and Open WebUI on a Cloud VPS (Goodbye $20/mo ChatGPT Plus) Originally published on SelfHostStack If you pay $20/month for ChatGPT Plus or Claude Pro, you are paying $240 every single year for: - Rate limits during peak working hours. - Cloud providers retaining your confidential code and business prompts for model training. - Zero control over when models get deprecated, re-aligned, or degraded in coding capabilities. With modern quantized open-weight models (Llama 3.1, Mistral NeMo, DeepSeek-Coder, and Qwen 2.5), you can host your own private, unrestricted AI workspace on a low-cost VPS with Open WebUI and Ollama. In this guide, we'll walk through the complete deployment using Docker Compose, setup reverse proxy authentication, and benchmark token generation speeds. The Economics: SaaS AI vs. Self-Hosted AI | Model / Setup | Cost | Privacy / Retention | Context & Feature Limits | |---|---|---|---| | ChatGPT Plus / Claude Pro | $20/month ($240/yr) | Cloud training, data retained | Strict 3-hour message caps, hard rate limits | | Open WebUI + Ollama (VPS) | ~$6 - $12/month VPS | 100% Private (Zero telemetry) | Unlimited messages, custom system prompts, RAG document chat | | Hybrid (Open WebUI + OpenRouter/DeepSeek API) | ~$1 - $3/month (Pay per token) | Zero retention API options | Access to 100+ models in a unified ChatGPT-like UI | Why Open WebUI is the Superior ChatGPT Interface Open WebUI (70k+ GitHub stars) is arguably the most polished open-source AI frontend available: - Full feature parity with ChatGPT: Chat history, markdown code highlighting, branch editing, and web search. - Multi-Model Orchestration: Switch between Ollama local models and external APIs (OpenAI, Anthropic, DeepSeek, Groq) seamlessly. - Built-in RAG (Retrieval-Augmented Generation): Upload PDFs, markdown files, and codebases to chat with your private documentation offline. - Granular Multi-User RBAC: Invite your whole team without paying per-seat SaaS license fees. 1. The Production Docker Compose Stack Here is the exact production-ready docker-compose.yml to run Open WebUI paired with Ollama: version: '3.8' services: open-webui: image: ghcr.io/open-webui/open-webui:main container_name: open-webui restart: always ports: - "3000:8080" environment: - OLLAMA_BASE_URL=http://ollama:11434 - WEBUI_SECRET_KEY=generate_random_secret_string_here - ENABLE_SIGNUP=false # Set to false after creating your admin account volumes: - webui-data:/app/backend/data depends_on: - ollama ollama: image: ollama/ollama:latest container_name: ollama restart: always ports: - "11434:11434" volumes: - ollama-models:/root/.ollama volumes: webui-data: ollama-models: 2. Step-by-Step Server Setup Step 1: Provision a High-Compute VPS For lightweight models (like llama3.2:3b or qwen2.5-coder:1.5b ), a standard 4GB RAM cloud instance works great. For larger 8B parameter models, choose a VPS with 8GB RAM and fast NVMe storage: - Hetzner Cloud CX32 (4 vCPU, 8GB RAM, 80GB NVMe) - ~โ‚ฌ7.59/mo - DigitalOcean Droplet (includes $200 free trial credit) - Vultr High Performance (global low latency compute) Step 2: Install Docker & Spin Up the Stack SSH into your server and run: # Install Docker Engine curl -fsSL https://get.docker.com | sh # Create directory and start stack mkdir -p ~/ai-stack && cd ~/ai-stack nano docker-compose.yml # (paste the compose YAML above) docker compose up -d Step 3: Pull High-Efficiency Models Pull lightweight, high-performance models directly inside the Ollama container: # Ultra-fast coding model (Qwen 2.5 Coder 7B) docker exec -it ollama ollama pull qwen2.5-coder:7b # General reasoning model (Llama 3.1 8B) docker exec -it ollama ollama pull llama3.1:8b # Extremely fast 3B model for low-resource VPS docker exec -it ollama ollama pull llama3.2:3b Step 4: Secure with SSL Reverse Proxy Use Caddy for automatic HTTPS: ai.yourdomain.com { reverse_proxy localhost:3000 } 3. Hybrid Power: Adding Pay-As-You-Go API Keys If you need occasional access to frontier models (Claude 3.5 Sonnet, GPT-4o, or DeepSeek-V3) for massive refactoring tasks, you don't need a $20/month subscription: - Open WebUI Settings โ†’ Connections โ†’ OpenAI API. - Add your OpenRouter or DeepSeek API key. - Now you get local models for everyday questions ($0 cost) and frontier APIs for $0.002 per prompt, saving ~90% of your AI budget. Explore More Self-Hosted Stacks Looking to replace other expensive developer and productivity tools? Explore our curated guides with verified Docker templates: Top comments (0)

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.