Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR

LiteLLM Proxy Setup: Manage OpenAI, Gemini, Claude and Ollama APIs

Deploy LiteLLM Proxy with PostgreSQL and Redis, unify providers behind one OpenAI-compatible API, and configure virtual keys, budgets, rate limits, TLS and log privacy.

LiteLLM Proxy Setup: Manage OpenAI, Gemini, Claude and Ollama APIs
What will be running at the end?

Deploy LiteLLM Proxy with PostgreSQL and Redis, unify providers behind one OpenAI-compatible API, and configure virtual keys, budgets, rate limits, TLS and log privacy. Every command is presented as an operational step; replace example hostnames, passwords and secrets before execution.

Architecture and requirements before installation

  • Ubuntu 24.04 LTS with sudo access and a dedicated IPv4 address
  • Docker Engine and Compose v2 where the deployment uses containers
  • A DNS A record pointing the application hostname to the server
  • NVMe capacity sized for application data, logs, temporary files and backups
  • Memory and CPU headroom based on measured concurrency rather than vendor minimums

DNS and port plan

  • 443/TCP: istemci API erişimi
  • 4000/TCP: yalnız reverse proxy arkasında LiteLLM
  • 5432/TCP: PostgreSQL iç ağ
  • 6379/TCP: Redis iç ağ

Hands-on installation steps

1. Sırlar
openssl rand -hex 32
openssl rand -base64 48
2. Ortam dosyası
LITELLM_MASTER_KEY=sk-YONETICI_ICIN_GUCLU_ANAHTAR
LITELLM_SALT_KEY=DEGISTIRILMEMESI_GEREKEN_RASTGELE_DEGER
POSTGRES_PASSWORD=GUCLU_DB_PAROLASI
DATABASE_URL=postgresql://litellm:GUCLU_DB_PAROLASI@postgres:5432/litellm
REDIS_HOST=redis
OPENAI_API_KEY=sk-...
GEMINI_API_KEY=...
ANTHROPIC_API_KEY=...
3. Model yapılandırması
model_list:
  - model_name: gpt-4o-mini
    litellm_params:
      model: openai/gpt-4o-mini
      api_key: os.environ/OPENAI_API_KEY
  - model_name: gemini-flash
    litellm_params:
      model: gemini/gemini-2.5-flash
      api_key: os.environ/GEMINI_API_KEY
  - model_name: claude-sonnet
    litellm_params:
      model: anthropic/claude-sonnet-4-5
      api_key: os.environ/ANTHROPIC_API_KEY
  - model_name: yerel-qwen
    litellm_params:
      model: ollama/qwen3:8b
      api_base: http://ollama:11434
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
  database_url: os.environ/DATABASE_URL
4. Compose yapısı
services:
  postgres:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_USER: litellm
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: litellm
    volumes:
      - postgres_veri:/var/lib/postgresql/data
  redis:
    image: redis:7-alpine
    restart: unless-stopped
    volumes:
      - redis_veri:/data
  litellm:
    image: ghcr.io/berriai/litellm-database:main-stable
    restart: unless-stopped
    env_file: .env
    command: ["--config", "/app/config.yaml", "--port", "4000"]
    ports:
      - 127.0.0.1:4000:4000
    volumes:
      - ./config.yaml:/app/config.yaml:ro
    depends_on:
      - postgres
      - redis
volumes:
  postgres_veri:
  redis_veri:
5. API doğrulama
curl -sS http://127.0.0.1:4000/health/liveliness
curl -sS http://127.0.0.1:4000/v1/models -H "Authorization: Bearer sk-YONETICI_ICIN_GUCLU_ANAHTAR"
6. Sohbet testi
curl https://llm.example.com/v1/chat/completions \
  -H "Authorization: Bearer sk-SANAL_ANAHTAR" \
  -H "Content-Type: application/json" \
  -d '{"model":"yerel-qwen","messages":[{"role":"user","content":"Merhaba"}]}'
7. Veritabanı yedeği
sudo docker compose exec -T postgres pg_dump -U litellm -d litellm -Fc > litellm-$(date +%F).dump
sha256sum litellm-$(date +%F).dump
8. Nginx reverse proxy
sudo apt update
sudo apt install -y nginx certbot python3-certbot-nginx
sudo tee /etc/nginx/sites-available/llm.example.com > /dev/null <<'NGINX'
server {
    listen 80;
    listen [::]:80;
    server_name llm.example.com;
    client_max_body_size 10G;
    proxy_read_timeout 3600;
    proxy_send_timeout 3600;
    location / {
        proxy_pass http://127.0.0.1:4000;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
NGINX
sudo ln -s /etc/nginx/sites-available/llm.example.com /etc/nginx/sites-enabled/llm.example.com
sudo nginx -t
sudo systemctl reload nginx
9. Let’s Encrypt SSL ve yenileme testi
sudo certbot --nginx -d llm.example.com --redirect --agree-tos --no-eff-email -m [email protected]
sudo certbot renew --dry-run
curl -I https://llm.example.com
openssl s_client -connect llm.example.com:443 -servername llm.example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates

What to know before production

Production note
LiteLLM Proxy Setup must be isolated behind HTTPS; databases, queues and internal APIs must not be published directly to the internet.
Production note
Pin tested image versions before production. Read release notes and take an application-consistent backup before database migrations.
Production note
A database dump alone may be incomplete. Preserve persistent files, configuration, encryption keys and the exact deployed version together.
Production note
Validate the installation with a real transaction or workload, then reboot the host and confirm automatic recovery before accepting production traffic.

Common failures and root causes

Belirti / SymptomKök neden ve çözüm / Root cause and fix
Service or container does not startInspect compose configuration, dependency health, file permissions and the first fatal log line instead of repeatedly restarting.
Domain opens but HTTPS failsCheck A/AAAA records, ports 80/443, proxy mode, certificate challenge and conflicting reverse proxies.
Application cannot reach its database or queueUse the internal service hostname, verify credentials and health checks, and keep database ports off the public interface.
Works initially but fails under loadMeasure memory peaks, disk latency, connection pools and worker concurrency; increase capacity only after identifying the bottleneck.

Post-installation validation checklist

  • All services are running and their health checks pass
  • The public hostname serves a valid HTTPS certificate
  • Only explicitly required ports are reachable
  • Administrator MFA and recovery access are configured
  • Backup checksums have been recorded
  • A restore was completed in an isolated environment
  • Logs contain no repeating critical failure
  • Services recover automatically after a host reboot

Official technical sources

Related EKA Sunucu guides

Frequently asked questions

Is this suitable for production?

Yes after secrets are replaced, public access is restricted and a complete restore test has succeeded.

Are minimum resources enough?

Minimums only prove the software can start. Size CPU, memory, IOPS and storage from representative workload measurements.

Can I use Cloudflare?

Yes. Use Full (strict) TLS and configure origin certificates, WebSockets and client IP forwarding where required.

Should upgrades be automatic?

Do not automatically apply major releases. Review migrations, back up data and retain the previous tested image.

What must be backed up?

Back up databases, uploaded files, persistent volumes, configuration, encryption keys and the deployed version together.

VPS or GPU server?

An NVMe VPS fits normal web workloads. Inference, accelerated OCR and video transcoding may require a compatible GPU.

Contact us for deployment

Deploy LiteLLM Proxy with PostgreSQL and Redis, unify providers behind one OpenAI-compatible API, and configure virtual keys, budgets, rate limits, TLS and log privacy.

Explore GPU serversContact us for deployment
Top