Back openDesk Edu for a sovereign, open-source education β every vote counts.
Vote nowYour Outcome
Run your own AI inference with Ollama, Open WebUI, and LiteLLM β production-hardened with Nginx, health checks, and backup.
The information, code snippets, configuration files, and instructions provided in this product are shared for educational and informational purposes only. While every effort has been made to ensure accuracy, you are solely responsible for reviewing, testing, and adapting any code or configurations to your own environment before using them in production.
No liability: The author(s) shall not be held liable for any damages, data loss, system outages, security breaches, or other issues arising from the use, misuse, or inability to use the code, configurations, or instructions provided in this product. By downloading or using this product, you acknowledge that you understand and accept these terms.
Production Ansible deployment for two DGX Spark (GB10) nodes with vLLM TP2 serving DeepSeek-V4-Flash (671B), fronted by LiteLLM, monitored by Prometheus/Grafana, and wired over 200Gbps RoCE. The reference deployment for our Dual DGX Spark case study.
Production-ready Dify with PostgreSQL, Redis, Weaviate, Nginx, and SSRF protection β not a toy compose file.
The official Ollama docs tell you to run ollama run llama3.1. Open WebUI has a one-line install script. LiteLLM's quickstart is three commands. Each tool works in isolation β and that's where the documentation stops.
What nobody tells you:
gpt-4 calls to Ollama's chat/completions endpoint requires knowing the exact proxy formatThis stack fixes all of those problems. It's the integration layer that turns three standalone tools into a production AI inference service.
ββββββββββββ
HTTPS β Nginx β :8080
βββββββββββββββββββΊ :443 ββββββββββββΊ LiteLLM βββββββΊ Ollama :11434
β TLS β :8000 (GPU)
ββββββββββββ β
βΌ
Open WebUI
:3000
Nginx terminates TLS, applies security headers (X-Content-Type-Options, X-Frame-Options, CSP), and rate-limits requests. It proxies /v1/* to LiteLLM and / to Open WebUI β giving you a single HTTPS endpoint.
LiteLLM acts as an OpenAI-compatible proxy. Your applications send standard POST /v1/chat/completions requests and LiteLLM routes them to Ollama. It handles API key validation, rate limiting, and model fallbacks.
Ollama runs on the internal Docker network only β it's not exposed to the internet. Resource limits prevent it from consuming more than 90% of GPU memory, leaving room for other containers.
/v1 β LiteLLM routing, rate limitingbase_url: "https://your-domain.com/v1"llama3.1:70b is busy, requests route to llama3.1:8b automatically# Clone and configure
unzip self-hosted-ai-stack.zip
cd self-hosted-ai-stack
cp .env.example .env
# Edit .env: set your domain, model preferences, GPU memory limit
# Deploy
docker compose up -d
# Verify
./health-check.sh
# Pull a model
docker compose exec ollama ollama pull llama3.1:8b
Your AI inference service is now live at https://your-domain.com.
A developer on your team pushes code that calls openai.chat.completions. It hits your proxy. LiteLLM routes it to Ollama. Ollama loads the model and returns the response β all OpenAI-compatible, zero latency added.
No API key rotation needed. No monthly invoice. No "our OpenAI bill was β¬2,300 last month and counting."
This stack covers Ollama + Open WebUI + LiteLLM. If you need the full platform β Dify for RAG pipelines, n8n for workflow automation, Qdrant for vector search, Prometheus/Grafana for monitoring, and MinIO for backups β check out AI Infrastructure Mastery which includes this stack plus everything else.