Production-ready Docker stack for self-hosted AI infrastructure
Features β’ Installation β’ Usage β’ Documentation β’ Contributing
LiteLLM-Stack is a complete, production-ready Docker infrastructure for self-hosting AI services. It combines LiteLLM proxy, Open WebUI interface, PostgreSQL database, and SSL-secured Nginx reverse proxy into a single, easy-to-deploy stack.
Perfect for developers, researchers, and organizations who want full control over their AI infrastructure without vendor lock-in.
- LiteLLM Proxy - Connect to 100+ LLM providers (OpenAI, Anthropic, Google, Azure, local models, and more) through a single unified API
- Load Balancing - Distribute requests across multiple models and providers
- Cost Tracking - Monitor usage and costs across all providers
- Caching - Reduce costs with intelligent response caching
- Open WebUI - Beautiful, ChatGPT-like interface for interacting with AI models
- Multi-Model Support - Switch between different models seamlessly
- Conversation History - Save and manage your AI conversations
- Team Collaboration - User authentication and role management
- SSL/TLS Encryption - Automatic HTTPS with self-signed or custom certificates
- Nginx Reverse Proxy - Professional-grade reverse proxy with security headers
- Authentication - Built-in user authentication and API key management
- Network Isolation - Docker network separation for enhanced security
- One-Command Setup - Get started in minutes with Docker Compose
- Persistent Storage - PostgreSQL database for configuration and history
- Health Checks - Automatic monitoring and recovery
- Zero Configuration - Sensible defaults that work out of the box
- OpenAI-Compatible API - Drop-in replacement for OpenAI API
- Detailed Logging - Debug mode for troubleshooting
- Extensible Configuration - YAML-based configuration for easy customization
- Docker Native - Container-first architecture
- Docker 20.10 or higher
- Docker Compose 2.0 or higher
- OpenSSL (for SSL certificate generation)
- 2GB RAM minimum (4GB recommended)
- 5GB disk space minimum
# Clone the repository
git clone https://github.com/sieekuu/litellm-stack.git
cd litellm-stack
# Generate SSL certificates
cd scripts
chmod +x generate-ssl.sh
./generate-ssl.sh
cd ..
# Create environment file (optional)
cp .env.example config/litellm/.env
# Edit config/litellm/.env and add your API keys
# Start the stack
docker compose up -d
# Check status
docker compose psAfter deployment, access your services at:
- π Open WebUI (HTTPS): https://localhost:8443
- π‘ LiteLLM API: http://localhost:4000
- π LiteLLM Admin UI: http://localhost:4000/ui
- Access Open WebUI at https://localhost:8443
- Accept the SSL warning (for self-signed certificates)
- Create an admin account (first user becomes admin)
- Configure API Keys in Settings β Connections
- Start chatting with your AI models!
- Navigate to Settings β Connections
- Add your provider credentials (OpenAI, Anthropic, etc.)
- Test connection and start using models
Edit config/litellm/config.yaml:
model_list:
- model_name: gpt-4
litellm_params:
model: gpt-4
api_key: os.environ/OPENAI_API_KEY
- model_name: claude-3-sonnet
litellm_params:
model: claude-3-sonnet-20240229
api_key: os.environ/ANTHROPIC_API_KEYAdd keys to config/litellm/.env:
OPENAI_API_KEY=sk-your-key-here
ANTHROPIC_API_KEY=sk-ant-your-key-hereRestart services:
docker compose restart litellmThe stack exposes an OpenAI-compatible API:
# Example: Chat completion
curl -X POST http://localhost:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
-d '{
"model": "gpt-4",
"messages": [{"role": "user", "content": "Hello!"}]
}'# View logs
docker compose logs -f
# Stop services
docker compose stop
# Start services
docker compose start
# Restart services
docker compose restart
# Remove everything (including volumes)
docker compose down -vβββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client β
β (Browser / API Client) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β HTTPS (8443) / HTTP (8080)
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Nginx Reverse Proxy β
β (SSL Termination, Security) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββββ΄βββββββββββ
βΌ βΌ
ββββββββββββββββββββ ββββββββββββββββββββ
β Open WebUI β β LiteLLM Proxy β
β (Port 8080) β β (Port 4000) β
ββββββββββ¬ββββββββββ ββββββββββ¬ββββββββββ
β β
ββββββββββββ¬βββββββββββ
βΌ
ββββββββββββββββββββββ
β PostgreSQL DB β
β (Port 5432) β
ββββββββββββββββββββββ
- SSL Setup Guide - Detailed SSL/TLS configuration
- Configuration Reference - LiteLLM configuration options
- LiteLLM Docs - Official LiteLLM documentation
- Open WebUI Docs - Official Open WebUI documentation
Key environment variables (in docker-compose.yml):
| Variable | Description | Default |
|---|---|---|
LITELLM_MASTER_KEY |
Master API key for LiteLLM | sk-1z4bxV6OoK |
DATABASE_URL |
PostgreSQL connection string | Auto-configured |
POSTGRES_PASSWORD |
PostgreSQL password | bmFj5xF07m |
WEBUI_AUTH |
Enable Open WebUI authentication | true |
| Service | Internal Port | External Port | Protocol |
|---|---|---|---|
| Nginx (HTTPS) | 443 | 8443 | HTTPS |
| Nginx (HTTP) | 80 | 8080 | HTTP |
| LiteLLM API | 4000 | 4000 | HTTP |
| PostgreSQL | 5432 | - | Internal |
| Open WebUI | 8080 | - | Internal |
- Default SSL uses self-signed certificates
- Default passwords should be changed
- Suitable for local development and testing
- Replace self-signed certificates with valid SSL certificates (Let's Encrypt)
- Change all default passwords and API keys
- Configure firewall rules
- Enable additional security headers
- Set up regular backups
- Implement rate limiting
- Use Docker secrets for sensitive data
Services won't start
# Check Docker daemon is running
docker ps
# Check logs for errors
docker compose logs
# Ensure ports are not in use
netstat -tulpn | grep -E '8080|8443|4000'SSL certificate warnings
This is normal for self-signed certificates. See SSL Setup Guide for:
- How to accept the warning safely
- How to install the certificate in your browser
- How to use Let's Encrypt for production
Can't connect to models
- Verify API keys are correctly set in
config/litellm/.env - Check LiteLLM logs:
docker compose logs litellm - Test API key validity with the provider directly
- Ensure model names are correct in configuration
Database connection errors
# Wait for PostgreSQL to be ready
docker compose logs postgres
# Check health status
docker compose ps
# Restart database
docker compose restart postgresWe welcome contributions! Please see our Contributing Guidelines for details.
- π Report bugs
- π‘ Suggest new features
- π Improve documentation
- π§ Submit pull requests
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright Β© 2026 Krzysztof Siek
This project builds upon excellent open-source software:
- LiteLLM - Unified LLM proxy
- Open WebUI - Modern AI interface
- PostgreSQL - Reliable database
- Nginx - High-performance web server
- Docker - Containerization platform
- Documentation: Check the docs folder
- Issues: Open an issue on GitHub Issues
- Discussions: Join GitHub Discussions
If you find this project useful, please consider giving it a star! It helps others discover the project.
Made with β€οΈ by Krzysztof Siek