Get started
Use with LiteLLM
Put LiteLLM in front of any opod endpoint with one key and a few lines of config. LiteLLM keeps users, budgets and limits; opod keeps the GPUs.
LiteLLM works in front of any opod endpoint with no change to opod. Every endpoint already speaks the OpenAI API, so LiteLLM registers it as an ordinary openai/ model. You need one opod key and about ten lines of YAML.
What you get
- One OpenAI URL for every model. Your apps call LiteLLM. LiteLLM sends each model name to the opod endpoint that serves it.
- Per-user keys, budgets and limits in LiteLLM. Virtual keys, teams, requests and tokens per minute, budgets, model access per key. A spent budget is refused in LiteLLM, before any GPU work.
- GPUs, placement and scaling in opod. The control plane places each model on measured VRAM, scales its workers and rolls out changes. LiteLLM sees none of it.
- Guardrails, prompt logs and key control in LiteLLM. PII checks, prompt logs, refused-request logs, key pause and IdP groups to teams. See Guardrails, prompt logs and key control.
- Traces end to end. The caller's
traceparentgoes through LiteLLM into the opod leader, which continues the trace. - Cost joined with usage. LiteLLM counts tokens per team. opod counts GPU-hours per endpoint. One SQL join gives GPU-hours per team.
How it fits
opod has no per-user keys, budgets, rate limits or model allowlists: those are the gateway's job. LiteLLM holds them. Each opod endpoint holds one key, and only LiteLLM knows it. opod never reads LiteLLM, and LiteLLM reads nothing from opod but the endpoint URL. You can upgrade, move or remove either one without the other.
apps, agents ──► LiteLLM (yours) ──────► opod endpoint (leader) ──► workers (GPUs)
OpenAI SDK virtual keys, teams, one endpoint key, llama.cpp, vLLM,
sk-litellm-… budgets, rpm/tpm, admission, routing, SGLang, TensorRT-LLM
spend, prompt logs usage countsSteps
Have an endpoint that is serving
Use an endpoint you already have, or create one as in the Quickstart. This page uses an endpoint named
chat-smallin namespaceopodcpthat serves the modelqwen2.5-0.5b-gguf.Write down two values from the endpoint's page in the console (or
GET /api/v1/endpoints/<id>):Value Where Example URL the endpoint's urlfieldhttp://opodcp-ep-chat-small.opod.svc:8080Model id the endpoint's modelfieldqwen2.5-0.5b-ggufThe Service is always
opodcp-ep-<name>on port8080. With front doors on (plan.gateways), the endpoint'surlisopodcp-ep-<name>-front: it reaches every door, and the leader too unless leader isolation is on. Withendpoints.tls.embedded=true(off by default) the URL starts withhttps://; see the TLS note in step 3.Create one opod key for LiteLLM
export OPODCP_URL=https://cp.example.com # your control plane; default http://127.0.0.1:8080 export OPODCP_TOKEN=<operator or admin token> opodcp key create --endpoint chat-small --no-expiry litellmThe command prints
key k_… on chat-small, expires never (--no-expiry)on stderr and the key itself,sk-orc-<printed once>, on stdout. Copy it now: it is printed once. You can also mint it on the console's API keys page.Use --no-expiry, or plan a rotation
Without
--no-expiry(or--expires-in), a key expires after 90 days. LiteLLM then gets401 key_expiredon every request. The no-expiry choice is recorded on thekey.createdevent.Then turn on Require keys for the endpoint, on its Connect card or with the API. From then on, a caller without the key gets
401:curl -s -X PUT -H "Authorization: Bearer $OPODCP_TOKEN" -H 'Content-Type: application/json' \ https://cp.example.com/api/v1/endpoints/<id>/auth -d '{"requireKeys": true}'This is the only opod key LiteLLM holds. Your users get LiteLLM keys, never opod keys. See API keys.
Write litellm-config.yaml
# litellm-config.yaml model_list: - model_name: chat-small # the name your users ask for litellm_params: model: openai/qwen2.5-0.5b-gguf # openai/ + the endpoint's model id api_base: http://opodcp-ep-chat-small.opod.svc:8080/v1 # the endpoint URL + /v1 api_key: os.environ/OPOD_CHAT_SMALL_KEY # the key from step 2 stream_options: { include_usage: true } # count streamed tokens timeout: 120 # longer than opod's wake hold (see Troubleshooting) model_info: # Optional: a price per token, so LiteLLM's spend is in your money. input_cost_per_token: 0.0000001 output_cost_per_token: 0.0000004 general_settings: master_key: os.environ/LITELLM_MASTER_KEY # sk-litellm-… admin key; keep it for the API only database_url: os.environ/DATABASE_URL # LiteLLM's Postgres: its keys, teams and spend litellm_settings: forward_traceparent_to_llm_provider: true # one trace from the caller into opodThree things matter here:
openai/+ the exact model id. The leader serves one model. Any other name gets404./v1at the end ofapi_base. LiteLLM adds/chat/completionsto it.stream_options.include_usage. Without it, LiteLLM counts a streamed answer as zero tokens.
The Postgres is LiteLLM's state, not opod's. Virtual keys and budgets need it.
Endpoints with embedded TLS
With
endpoints.tls.embedded=true, usehttps://and a name in the endpoint's certificate. The certificate names only the leader's Service (opodcp-ep-<name>,opodcp-ep-<name>.<namespace>,….svc,….svc.cluster.local), neveropodcp-ep-<name>-front. So with TLS, callhttps://opodcp-ep-<name>.<namespace>.svc:8080/v1whether or not the endpoint has front doors; a call to-frontover TLS cannot verify the certificate. With front doors and leader isolation on, that means LiteLLM must be listed innetworkPolicy.leaderIsolation.from(step 5). Give LiteLLM that certificate as its trust store: it is itemtls.crtof the endpoint's auth Secret. Mount it and pointSSL_CERT_FILEandREQUESTS_CA_BUNDLEat it.Run LiteLLM
From a machine that can reach the endpoint URL:
docker run --rm -p 4000:4000 \ -v "$PWD/litellm-config.yaml:/app/config.yaml:ro" \ -e OPOD_CHAT_SMALL_KEY='sk-orc-<printed once>' \ -e LITELLM_MASTER_KEY='sk-litellm-master-change-me' \ -e DATABASE_URL='postgres://litellm:PASSWORD@192.0.2.20:5432/litellm' \ ghcr.io/berriai/litellm:main-stable --config /app/config.yaml --port 4000A
*.svcname resolves only inside the cluster. From outside, use the address your Gateway or Ingress publishes for the endpoint. See Network and TLS.Pin LiteLLM's image by digest in production, never a rolling tag. LiteLLM's package was compromised twice in 2026.
Make LiteLLM the only way in (if your cluster enforces NetworkPolicy)
Require keys (step 2) already stops a caller without the key. As defence in depth, admit only LiteLLM to port
8080of the endpoint. The policy must also admit the endpoint's own pods, the control plane and the API server: the control plane probes a leader through the API server's Service proxy, so without that rule every rollout fails its probe step and rolls back. Leave the probe port8081open (/healthz,/readyz,/loadz,/metrics, read-only).apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: { name: only-the-gateway, namespace: opodcp } spec: podSelector: { matchLabels: { opod.io/front: chat-small } } # the leader and its doors policyTypes: [Ingress] ingress: - from: [{ namespaceSelector: { matchLabels: { kubernetes.io/metadata.name: litellm } }, podSelector: { matchLabels: { app: litellm } } }] ports: [{ port: 8080 }] - from: [{ podSelector: { matchLabels: { opod.io/endpoint: chat-small } } }] # its workers and doors - from: [{ podSelector: { matchLabels: { app.kubernetes.io/name: opodcp } } }] # the control plane - from: [{ ipBlock: { cidr: 192.0.2.10/32 } }] # where the API server reaches pods from - ports: [{ port: 8081 }]Replace
192.0.2.10with the addresses the API server uses to reach pods: its node address, and on flannel also the two addresses its node's interfaces hold in the pod range.The chart's
networkPolicy.leaderIsolationis a different policy. It closes the leader's port, not the doors, and only on an endpoint with front doors (plan.gateways.enabled); an endpoint without doors gets a policy that stays open. So:- LiteLLM calling the endpoint's
url(opodcp-ep-<name>-front) reaches the doors, which that policy does not close. It needs no entry. - LiteLLM calling the leader's own Service (
opodcp-ep-<name>, as with embedded TLS) must be listed innetworkPolicy.leaderIsolation.from, or it is cut off.
Policies add up. With
networkPolicy.enabled=trueand leader isolation off, the chart's<release>-endpointspolicy admits every source on 8080, so the policy above then closes nothing. Turn on leader isolation, or keepnetworkPolicy.enabledoff and rely on the policy above alone. See Gateways in front and Network and TLS.An endpoint on the cell door is reachable through the door with any of its keys. Put LiteLLM in front of the door too, or keep a gated endpoint off it.
- LiteLLM calling the endpoint's
Create a LiteLLM key with a budget
Create a team with a budget and limits, then a key for one app of that team. These are LiteLLM's own API calls (LiteLLM docs):
LITELLM=http://litellm.litellm.svc:4000 # or http://127.0.0.1:4000 for the Docker try M="Authorization: Bearer sk-litellm-master-change-me" curl -s $LITELLM/team/new -H "$M" -H 'Content-Type: application/json' \ -d '{"team_alias":"search","max_budget":50,"budget_duration":"30d","tpm_limit":20000,"rpm_limit":60,"models":["chat-small"]}' curl -s $LITELLM/key/generate -H "$M" -H 'Content-Type: application/json' \ -d '{"team_id":"<team id from the answer above>","key_alias":"search-prod","max_budget":10,"budget_duration":"1d"}'The second answer carries
"key": "sk-litellm-…". Give that key to the app.Call it with the OpenAI SDK
The app talks to LiteLLM as if it were OpenAI. It never sees opod's URL or key.
from openai import OpenAI client = OpenAI(base_url="http://litellm.litellm.svc:4000/v1", api_key="sk-litellm-…") r = client.chat.completions.create( model="chat-small", # the LiteLLM model_name, not the opod model id messages=[{"role": "user", "content": "Say hello in five words."}], user="alice@example.com", # the end user, for LiteLLM's per-user spend ) print(r.choices[0].message.content, r.usage)Pass the end user in OpenAI's
userfield. opod's usage row records only which endpoint key called, and with LiteLLM in front that is always the one LiteLLM key.
Check it worked
Run these four requests. Each one proves one link.
1. opod answers with its key. From a pod that the NetworkPolicy admits (or before you apply it):
curl -s http://opodcp-ep-chat-small.opod.svc:8080/v1/chat/completions \
-H 'Authorization: Bearer sk-orc-<printed once>' -H 'Content-Type: application/json' \
-d '{"model":"qwen2.5-0.5b-gguf","messages":[{"role":"user","content":"hi"}]}'Good: 200 with choices[0].message.content and a usage block.
2. opod refuses a caller without the key. The same request with no Authorization header.
Good: 401 with "error": {"type": "missing_api_key", …}. If you get 200, Require keys is off. With the NetworkPolicy on, a pod outside LiteLLM's namespace gets no answer at all: the connection times out.
3. LiteLLM lists the model.
curl -s $LITELLM/v1/models -H 'Authorization: Bearer sk-litellm-…'Good: data[].id holds chat-small, the model_name from your config.
4. A chat through LiteLLM works, streamed and counted.
curl -sN $LITELLM/v1/chat/completions -H 'Authorization: Bearer sk-litellm-…' -H 'Content-Type: application/json' \
-d '{"model":"chat-small","stream":true,"messages":[{"role":"user","content":"count to five"}]}'Good: data: chunks, then one chunk with a usage block, then data: [DONE]. The key's spend in LiteLLM grows (GET $LITELLM/key/info?key=sk-litellm-…). The endpoint's request count in the opod console grows by one.
Several endpoints and models
One opod endpoint serves one model. Register one LiteLLM model group per endpoint, each with its own opod key:
model_list:
- model_name: chat-small
litellm_params:
model: openai/qwen2.5-0.5b-gguf
api_base: http://opodcp-ep-chat-small.opod.svc:8080/v1
api_key: os.environ/OPOD_CHAT_SMALL_KEY
stream_options: { include_usage: true }
- model_name: chat-large
litellm_params:
model: openai/<chat-large's model id>
api_base: http://opodcp-ep-chat-large.opod.svc:8080/v1
api_key: os.environ/OPOD_CHAT_LARGE_KEY
stream_options: { include_usage: true }
router_settings:
fallbacks: [{ "chat-large": ["chat-small"] }] # if chat-large fails, LiteLLM tries chat-small
num_retries: 2- Scale is opod's. To serve more traffic for one model, add workers or gangs to its endpoint, or let its autoscaler do it. Do not list two copies of one endpoint in LiteLLM: the leader already balances across its workers by load.
- Fallbacks are LiteLLM's. A fallback to another endpoint is a different model, so the answer can differ. Inside opod, an endpoint's policy can name a
fallbackUrlthat the leader forwards to when it has no serving capacity; see Routing. - LoRA adapters of one endpoint are
<model>:<adapter>, for examplemodel: openai/qwen2.5-0.5b-gguf:support, with the sameapi_baseand key. The leader refuses an adapter the plan does not name. - Streaming works as with OpenAI. Keep
stream_options.include_usageon every entry. A stream that crosses its budget in LiteLLM finishes; LiteLLM refuses the next request. - A retry is a new request. LiteLLM's retries reach opod as new requests and are counted as such.
Guardrails, prompt logs and key control
These are LiteLLM settings, not opod ones. They were read from LiteLLM's docs on 2026-10-31. Check them against the LiteLLM version you pin.
PII and injection checks. Run Microsoft Presidio's Analyzer and Anonymizer containers, set PRESIDIO_ANALYZER_API_BASE and PRESIDIO_ANONYMIZER_API_BASE in LiteLLM's environment, and add a guardrail. With default_on: true it runs on every request, so a client cannot skip it:
guardrails:
- guardrail_name: presidio-pii
litellm_params:
guardrail: presidio
mode: pre_call # before the request reaches opod
default_on: true
pii_entities_config:
EMAIL_ADDRESS: MASK # MASK replaces it; BLOCK refuses the request
CREDIT_CARD: BLOCKA blocked request gets LiteLLM's 400 "Violated guardrail policy" and never reaches the endpoint, so it costs no GPU time. Guardrails per key, per model or by tag are LiteLLM enterprise features.
Prompt and answer logs. opod never logs request content. LiteLLM's callbacks send it to your own store, for example Langfuse (set LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY and LANGFUSE_HOST):
litellm_settings:
success_callback: ["langfuse"]
# turn_off_message_logging: true # keep spend and metadata, drop prompts and answersRefused requests. LiteLLM writes each request, refused ones included, to LiteLLM_SpendLogs. Read the failures with its paginated log API. status_filter and error_code filter it, and your proxy's /docs page lists their values:
curl -s "$LITELLM/spend/logs/v2?start_date=2026-10-31&end_date=2026-11-01&status_filter=failure&page_size=100" -H "$M"Requests that opod sheds under load are counted on the leader's /metrics as opod_admission_shed_total, not in LiteLLM.
Pause a key without revoking it. Block it, then unblock it later. Its budget and spend stay:
curl -s -X POST $LITELLM/key/block -H "$M" -H 'Content-Type: application/json' -d '{"key":"sk-litellm-…"}'
curl -s -X POST $LITELLM/key/unblock -H "$M" -H 'Content-Type: application/json' -d '{"key":"sk-litellm-…"}'IdP groups to teams. With SSO on LiteLLM's admin UI, name the claim that carries the user's groups. On each login the user joins every LiteLLM team whose team_id equals one of the groups. LiteLLM does not create teams from the claim: create each one first with /team/new, with team_id set to the group's value.
general_settings:
litellm_jwtauth:
team_ids_jwt_field: groupsLiteLLM's SSO is free for up to 5 users. Past that, and for SCIM, it needs LiteLLM's enterprise licence. The opod console's own SSO maps OIDC groups to opod roles (OPODCP_OIDC_ROLE_CLAIM, default groups) and does not reach LiteLLM.
Traces and cost
Traces. Turn on LiteLLM's OpenTelemetry callback and send its spans to the same collector as opod's:
litellm_settings:
callbacks: ["otel"]
forward_traceparent_to_llm_provider: trueSet OTEL_EXPORTER=otlp_http and OTEL_ENDPOINT=<your collector>/v1/traces in LiteLLM's environment. LiteLLM then passes the caller's traceparent header to the endpoint, and the leader continues that trace. In 0.3.0 the leader also passes it to the worker and into the engine, so one trace runs caller → LiteLLM → leader → engine. LiteLLM does not start a trace header of its own for the backend: a caller that sends no traceparent gets two traces, LiteLLM's and opod's. See Observability.
Cost per team. opod knows how long each endpoint held its GPUs, busy and idle. LiteLLM knows which team sent which tokens (table LiteLLM_DailyTeamSpend). Split each endpoint's busy GPU-hours across teams by their token share that day, in your own BI tool, with your own price. The join key is your model_list: model_name → the endpoint in api_base. The SQL is on Usage → Cost per team.
The GPU-hours export (GET /api/v1/usage/gpu-daily, JSON or CSV) is new in 0.3.0. Use the same export to reconcile: on a day where LiteLLM saw fewer tokens for an endpoint than opod served, traffic went around LiteLLM or a row was lost.
Troubleshooting
| What you see | Cause | Fix |
|---|---|---|
401 missing_api_key from opod | LiteLLM sent no key: api_key is empty or its env variable is not set | Set OPOD_CHAT_SMALL_KEY in LiteLLM's environment and restart it |
401 invalid_api_key "Invalid or revoked API key" | Wrong key, a key of another endpoint, or a revoked key | Mint a new key for this endpoint (step 2). A revocation reaches the leader within about a minute |
401 key_expired | The key was minted without --no-expiry and its 90 days passed | Mint a new key with --no-expiry, update LiteLLM's Secret, then revoke the old one |
404 "this endpoint serves only X (requested Y)" | model: after openai/ is not the endpoint's model id | Copy the model field of the endpoint exactly |
404 with no model message | api_base is missing /v1, so LiteLLM calls the wrong path | End api_base with /v1 |
| Name not found (DNS error) | Wrong Service name or namespace, or LiteLLM runs outside the cluster | Use opodcp-ep-<name>.<namespace>.svc; from outside, use your Gateway or Ingress address |
| Connection timeout | A NetworkPolicy drops LiteLLM's traffic | Check that the policy's namespaceSelector and podSelector match LiteLLM's namespace and pod labels |
| Rollouts fail at the probe step after you add a policy | The policy does not admit the API server | Add the API server's addresses (step 5) |
| TLS or certificate error | Embedded TLS is on and LiteLLM does not trust the endpoint's certificate, or it calls -front, which the certificate does not name | Use https://opodcp-ep-<name>.<namespace>.svc:8080/v1 and mount tls.crt as SSL_CERT_FILE (step 3) |
503 "no workers are awake for this model — waking …" with Retry-After: 10 | The endpoint is scaled to zero, or its workers are starting | In 0.2.1, retry (num_retries in LiteLLM). In 0.3.0 a floor: 0 plan holds the request for at least 60 s, so give LiteLLM a timeout above that |
503 with Retry-After while the endpoint is busy | Every worker slot is taken and the admission hold ran out | Raise admission.holdMs, add workers, or let the autoscaler grow. See Routing → Admission |
503 with Retry-After: 30 on an endpoint that requires keys | The leader's key list is older than the age bound you set | Check the control plane is up and the doctor row auth-snapshots. See API keys |
| A stream stops in the middle when the endpoint scales in | In 0.2.1 a stopping worker stops at once | In 0.3.0, autoscale.scaleIn: drain (the default) lets a worker finish its requests, up to drainSeconds (120). See Autoscaling |
LiteLLM refuses with budget_exceeded | The key or team spent its budget. LiteLLM refuses it before opod sees it | Raise the budget in LiteLLM or wait for budget_duration to reset it |
| Streamed answers show 0 tokens in LiteLLM | stream_options.include_usage is not set | Add it to every litellm_params |
Rules that keep it correct
- Turn off LiteLLM's shared-secret login. Out of the box its admin UI accepts
adminand the master key. Create a real admin user, then setgeneral_settings.disable_env_credential_login: true. - Choose what happens when LiteLLM's database is down: serve without budgets, or refuse. That choice is in LiteLLM's settings, not opod's.
- Bound the overshoot. Requests already running when a budget runs out are still answered. A
max_tokenscap per key or model limits how far that goes. - Know the licence. LiteLLM's proxy is MIT: virtual keys, teams, budgets, rate limits and spend tracking are free. Some features, such as SSO for its admin UI past 5 users, need LiteLLM's enterprise licence. Check LiteLLM's current list.
Related pages
Last updated · Source: content/docs/get-started/litellm.mdx · View as Markdown