If you run more than one app — or one agent that fans out to several models — you eventually hit the same wall: every provider has its own SDK, its own keys, its own rate limits, and no single place to see spend. LiteLLM fixes that by putting one OpenAI-compatible endpoint in front of everything. Your code calls one URL with a model name; LiteLLM routes it to OpenAI, Anthropic, Groq, Together, Mistral, a local Ollama — whatever you configured — and gives you budgets, fallbacks, and one log of every call.
Self-hosting it on a VPS means your provider keys, your prompts and your spend data live on a box you control, paid for in crypto with no KYC.
What a LiteLLM proxy needs
- Not much compute — it's a gateway. The heavy lifting happens at the providers; LiteLLM just routes. Small ($8/mo — 4 vCPU, 4 GB RAM) comfortably runs the proxy plus a Postgres for virtual keys and spend tracking.
- A dedicated IP, a domain and HTTPS. Your apps and agents connect inbound, so you want a dedicated-IPv4 plan, a domain and TLS. NAT plans don't take inbound web traffic.
- Outbound to the providers. The box needs normal outbound HTTPS to reach the model APIs — every plan has that.
Docker setup (Ubuntu 24.04)
# dedicated-IP plan, root shell
apt update && apt install -y docker.io docker-compose-v2
systemctl enable --now docker
mkdir -p /opt/litellm && cd /opt/litellm
cat > config.yaml <<'EOF'
model_list:
- model_name: gpt-4o
litellm_params:
model: openai/gpt-4o
api_key: os.environ/OPENAI_API_KEY
- model_name: claude
litellm_params:
model: anthropic/claude-sonnet-4-5
api_key: os.environ/ANTHROPIC_API_KEY
- model_name: local-llama
litellm_params:
model: ollama/llama3.1
api_base: http://host.docker.internal:11434
general_settings:
master_key: sk-CHANGE-ME # admin key; issue per-app virtual keys instead
EOF
cat > docker-compose.yml <<'EOF'
services:
litellm:
image: ghcr.io/berriai/litellm:main-latest
restart: always
ports: [ "127.0.0.1:4000:4000" ]
environment:
OPENAI_API_KEY: sk-... # your provider keys
ANTHROPIC_API_KEY: sk-ant-...
DATABASE_URL: postgresql://litellm:change_me@postgres:5432/litellm
volumes: [ ./config.yaml:/app/config.yaml ]
command: [ "--config", "/app/config.yaml" ]
postgres:
image: postgres:16
restart: always
environment:
POSTGRES_USER: litellm
POSTGRES_PASSWORD: change_me
POSTGRES_DB: litellm
volumes: [ ./pgdata:/var/lib/postgresql/data ]
EOF
docker compose up -d
Put Caddy or Nginx in front for automatic HTTPS on your domain, then any OpenAI SDK just works:
curl https://llm.yourdomain.com/v1/chat/completions \
-H "Authorization: Bearer sk-your-virtual-key" \
-H "Content-Type: application/json" \
-d '{"model":"claude","messages":[{"role":"user","content":"ping"}]}'
Why this is great for agents
An AI agent or a multi-agent fleet usually makes a lot of model calls. Behind a LiteLLM proxy you can: cap each agent with its own virtual key and budget, fall back from a frontier model to a cheaper one automatically, mix a local Ollama with cloud APIs, and read one log of exactly what every agent spent. Swap models without touching agent code — just change the config.
Why EQVPS for a LiteLLM gateway
- Dedicated IPv4 from $8/mo, domain + HTTPS friendly, all ports, self-service rDNS.
- EU locations (Germany, Finland) — clean routes, real data-protection law; your keys and logs stay in the EU.
- No KYC, crypto payment. Email to sign up, USDC/USDT to pay.
- Root in ~60 seconds. Clean Ubuntu/Debian images;
docker compose upand your gateway is live.
Comments
No comments yet. Be the first.