OneLinersCommand workbench
Guides
AI/ML / Cloud & Infrastructure / Security / Observability & Monitoring

Deploy a production LiteLLM multi-provider gateway

Pin LiteLLM v1.93.0, publish stable provider aliases behind TLS and scoped virtual keys, enforce budgets and shared limits, constrain fallbacks by privacy policy, prove redaction, and rehearse recovery and rollback.

480 min16 stepsChanges system stateRevision 1
Save or explore
Save to collectionCreate a collection in the sidebar first.
0 of 16 steps completed
Goal

Operate one auditable LLM gateway that improves access and resilience without turning provider abstraction into an authentication, privacy, cost, or availability surprise.

Supported environments
  • LiteLLM Proxy v1.93.0 exact stable release
  • PostgreSQL supported managed or self-hosted release
  • OCI container runtime digest-pinned image with cosign verification
Prerequisites
  • Provider approval matrix Security, privacy, legal and product owners have approved exact provider accounts, regions, model snapshots, retention settings, data classes, prices and substitution rules.
  • Private runtime and state A private container platform, PostgreSQL, optional shared limiter state, secret manager, TLS ingress and restricted outbound network are available.
  • Workload identity and ownership Each caller can be mapped to a workload/team, environment, cost owner, allowed aliases, expiry, budget and incident contact.
  • Release and recovery controls Operators can verify images, run one controlled migration, store encrypted backups, restore into isolation, canary traffic and roll back coupled state.
Operating boundary

OneLiners never runs these steps or stores secrets. Review placeholders, versions, current state, and change-control requirements before using a command.

Full guide

What you will build

System
  • An immutable LiteLLM v1.93.0 gateway release whose container signature, digest, database schema and configuration revision can be reproduced.
  • Stable provider-neutral aliases backed only by deployments that share approved privacy, residency, feature, quality and cost properties.
  • Fail-closed virtual-key authentication, tenant/project ownership, hard budgets, multi-dimensional limits and bounded routing attempts.
  • A private control plane with TLS edge isolation, least-privilege PostgreSQL, coordinated shared state and secret-manager references.
  • Privacy-safe audit, SLO, security and cost observability proven with canary markers rather than inspection of customer prompts.
  • A tested provider-outage policy, encrypted backup, isolated restore, staged upgrade and complete rollback path.
Observable outcome
  • Applications call stable aliases without receiving unrestricted access to provider accounts or the LiteLLM master key.
  • A provider outage never silently moves restricted content into an unapproved region, account, retention policy or lower-quality model.
  • Rate and spend limits hold across replicas and concurrency, with daily reconciliation against provider usage.
  • Operators can explain authentication, routing, latency, retry, fallback, token and cost decisions by opaque request ID without reading content.
  • The team can recover or roll back the gateway within measured objectives while preserving revoked credentials, budget state and audit continuity.

Architecture

How the parts fit together

Clients authenticate at a TLS edge and present scoped LiteLLM virtual keys. The private LiteLLM replicas resolve a stable alias to a policy-compatible provider deployment, consult PostgreSQL for durable control-plane state and shared limiter state where required, then emit metadata-only telemetry. Provider secrets are fetched by workload identity or secret reference and never returned to clients. Administrative APIs are separated from inference traffic.

TLS edgePublishes a minimal inference route set, validates transport identity, bounds bodies and deadlines, and keeps administrative surfaces private.
LiteLLM v1.93.0 replicasAuthenticate virtual keys, enforce model policy, budgets and limits, normalize requests, route bounded attempts and emit redacted operational metadata.
PostgreSQL control planeStores durable key, team, budget, spend, audit and migration state under least-privilege application access and tested backups.
Shared limiter/cache stateCoordinates replica counters and optional cache behavior under an explicit degraded-mode policy; it never becomes an authentication bypass.
Secret manager and provider accountsSupply environment-scoped credentials or workload identity and provider-side financial/data controls without embedding secrets in configuration.
Observability and evidence storeRetain bounded metadata, release manifests, test results, alerts and audit events without raw model content or secret values.
  1. A workload obtains a short-lived or rotating virtual key bound to team, environment, aliases, concurrency and budget.
  2. The TLS edge accepts an allowlisted inference route, rejects oversized/unknown routes and assigns an opaque request ID.
  3. LiteLLM authenticates the key, resolves trusted metadata, checks alias permission, hard budget, tokens, concurrency and deadline.
  4. The router chooses only a policy-compatible deployment and makes no more provider attempts than the explicit budget.
  5. A successful or failed response returns with stable error semantics while redacted metadata updates accounting, metrics and audit evidence.
  6. Daily reconciliation, canary privacy tests, provider-failure fixtures, backups and restore drills verify the system beyond liveness.

Assumptions

  • The deployment targets LiteLLM OSS v1.93.0, the latest stable non-prerelease observed from the official upstream releases on 2026-07-28; later releases require a new review and migration rehearsal.
  • The organization controls DNS/TLS, a private runtime, PostgreSQL, a secret manager, provider projects/accounts and a metrics/audit destination.
  • Provider data processing, residency, abuse monitoring, retention and model behavior have been reviewed outside this technical guide for every deployment.
  • Callers can authenticate as workloads and supply a trusted tenant/project and data-class context; end-user authorization remains the application responsibility.
  • The gateway does not execute model-generated actions and does not make generated answers correct. Applications independently validate consequential output and tools.
  • Examples use synthetic data and placeholder provider model snapshots. Operators replace them only with exact entries from their approved model registry.

Key concepts

Virtual key
A LiteLLM-issued client credential mapped to models, team/project, expiry, budget and rate policy so provider keys remain hidden and access is revocable.
Master key
Highly privileged gateway secret used for control-plane administration. It belongs in a secret manager and must not be distributed to inference clients.
Public alias
Stable application-facing model name whose backing deployments can change only within a reviewed compatibility and policy envelope.
Routing group
Set of deployments eligible for load balancing or failover because privacy, residency, capability, quality and cost behavior have been accepted as substitutes.
Attempt budget
Maximum total primary, retry and fallback provider calls allowed for one client request inside its absolute deadline.
Hard budget
Blocking financial boundary enforced by the gateway, distinct from an informational dashboard or alert.
Behavior pinning
Deterministic comparison of authentication, routing, limits, accounting, privacy and API outcomes between gateway revisions.
Coupled release
One versioned set of application image, database schema, configuration, provider registry, pricing, policies, alerts and acceptance fixtures.

Security and production boundaries

  • Keep the gateway listener and all state services on private networks. Expose only allowlisted inference routes through the TLS edge; administrative UI and key APIs require separate identity-aware access.
  • Use dedicated provider projects, least-privilege workload identity where supported, and environment-specific credentials. A provider credential leak is not contained by a LiteLLM virtual key.
  • Never log prompt, response, embedding, file, authorization header, cookie or raw provider error by default. Test success, stream, retry, fallback and failure telemetry with synthetic canary values.
  • Do not claim cross-provider equivalence from API compatibility. Evaluate quality, tool behavior, structured output, context, tokenization, safety, price, retention and residency per deployment.
  • Return unavailability when no approved fallback exists. Availability objectives cannot authorize a hidden change of jurisdiction, provider contract, data use or model behavior.
  • Keep hard authorization, budget and data-class decisions fail-closed during database or shared-state failure. Document conservative degraded modes for non-security features.
  • Separate migration authority from runtime. Apply reviewed schema changes once, after a verified backup and isolated rehearsal, and retain the full baseline until the canary window closes.
  • LiteLLM centralizes access but does not validate generated content or tool intent. Consequential downstream actions require application authorization, schema/domain checks and human approval appropriate to risk.

Stop before continuing if

  • Do not launch when a moving container or provider model tag remains, signature/digest evidence is missing, or the database migration has not passed an isolated restore rehearsal.
  • Do not launch when any published route accepts missing/expired/revoked credentials or a workload key can access administrative APIs.
  • Do not launch when a fallback can cross provider, region, retention, data class or quality policy without explicit caller-visible approval.
  • Do not launch when hard budgets and aggregate limits have not been tested under concurrency across multiple replicas.
  • Do not launch when synthetic content or secret canaries appear in any application, edge, trace, metric, callback, SIEM or provider-support sink.
  • Do not launch when revoked credentials, budget state, configuration or audit history cannot be restored within the stated recovery objective.
01

instruction

Write the gateway service, data, and failure contract

read-only

Start with an inventory of callers, tenants, provider accounts, data classifications, residency constraints, approved model snapshots, latency objectives, cost owners, expected concurrency, and outage behavior. For every public alias, record which provider deployments are equivalent enough to route together and which differences must produce a hard failure. Define the gateway boundary: it authenticates and authorizes model access, applies budgets and rate limits, records privacy-safe audit metadata, and routes requests, but it does not make application authorization decisions or certify model answers as correct.

Why this step matters

A multi-provider gateway can improve availability and negotiating leverage, but it also centralizes credentials and can silently move sensitive prompts across organizations or jurisdictions. A written contract turns those trade-offs into enforceable configuration and tests.

What to understand

Define a stable public alias such as `support-fast` independently from provider marketing names. Record the exact upstream deployment, region, account, model revision, context limit, feature support, retention settings and approval evidence behind it.

Classify input and output separately. A public prompt can still produce restricted output after retrieval or tool use, so the caller must pass an authenticated data-class claim that the gateway verifies against the key policy.

Specify fail-open versus fail-closed for database, Redis, telemetry and provider failures. Authentication, tenancy, data classification and hard budgets should never become permissive because a dependency is unavailable.

Budget both currency and capacity: requests per minute, tokens per minute, concurrent streams, maximum request size, maximum generation, provider attempt count and end-to-end deadline.

System changes

  • Creates the reviewed service contract and provider approval matrix; it does not yet expose a listener or create provider traffic.

Syntax explained

public alias
A product-facing model name whose allowed deployments and policy remain controlled by the platform team.
restricted data
Content permitted only on explicitly approved providers, regions, retention settings and logging paths.
fail-closed
Rejects a request when an authorization, budget or residency decision cannot be made safely.
Command
node ops/gateway-contract.mjs validate --file ops/litellm/service-contract.yaml --require-data-classes --require-residency --require-cost-owner --require-failure-mode
Example output / evidence
aliases: 6
provider deployments: 11
data classes: public, internal, restricted
aliases without approved fallback: 2 (explicit fail-closed)
unknown owners: 0
result: PASS

Checkpoint: Checkpoint: Write the gateway service, data, and failure contract

Continue whenEvery alias has owners, compatible deployments, data classes, limits, cost attribution, fallback disposition, observable success and an explicit unavailable response.

Stop whenA provider's retention/residency terms are unknown, callers cannot be assigned tenant identity, or stakeholders expect arbitrary provider substitution during an outage.

If this step fails

A primary provider outage causes requests to cross an unapproved privacy boundary.

Likely causeFallbacks are grouped only by capability or price and do not encode region, retention, contractual terms, data class, or customer consent.

Safe checks
  • Inspect the fallback chain for the affected alias and request data class.
  • Replay a synthetic outage while recording the chosen provider, model, region and policy reason.
  • Compare every candidate with the provider approval matrix.

ResolutionDisable the unsafe fallback and return a clear service-unavailable response. Create separate policy-compatible routing groups and never trade privacy or jurisdiction for availability silently.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
02

verification

Pin LiteLLM v1.93.0 by immutable digest and verify its signature

read-only

Use the latest stable upstream release observed on 2026-07-28—v1.93.0—not a development, release-candidate, `latest`, or `main-latest` image. Resolve the official container tag to an immutable digest in a controlled build environment, verify the cosign signature with the upstream key pinned to an immutable repository commit, scan the artifact under your policy, and record the digest, signature identity, SBOM or scan reference, release URL and database migration notes in the release manifest. Deployment specifications must use the digest.

Why this step matters

A named release is auditable, but only the digest fixes the bytes that run. Signature verification reduces registry-substitution risk, while a separate vulnerability and policy review addresses what the signed upstream actually contains.

What to understand

Record both version and digest. Humans need the version to understand release notes; the runtime needs the digest to prevent a mutable registry reference from changing beneath an approved deployment.

Treat signature verification, malware/vulnerability scanning and behavioral acceptance as separate gates. A valid signature proves provenance from the stated key, not security or correctness.

Mirror the accepted image into an internal registry if required, preserving the original digest and attestation evidence. Do not rebuild it under the same version label without a distinct internal revision.

Pin helper images and migration tooling too. An immutable LiteLLM image does not make a deployment reproducible if `postgres:latest`, an unpinned reverse proxy or a changing initialization script remains.

System changes

  • Creates an immutable release manifest and approved image reference; no database migration or production restart occurs.

Syntax explained

v1.93.0
Latest non-prerelease LiteLLM release verified through the upstream GitHub releases API on 2026-07-28.
immutable digest
Content-addressed image identity used by the production deployment.
pinned cosign key commit
Fetches the upstream public key from an immutable Git revision rather than a moving branch.
Command
cosign verify --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub docker.litellm.ai/berriai/litellm:v1.93.0
Example output / evidence
Verification for docker.litellm.ai/berriai/litellm:v1.93.0 --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key

Checkpoint: Checkpoint: Pin LiteLLM v1.93.0 by immutable digest and verify its signature

Continue whenThe release manifest resolves v1.93.0 to one digest, signature verification passes, policy scans are reviewed, and every deployment reference uses that digest.

Stop whenThe signature is invalid, the digest differs from the reviewed artifact, a blocking vulnerability is unresolved, or migration/rollback requirements are not understood.

If this step fails

The container starts with a different LiteLLM version after a routine restart.

Likely causeThe deployment used a moving tag such as `main-latest`, the registry tag was retargeted, or the image digest was not recorded in the release manifest.

Safe checks
  • Read the running image ID and immutable digest without restarting the workload.
  • Compare the digest with the signed release manifest and approved v1.93.0 artifact.
  • Inspect deployment history for a tag-only image reference.

ResolutionFreeze traffic changes, restore the previously accepted digest, verify the upstream signature, and make version plus digest an admission requirement before the next rollout.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
03

config

Provision PostgreSQL, shared limiter state, and least-privilege identities

caution

Run the LiteLLM control-plane database as a separately backed-up PostgreSQL service. Use a dedicated application role, a distinct migration role used only during a controlled release, TLS verification, connection limits and a secret-manager reference. When multi-replica rate limiting or caching requires shared Redis-compatible state, isolate it from public networks, authenticate and encrypt it, set bounded memory and an explicit outage policy. Do not let application replicas create schemas during every startup.

Why this step matters

Virtual keys, spend records and policy objects are durable security and financial state. Mixing migrations with ordinary replica startup creates races and makes rollback ambiguous; process-local rate-limit state makes limits inaccurate behind a load balancer.

What to understand

Keep PostgreSQL backups encrypted with an independently recoverable key. Inventory database extensions, roles, grants, schema revision and application version in every backup manifest.

Do not grant the runtime role ownership, database creation, role management or broad public-schema privileges. The migration identity should be unavailable to the running gateway.

Decide whether Redis loss rejects requests, disables only cache, or applies conservative local limits. Document the choice per feature; never silently disable authentication or hard budgets.

Set connection pool sizes from a total database connection budget across all replicas, migrations, workers and administrative sessions. Include headroom for recovery.

System changes

  • Creates durable control-plane state, least-privilege identities and shared limiter/cache connectivity; it does not create provider keys or public aliases.

Syntax explained

sslmode=verify-full
Encrypts the PostgreSQL connection and verifies both certificate chain and server name.
migration role
Temporary release identity allowed to apply reviewed schema changes but not used by gateway replicas.
shared limiter
Coordinates counters across replicas so an aggregate tenant limit is not multiplied by replica count.
File ops/litellm/runtime.env.example
Configuration
DATABASE_URL=postgresql://litellm_app@db.internal:5432/litellm?sslmode=verify-full
LITELLM_MASTER_KEY=from-secret-manager
REDIS_HOST=redis.internal
REDIS_PORT=6380
REDIS_PASSWORD=from-secret-manager
REDIS_SSL=true
Command
node ops/preflight-state.mjs --database litellm --require-tls --require-app-role --require-migration-role --redis-tls --no-secrets
Example output / evidence
postgres TLS: verified
application role: CONNECT + required schema privileges
migration role: disabled outside release window
startup DDL: blocked
redis TLS/auth: verified
shared limiter probe: PASS

Checkpoint: Checkpoint: Provision PostgreSQL, shared limiter state, and least-privilege identities

Continue whenState services are private, encrypted, authenticated and observable; application and migration privileges are separated; restore ownership and dependency outage behavior are documented.

Stop whenThe database is publicly reachable, TLS identity is not verified, backups are untested, runtime has migration privileges, or shared-limit failure behavior is undefined.

If this step fails

LiteLLM cannot start and reports a Prisma or database migration error.

Likely causeThe database schema is behind or ahead of the application, the migration identity lacks required privileges, concurrent replicas attempted an incompatible migration, or a partial migration exists.

Safe checks
  • Keep the old replicas serving and inspect the new replica logs with secrets redacted.
  • Query migration state from a read-only database session and compare it with the v1.93.0 release notes.
  • Restore a production backup into an isolated database and reproduce the migration there.

ResolutionDo not retry blindly. Roll the new deployment back, repair or restore the isolated copy, run the documented migration once under a dedicated identity, validate it, and only then repeat a one-replica canary.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
04

config

Start a pinned, private LiteLLM runtime with real health checks

caution

Create a concrete Compose service for the reviewed LiteLLM image digest. Keep the listener on host loopback, mount the reviewed gateway configuration read-only, load runtime secrets from a root-owned file rendered by the secret manager, drop Linux capabilities, deny privilege escalation, use a read-only root filesystem with bounded temporary storage, and connect only to the private state and controlled egress network. Validate the fully resolved Compose model before starting one replica, then prove the LiteLLM liveness endpoint locally. The later edge step remains the only public entry point.

Why this step matters

A signed image and a valid YAML fragment do not create an operating service. This step gives readers a directly inspectable runtime boundary and separates image identity, secret injection, private reachability, process health, and later public routing into independently testable decisions.

What to understand

Write `LITELLM_IMAGE=docker.litellm.ai/berriai/litellm@sha256:<approved-digest>` to `/etc/litellm/image.env`; never deploy a tag-only value. Keep `/etc/litellm/runtime.env` mode 0600, root-owned, outside the repository, and render it from the secret manager immediately before deployment.

The runtime env file contains secret references or injected values for `LITELLM_MASTER_KEY`, `DATABASE_URL`, provider credentials and Redis authentication. Do not print `docker compose config` without `--images`, because a fully interpolated configuration can disclose environment values.

Loopback publishing prevents direct remote access but does not constrain outbound provider traffic. Enforce an approved provider allowlist with the host, network, or egress proxy and test denied destinations separately.

The health check proves process liveness only. Authentication, alias policy, database schema, provider reachability, limits, privacy and quality are accepted by later negative and behavioral fixtures.

The `ops/*.mjs` commands elsewhere in this guide name version-controlled operator test harnesses, not built-in LiteLLM commands. Implement their stated contracts in your deployment repository or run equivalent explicit curl, database and observability checks; never assume an undefined helper has enforced a control.

System changes

  • Creates and starts one private LiteLLM gateway container, reads the root-owned runtime environment, connects to private state and controlled egress, and publishes port 4000 only on host loopback.

Syntax explained

image@sha256
Runs the exact signed and reviewed bytes recorded by the release manifest rather than resolving a mutable tag at restart time.
127.0.0.1:4000:4000
Makes the backend reachable only from the host until the authenticated TLS edge is configured.
read_only + tmpfs
Keeps the container root immutable while providing bounded ephemeral space required by the Python runtime.
config --images
Shows the resolved image identity without rendering secret-bearing environment values into terminal history or deployment evidence.
File ops/litellm/compose.yaml
Configuration
services:
  proxy:
    image: "${LITELLM_IMAGE:?set an approved image@sha256 digest}"
    command: ["--config", "/etc/litellm/config.yaml", "--port", "4000", "--num_workers", "2"]
    env_file:
      - /etc/litellm/runtime.env
    ports:
      - "127.0.0.1:4000:4000"
    volumes:
      - ./config.yaml:/etc/litellm/config.yaml:ro
    read_only: true
    tmpfs:
      - /tmp:size=256m,mode=1777
    cap_drop: [ALL]
    security_opt: [no-new-privileges:true]
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:4000/health/liveliness', timeout=2)"]
      interval: 15s
      timeout: 3s
      retries: 10
      start_period: 45s
    networks: [gateway_private]

networks:
  gateway_private:
    name: litellm_gateway_private
Command
sudo test -r /etc/litellm/runtime.env && docker compose --env-file /etc/litellm/image.env -f ops/litellm/compose.yaml config --images && docker compose --env-file /etc/litellm/image.env -f ops/litellm/compose.yaml up --detach --wait proxy && curl --fail --silent --show-error http://127.0.0.1:4000/health/liveliness
Example output / evidence
docker.litellm.ai/berriai/litellm@sha256:8e3f…c291
[+] Running 1/1
 ✔ Container litellm-proxy-1  Healthy
{"status":"healthy"}

Checkpoint: Checkpoint: Start a pinned, private LiteLLM runtime with real health checks

Continue whenCompose resolves exactly one image@sha256 reference, the container becomes healthy, the liveness endpoint answers only on loopback, no secret appears in the rendered evidence, and an unapproved remote host cannot reach port 4000.

Stop whenThe image resolves to a tag, the runtime env is readable by non-administrators, Compose would publish a non-loopback address, the container requires privileged mode or broad host mounts, health never stabilizes, or egress policy cannot restrict provider destinations.

If this step fails

LiteLLM cannot start and reports a Prisma or database migration error.

Likely causeThe database schema is behind or ahead of the application, the migration identity lacks required privileges, concurrent replicas attempted an incompatible migration, or a partial migration exists.

Safe checks
  • Keep the old replicas serving and inspect the new replica logs with secrets redacted.
  • Query migration state from a read-only database session and compare it with the v1.93.0 release notes.
  • Restore a production backup into an isolated database and reproduce the migration there.

ResolutionDo not retry blindly. Roll the new deployment back, repair or restore the isolated copy, run the documented migration once under a dedicated identity, validate it, and only then repeat a one-replica canary.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
05

config

Define provider aliases with secret references and policy metadata

caution

Create a small reviewed `model_list` whose public names express product intent rather than provider names. Each deployment entry uses environment or workload-identity references for credentials and records region, provider account, model snapshot, data-class eligibility and cost center in the external model registry. Do not put provider keys or the LiteLLM master key in YAML. Do not place deployments with different residency, retention, safety, context, tool, structured-output or quality behavior into the same routing group merely because they accept similar API syntax.

Why this step matters

Aliases let applications remain stable while the platform changes deployment details, but they can hide material provider differences. External policy metadata and behavioral fixtures make the abstraction reviewable.

What to understand

Use provider-side project or account credentials dedicated to this gateway and environment. Never reuse personal keys or a production key in development.

Set provider timeouts and gateway deadlines coherently. Retries are configured later as a routing policy so nested SDK, LiteLLM and provider retries do not multiply attempts.

Resolve secret references before serving traffic and report only the secret version or fingerprint. A missing provider secret must make only that deployment unhealthy.

Keep passthrough routes disabled unless separately inventoried, authenticated and tested; a passthrough endpoint can bypass alias policy and expose a broader provider API surface.

System changes

  • Creates two reviewed aliases and provider deployment references; provider credentials remain in the secret manager and no public access is enabled.

Syntax explained

model_name
Stable alias requested by approved applications and governed by the platform policy.
model_info.id
Unique deployment identity used for health, audit and routing evidence.
max_retries: 0
Avoids hidden per-deployment retries so the explicit router attempt budget remains authoritative.
File ops/litellm/config.yaml
Configuration
model_list:
  - model_name: support-fast
    litellm_params:
      model: openai/approved-fast-snapshot
      api_key: os.environ/OPENAI_API_KEY
      timeout: 25
      max_retries: 0
    model_info:
      id: support-fast-primary-eu
  - model_name: support-deep
    litellm_params:
      model: anthropic/approved-deep-snapshot
      api_key: os.environ/ANTHROPIC_API_KEY
      timeout: 55
      max_retries: 0
    model_info:
      id: support-deep-primary-eu
Command
node ops/litellm-policy.mjs validate-config ops/litellm/config.yaml --registry ops/litellm/model-registry.yaml --forbid-inline-secrets --require-explicit-snapshots
Example output / evidence
aliases: support-fast, support-deep
deployments: 2
inline secrets: 0
moving model names: 0
missing region/account/data class: 0
incompatible routing groups: 0
result: PASS

Checkpoint: Checkpoint: Define provider aliases with secret references and policy metadata

Continue whenEvery public alias resolves to exact approved deployments with secret references, unique IDs, bounded timeouts and compatible privacy/quality properties.

Stop whenA credential appears in configuration, a provider model is a moving alias, policy metadata is missing, or deployments in one alias differ materially without explicit caller-visible behavior.

If this step fails

A provider alias sends traffic to the wrong model, region, or account.

Likely causeThe alias points at an ambiguous provider model name, configuration drift changed a deployment, or routing groups mix deployments with different privacy and quality properties.

Safe checks
  • Resolve the alias from the running redacted configuration and record deployment IDs.
  • Issue a tagged synthetic request and inspect provider account, region, model and response headers.
  • Compare the result with the approved model registry and residency matrix.

ResolutionDisable the alias, restore the last approved mapping, separate deployments into compatible policy groups, and require alias-resolution tests during every release.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
06

config

Publish a TLS-authenticated edge with a minimal route surface

caution

Place LiteLLM on a private listener behind a reviewed reverse proxy or service ingress. Terminate TLS with automated renewal, modern policy, request-size and header limits, conservative timeouts, explicit trusted-proxy handling and a route allowlist. Expose only required OpenAI-compatible inference endpoints plus separately protected operational endpoints. Bind the administrative UI and key-management APIs to an identity-aware administrative network; do not publish the master-key path to ordinary callers.

Why this step matters

The gateway's broad proxy API and administrative surfaces should not become an accidental public control plane. Route allowlisting and network separation reduce exposure before application-level policy runs.

What to understand

Generate or preserve a request ID at the trusted edge and propagate it to the gateway and provider metadata where supported. Never encode tenant, email, prompt or key material in the ID.

Choose streaming-compatible timeouts while retaining an absolute request deadline. A connection that remains open forever can consume concurrency even after provider work is lost.

Restrict outbound network access from LiteLLM to approved provider endpoints, state services, secret manager and telemetry destinations. DNS and proxy policy should be observable.

Keep health probes shallow and non-secret. Provider checks use dedicated test deployments and tiny synthetic requests under strict cost limits.

System changes

  • Publishes the inference endpoint behind TLS and hides unapproved routes; it does not yet issue client keys or send production traffic.

Syntax explained

exact location
Publishes only the intended inference path rather than proxying the complete application surface.
client_max_body_size
Rejects unexpectedly large bodies before they consume parsing, logging, memory or provider cost.
absolute deadline
Bounds the full request including queue, attempts, fallback and streaming.
File ops/litellm/nginx.conf
Configuration
server {
  listen 443 ssl http2;
  server_name llm-gateway.example.net;
  client_max_body_size 2m;
  location = /v1/chat/completions {
    proxy_pass http://litellm_private;
    proxy_read_timeout 65s;
    proxy_set_header X-Request-ID $request_id;
  }
  location / { return 404; }
}
Command
node ops/edge-audit.mjs https://llm-gateway.example.net --require-tls --route-allowlist ops/litellm/routes.txt --negative-tests
Example output / evidence
TLS name/chain: PASS
allowed /v1/chat/completions: 401 without key
blocked /ui: 404
blocked /key/generate: 404
request size >2 MiB: 413
untrusted forwarding headers ignored: PASS

Checkpoint: Checkpoint: Publish a TLS-authenticated edge with a minimal route surface

Continue whenExternal TLS tests pass, unauthenticated inference is rejected, administrative and unknown routes are unreachable, and only approved outbound destinations are available.

Stop whenThe private listener is directly reachable, admin APIs are public, forwarding headers are trusted from arbitrary clients, or certificate identity and renewal cannot be verified.

If this step fails

The TLS endpoint presents the wrong certificate or accepts obsolete policy.

Likely causeThe reverse proxy loaded an old secret, SNI routes are wrong, renewal did not reload, or an internal plaintext listener is reachable outside the trusted segment.

Safe checks
  • Inspect the public certificate chain, names, expiry and negotiated protocol from an external test host.
  • List bound listeners and network policies without exposing private keys.
  • Confirm the gateway trusts only the intended proxy hop.

ResolutionRemove the affected endpoint from DNS/load balancing, restore the correct certificate and network boundary, rotate exposed material if needed, and retest from outside and inside the trust boundary.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
07

config

Enable fail-closed authentication and scoped virtual keys

caution

Load the LiteLLM master key from the secret manager only for control-plane administration. Issue virtual keys to workload identities, not humans, with a named team/project, approved model aliases, expiry, maximum parallelism, budget and auditable owner. Separate production, staging and CI. Store only the client secret in the caller's secret manager, never in source or telemetry. Test unknown, expired, revoked, wrong-team and wrong-model keys before issuing a production key.

Why this step matters

A shared provider key makes tenant attribution, revocation and least privilege impossible. Virtual keys create a controllable boundary, but only when every route enforces them and the master key is isolated.

What to understand

Prefer automated issuance to an authenticated workload identity. If a key must be delivered manually, show it once over an approved secret channel and require confirmation that it was stored securely.

Use short expiry and rotation with overlap. Revocation must propagate across replicas and caches within a tested objective.

Do not expose raw virtual keys in administrative list responses, logs or database exports used by analysts. Use stable hashed identifiers for correlation.

Key metadata is policy input, not a user assertion. Only trusted administrators or identity automation may set tenant, owner, environment and data-class claims.

System changes

  • Creates scoped, expiring workload credentials and negative authorization tests; the master key remains outside caller paths.

Syntax explained

allowed_models
Restricts a workload key to approved public aliases and prevents arbitrary provider/model access.
hard_budget_usd
Defines a blocking spend boundary in addition to alerts and provider-side limits.
max_parallel_requests
Caps concurrent work so one client cannot consume every gateway or provider slot.
File ops/litellm/key-policy.yaml
Configuration
defaults:
  expires_in: 30d
  allowed_models: []
  max_parallel_requests: 4
  metadata:
    environment: required
    owner: required
policies:
  support-prod:
    allowed_models: [support-fast, support-deep]
    max_parallel_requests: 12
    hard_budget_usd: 800
Command
node ops/key-fixtures.mjs test https://llm-gateway.example.net --policy ops/litellm/key-policy.yaml --synthetic --no-token-output
Example output / evidence
valid scoped key / support-fast: 200
unknown key: 401
expired key: 401
revoked key: 401
wrong model: 403
admin route with workload key: 404
result: PASS

Checkpoint: Checkpoint: Enable fail-closed authentication and scoped virtual keys

Continue whenEvery workload has a unique scoped key with owner and expiry; negative tests fail closed; revocation and rotation work across all replicas.

Stop whenOne shared key is proposed, master-key access reaches workloads, key metadata is caller-controlled, or any published route bypasses virtual-key validation.

If this step fails

A request without an approved virtual key reaches a provider.

Likely causeThe public listener bypasses the authenticating proxy path, a passthrough endpoint is exposed, the master key is missing, or a custom authentication hook fails open.

Safe checks
  • Send an unauthenticated synthetic request to every published route and record status codes.
  • List listener and ingress routes and compare them with the endpoint allowlist.
  • Inspect authentication decisions by request ID without logging supplied tokens.

ResolutionRemove the route from service immediately, rotate affected credentials, require fail-closed authentication at both ingress and LiteLLM, and add a negative test for every API route.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
08

config

Apply layered hard budgets with reconciliation and headroom

caution

Set budgets at provider account, gateway team/project and virtual-key levels. Use hard blocking limits for financial boundaries and earlier soft alerts for owners. Normalize reset time to UTC, document whether cached/retried/failed requests count, maintain versioned price metadata, and reserve incident headroom separately rather than increasing every key. Reconcile LiteLLM usage against provider billing daily; show cost as estimated when a provider or model lacks complete pricing.

Why this step matters

Budgets protect the organization only if they block consistently under concurrency and map to provider reality. A dashboard warning after spend occurs is not an enforcement control.

What to understand

Use maximum input/output tokens and request-size limits to bound the cost of a single request. A monthly budget alone permits one malformed call to consume disproportionate spend.

Define who receives alerts, who may grant a temporary increase and how it expires. Record reason, approver, amount and time window.

Provider-side projects and budgets are defense in depth when available. Keep separate credentials per environment so a staging leak cannot consume production credit.

Reconcile by provider request ID, timestamp, deployment and token dimensions. Never store prompt content merely to explain a financial variance.

System changes

  • Creates layered budget policy, alerts, threshold concurrency tests and daily reconciliation; it may reject requests when cost cannot be determined safely.

Syntax explained

unknown_price_action: deny
Prevents an unpriced model from bypassing a hard financial boundary.
incident_reserve
Separately approved capacity for incident response rather than hidden permanent budget inflation.
maximum variance
Triggers investigation when gateway estimates diverge materially from provider billing.
File ops/litellm/budget-policy.yaml
Configuration
currency: USD
reset_timezone: UTC
alerts: [0.50, 0.75, 0.90]
teams:
  support-prod:
    monthly_hard_budget: 800
    incident_reserve: 100
    unknown_price_action: deny
reconciliation:
  maximum_variance_percent: 3
  owner: finops-ai
Command
node ops/budget-fixtures.mjs run --policy ops/litellm/budget-policy.yaml --concurrency 8 --threshold 1.00 --reconcile-provider-fixture
Example output / evidence
soft alerts: 50%, 75%, 90%
requests before threshold: accepted
concurrent requests at threshold: 1 accepted, 7 denied
unknown-price model: denied
ledger variance: 0.8%
result: PASS

Checkpoint: Checkpoint: Apply layered hard budgets with reconciliation and headroom

Continue whenHard limits block at exact thresholds under concurrency, owners receive early alerts, unpriced models cannot bypass policy, and daily ledger variance remains within the accepted range.

Stop whenBudgets are advisory only, pricing is unknown without a deny path, reset time is ambiguous, or the gateway ledger cannot be reconciled to provider usage.

If this step fails

A project exceeds its daily budget even though a budget is configured.

Likely causeThe budget is soft rather than blocking, spend writes are delayed, the key is not attached to the expected team, provider pricing metadata is missing, or concurrent requests race near the limit.

Safe checks
  • Compare virtual-key, team and provider spend ledgers for the same UTC window.
  • Inspect budget mode, reset time, model pricing and rejected-request metrics.
  • Reproduce the threshold with a synthetic key capped at a very small amount.

ResolutionSuspend or reduce the affected key, reconcile usage with provider billing, configure a hard enforcement policy plus headroom and alerts, and test concurrent requests at the exact threshold.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
09

config

Enforce shared request, token, concurrency, and deadline limits

caution

Configure limits per virtual key and team: requests per minute for burst control, input/output tokens per minute for cost and provider protection, concurrent requests/streams for capacity, body and generation ceilings for single-request bounds, and a deadline that includes queueing, provider attempts and streaming. Coordinate counters across replicas. Return a stable 429 response with retry guidance but never reveal another tenant's usage.

Why this step matters

Provider limits alone protect the provider account, not fair sharing among internal tenants. Multiple independent dimensions prevent a small number of long streams or huge prompts from defeating an RPM-only limit.

What to understand

Count the original request and provider attempts separately. Retry and fallback must consume an explicit attempt budget and provider capacity even when the caller sees one request.

Use a bounded queue or no queue. An unbounded gateway queue converts provider overload into stale, expensive work and memory pressure.

Apply limits before reading or logging a complete oversized body where possible. Validate declared and actual content length.

Design a documented degraded mode for shared-counter failure: conservative local quotas, read-only cached responses where suitable, or explicit unavailability—not unlimited traffic.

System changes

  • Adds shared multi-dimensional limits and overload responses across replicas; aggressive clients may now receive deterministic 429 or deadline errors.

Syntax explained

RPM
Bounds request bursts but does not by itself represent token cost or long-lived streams.
TPM
Bounds input and output token throughput; both dimensions should be controlled independently.
attempt budget
Caps the total primary, retry and fallback provider calls made for one client request.
File ops/litellm/limit-policy.yaml
Configuration
support-prod:
  rpm: 120
  input_tpm: 180000
  output_tpm: 60000
  max_parallel: 12
  max_body_bytes: 2097152
  max_output_tokens: 4096
  deadline_seconds: 65
  attempt_budget: 2
Command
node ops/load-fixtures.mjs burst https://llm-gateway.example.net --keys 2 --replicas 3 --requests 150 --assert-tenant-isolation --assert-deadline
Example output / evidence
key A accepted: 120 rejected: 30
key B accepted: 120 rejected: 30
aggregate per-key limit multiplied by replicas: false
maximum observed attempts/request: 2
requests beyond deadline: 0
result: PASS

Checkpoint: Checkpoint: Enforce shared request, token, concurrency, and deadline limits

Continue whenLimits hold across replicas and tenants, bounded overload returns promptly, streaming obeys concurrency/deadline policy, and Redis loss follows the documented conservative behavior.

Stop whenCounters are process-local, retry attempts are unbounded, queue size is unlimited, or shared-state failure disables hard budgets or authorization.

If this step fails

Rate limiting works on one replica but aggregate traffic exceeds the promised limit.

Likely causeCounters are process-local, Redis/shared state is unavailable, identity keys are inconsistent, or retries and streaming requests are counted differently.

Safe checks
  • Send a bounded concurrent test through the load balancer and group results by key and replica.
  • Check shared limiter connectivity, rejected counts and TTLs without flushing state.
  • Compare request identity and token accounting for streaming, retry and fallback paths.

ResolutionFail closed or reduce capacity according to policy, repair shared state, normalize the limiter key, and require a multi-replica burst test before advertising the limit.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
10

config

Create explicit routing, retry, and fallback policy

caution

Group only deployments that have been approved as substitutes for the same alias and data class. Choose a routing strategy based on measured latency/capacity, but constrain it with provider account, region, residency, feature and quality metadata. Retry only transient failures, respect `Retry-After`, add jitter, and stay inside the request deadline and attempt budget. A fallback to a different model family, jurisdiction, retention policy or price class requires a distinct alias or explicit caller consent; otherwise return unavailability.

Why this step matters

Reliability logic can become a privacy, quality and cost policy engine. A generic 'try another model' rule hides material changes from applications and customers and may multiply an outage.

What to understand

Do not retry authentication, authorization or structurally invalid requests; retries cannot repair them and can trigger provider defenses or duplicate cost.

For non-idempotent tool or batch operations, verify provider semantics and idempotency keys before any retry. This guide focuses on model inference, not arbitrary provider passthrough.

Use circuit breaking and health signals carefully. A health endpoint can be green while a specific model, region or capability is impaired.

Expose the resolved public alias, deployment ID and fallback occurrence in privacy-safe response metadata or audit records so operators can explain behavior without exposing credentials.

System changes

  • Enables bounded retries and compatible failover; when no approved substitute exists, availability intentionally yields to privacy and correctness with a 503 response.

Syntax explained

least-busy
Routes among policy-equivalent deployments using observed in-flight work rather than random choice alone.
never_retry_on
Prevents amplification of permanent authentication, permission and request errors.
unsafe_fallback_action: fail
Makes an incompatible provider/model unavailable rather than silently crossing an approval boundary.
File ops/litellm/routing-policy.yaml
Configuration
aliases:
  support-fast:
    data_classes: [public, internal]
    strategy: least-busy
    attempts: 2
    retry_on: [timeout, connection_error, rate_limit]
    never_retry_on: [authentication, permission, invalid_request]
    fallback_group: support-fast-compatible-eu
    unsafe_fallback_action: fail
Command
node ops/routing-fixtures.mjs replay --policy ops/litellm/routing-policy.yaml --matrix ops/litellm/provider-approval.yaml --inject timeout,429,401,invalid-request,outage
Example output / evidence
timeout: one compatible fallback within deadline
429: Retry-After honored; attempts=2
401: no retry or fallback
invalid request: no retry or fallback
all compatible deployments down: 503; unsafe provider calls=0
result: PASS

Checkpoint: Checkpoint: Create explicit routing, retry, and fallback policy

Continue whenTransient faults use at most the attempt budget, permanent errors do not retry, every selected deployment is policy-compatible, and total provider calls remain bounded during an outage.

Stop whenFallback groups lack residency/retention/quality evidence, retries exceed the caller deadline, or provider selection cannot be explained by request ID.

If this step fails

A provider returns 429 responses and retries amplify the incident.

Likely causeRetries ignore `Retry-After`, exceed the request deadline, synchronize across replicas, or cascade through multiple fallbacks with no attempt budget.

Safe checks
  • Trace one synthetic request through attempts, backoff, fallback and final status.
  • Compare total provider calls with accepted gateway requests.
  • Inspect queue depth, deadline exhaustion and retry reason metrics.

ResolutionCap attempts, use jittered backoff within the caller deadline, reduce concurrency, respect provider limits, and return an explicit overload response rather than creating a retry storm.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
11

config

Disable content logging and prove redaction at every telemetry sink

caution

Start from data minimization: record request ID, virtual-key fingerprint, team, alias, deployment ID, status, latency, token counts, estimated cost, fallback reason and policy decisions; do not record prompt, completion, embeddings, uploaded files, authorization headers, cookies or raw provider errors. Configure LiteLLM callbacks, reverse-proxy logs, OpenTelemetry exporters and provider telemetry separately. Inject synthetic canary secrets and personal-data markers, exercise success and failure paths, and search every sink before production.

Why this step matters

A gateway observes every prompt and response, so default debugging can create a second ungoverned copy of sensitive content. Redaction must be tested end to end, including errors and third-party callbacks.

What to understand

Use allowlisted telemetry fields rather than attempting to enumerate every possible secret pattern. Redaction remains defense in depth for unexpected values.

Do not put team names, user emails, document titles or prompt fragments in metric labels; labels are widely replicated and high cardinality harms the monitoring system.

Retain request-to-provider correlation through opaque IDs. Operators should diagnose latency, rate limit and spend without reading customer content.

Review each provider's data-control and abuse-monitoring behavior separately. Gateway log minimization does not change what an upstream provider receives or retains.

System changes

  • Reduces observability to approved metadata, configures retention and adds canary-based privacy tests across success, error, stream and fallback paths.

Syntax explained

allowlisted fields
Stores only explicitly approved operational metadata instead of filtering an open-ended event body.
key fingerprint
Stable non-secret identifier used for correlation without exposing the virtual key.
raw_provider_errors: false
Prevents provider responses from copying prompt fragments or credentials into gateway logs.
File ops/litellm/telemetry-policy.yaml
Configuration
content_logging: false
allowed_fields: [request_id, key_fingerprint, team_id, alias, deployment_id, status, latency_ms, input_tokens, output_tokens, estimated_cost, fallback_reason]
redact_headers: [authorization, cookie, x-api-key]
raw_provider_errors: false
retention_days: 30
Command
node ops/privacy-fixtures.mjs canary https://llm-gateway.example.net --policy ops/litellm/telemetry-policy.yaml --sinks proxy,app,otel,siem --assert-absent
Example output / evidence
synthetic requests: 14
success/error/stream/fallback paths: covered
canary secret occurrences: 0
personal marker occurrences: 0
authorization header occurrences: 0
required metadata coverage: 100%
result: PASS

Checkpoint: Checkpoint: Disable content logging and prove redaction at every telemetry sink

Continue whenCanary markers are absent from every sink while required request, policy, latency, token, cost and outcome metadata remains usable for operations.

Stop whenAny sink receives prompt/response or secret content, retention/ownership is unknown, or disabling raw content makes authorization or financial decisions unauditable.

If this step fails

Prompt or completion content appears in application logs or an observability vendor.

Likely causeDetailed debugging, request/response callbacks, raw exception serialization, proxy access logs, or tracing attributes capture bodies by default.

Safe checks
  • Search a quarantined logging sample using synthetic canary secrets and unique personal-data markers.
  • Inspect callback, OpenTelemetry, reverse-proxy and error-handler configuration.
  • Check retention, access and deletion controls for every sink that received the marker.

ResolutionStop content logging, revoke unauthorized access, follow incident handling for exposed data, delete where policy and law permit, rotate secrets, and retain only minimal metadata with tested redaction.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
12

config

Build privacy-safe SLO, cost, security, and audit observability

caution

Measure accepted, rejected and completed requests by public alias and deployment; queue, provider and total latency; status/error class; token and estimated cost; budget consumption; rate-limit rejection; retries/fallbacks; provider health; database/Redis availability; key creation/revocation; configuration and policy revision. Use bounded labels and opaque identifiers. Alert on customer-visible SLO burn, authentication bypass probes, unexpected provider selection, reconciliation variance, budget exhaustion and redaction canaries—not on every transient provider error.

Why this step matters

A gateway outage, overspend and privacy violation are different incidents. Separate signals and runbooks let operators respond without reaching for raw prompt content.

What to understand

Record configuration revision and image digest on every replica and deployment event. Mixed revisions should be visible immediately.

Audit administrative actions with actor, object, before/after policy hashes, timestamp, approval and request ID. Never record the generated secret value.

Use provider request IDs for reconciliation where contractual policy permits, but do not expose them as public identifiers or metric labels.

Test alerts in staging and production canaries. An alert that has never fired under a controlled fixture is only an assumption.

System changes

  • Adds dashboards, alerts and administrative audit evidence using metadata-only telemetry; it does not enable prompt inspection.

Syntax explained

SLO burn
Alerts when error or latency budget is being consumed at a rate that threatens the objective.
bounded labels
Prevents user-controlled identifiers and high-cardinality values from destabilizing metrics storage.
policy hash
Links an administrative change or request to the exact reviewed policy revision.
File ops/litellm/alerts.yaml
Configuration
alerts:
  - name: gateway-slo-burn
    windows: [5m, 1h]
  - name: unsafe-provider-selection
    threshold: 1
  - name: content-redaction-canary
    threshold: 1
  - name: spend-reconciliation-variance
    threshold_percent: 3
  - name: virtual-key-auth-bypass
    threshold: 1
Command
node ops/observability-fixtures.mjs exercise --gateway https://llm-gateway.example.net --alerts ops/litellm/alerts.yaml --synthetic
Example output / evidence
dashboards: request, provider, cost, security, state dependencies
bounded label cardinality: PASS
SLO burn fixture: alert fired
unsafe selection fixture: alert fired
redaction canary fixture: alert fired
audit chain completeness: 100%

Checkpoint: Checkpoint: Build privacy-safe SLO, cost, security, and audit observability

Continue whenOperators can identify affected alias, deployment, tenant fingerprint, policy revision, cost and dependency without viewing content; critical fixtures trigger actionable alerts.

Stop whenDashboards require raw prompts, label cardinality grows with users/requests, administrative changes lack actors, or provider selection cannot be audited.

If this step fails

Gateway spend metrics disagree materially with provider invoices.

Likely causePricing metadata is stale, cached or failed requests are classified differently, streaming usage is incomplete, currency/time zones differ, or provider-specific tokens are mapped incorrectly.

Safe checks
  • Reconcile a bounded request sample by provider request ID and UTC timestamp.
  • Compare input, cached, reasoning and output token fields before price calculation.
  • Inspect unknown-model and cost-calculation warning metrics.

ResolutionLabel cost estimates as incomplete, block budget-sensitive aliases if necessary, update versioned pricing metadata, backfill only from auditable records, and alert on reconciliation variance.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
13

verification

Run behavioral, privacy, cost, and provider-failure acceptance tests

read-only

Build deterministic fixtures that cover each public alias and capability: authentication, model denial, request limits, streaming, structured output and tool declarations where supported. Inject timeout, 429, 5xx, invalid credentials, region outage, database loss, Redis loss and telemetry loss. Assert provider choice, attempts, status, deadline, budget charge, audit event and absence of content leakage. Compare candidate v1.93.0 behavior with the accepted baseline; do not rely on liveness alone.

Why this step matters

A healthy process can still route to the wrong region, double-charge retries, leak an error body or ignore a key restriction. Behavior-pinning makes the gateway's real contract observable before rollout.

What to understand

Use synthetic prompts that are safe for every provider approval class. Include unique canary values so leakage tests can search telemetry reliably.

Run quality and feature compatibility fixtures per deployment. API shape compatibility does not imply equivalent tool calling, structured output, refusal or tokenization.

Test simultaneous failures and concurrency near thresholds. Many budget and limiter defects appear only when replicas race.

Keep provider tests low-cost and bounded. Record fixture version, provider request IDs, timestamps and selected deployment without storing content.

System changes

  • Creates a release evidence bundle and exercises controlled faults against a canary; production traffic remains unchanged.

Syntax explained

behavior pinning
Compares security, routing, accounting and API outcomes—not merely process health—between revisions.
fault matrix
Enumerates dependency and provider failures with the exact safe expected response.
synthetic-only
Prevents production prompts or customer data from being copied into the acceptance environment.
Command
node ops/gateway-acceptance.mjs run --candidate https://litellm-canary.internal --baseline artifacts/litellm-baseline.json --faults ops/litellm/fault-matrix.yaml --synthetic-only
Example output / evidence
behavior fixtures: 186 passed, 0 failed
fault scenarios: 27 passed, 0 failed
unsafe provider selections: 0
hard-budget bypasses: 0
content canary leaks: 0
p95 latency regression: +2.1% (budget +10%)
result: ACCEPT

Checkpoint: Checkpoint: Run behavioral, privacy, cost, and provider-failure acceptance tests

Continue whenAll security, privacy, cost and routing fixtures pass; injected faults stay within attempts/deadlines; no incompatible provider is selected; regressions stay inside accepted budgets.

Stop whenAny authorization or hard-budget bypass occurs, a fallback crosses policy, a content marker reaches telemetry, or a behavior change lacks explicit review.

If this step fails

A canary upgrade passes health checks but changes routing or accounting behavior.

Likely causeHealth endpoints test liveness only, release notes were not translated into behavior fixtures, or schema/config defaults changed between versions.

Safe checks
  • Compare baseline and candidate responses for alias, auth, budget, fallback and redaction fixtures.
  • Inspect database changes and default configuration differences.
  • Route only synthetic traffic while collecting provider choice and cost deltas.

ResolutionDrain the canary, restore the coupled application/config/database baseline, add the behavioral regression to the release suite, and repeat only after the difference is understood and accepted.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
14

decision

Roll out one immutable canary and expand by measured gates

caution

Apply reviewed database migrations once, deploy one v1.93.0 replica by digest with the exact configuration/policy revisions, and route only synthetic traffic. Then permit a small allowlist of consenting internal workloads with non-sensitive data. Compare auth failures, provider choice, latency, token/cost accounting, fallbacks, database load, Redis behavior and privacy canaries against baseline. Expand in explicit stages; keep old replicas and the rollback-compatible state available until the observation window closes.

Why this step matters

A canary limits blast radius only when it isolates new bytes and state, receives representative traffic, has explicit stop thresholds and can be drained without guessing about schema compatibility.

What to understand

Do not mix canary and baseline behind an opaque random balancer during diagnosis. Propagate a cohort identifier and make per-revision metrics visible.

Use consented internal workloads before external tenants. Never route restricted content until residency, retention and redaction evidence is complete.

Define automatic halt thresholds for authorization failures, unsafe fallback, content canary, spend variance, error rate and latency; financial and privacy failures do not wait for an aggregate SLO.

Keep a change window owner and rollback operator present. Promotion is a decision backed by evidence, not a timer that always advances.

System changes

  • Migrates reviewed control-plane schema and incrementally shifts a bounded cohort to the new immutable release while preserving baseline capacity.

Syntax explained

synthetic cohort
Exercises the complete route with harmless fixed requests before real workload exposure.
internal 5%
Small allowlisted production-like cohort used to validate behavior and accounting under real clients.
halt threshold
Predefined metric or security event that stops promotion and may trigger rollback.
Command
node ops/release-gate.mjs promote litellm-v1.93.0 --from synthetic --to internal-5-percent --require artifacts/litellm-acceptance.json --max-slo-regression 0.10
Example output / evidence
image digest: approved
schema/config/policy revision: approved
synthetic window: 60m PASS
internal allowlist: 5%
unsafe fallback: 0
privacy canary: 0
promotion: APPROVED

Checkpoint: Checkpoint: Roll out one immutable canary and expand by measured gates

Continue whenThe canary serves the bounded cohort with zero unsafe selections/leaks/bypasses, accepted SLO/cost variance, complete audit evidence and a tested drain path.

Stop whenRevisions are mixed without attribution, migration rollback is unclear, any privacy/security threshold fires, or baseline capacity cannot absorb a drain.

If this step fails

A canary upgrade passes health checks but changes routing or accounting behavior.

Likely causeHealth endpoints test liveness only, release notes were not translated into behavior fixtures, or schema/config defaults changed between versions.

Safe checks
  • Compare baseline and candidate responses for alias, auth, budget, fallback and redaction fixtures.
  • Inspect database changes and default configuration differences.
  • Route only synthetic traffic while collecting provider choice and cost deltas.

ResolutionDrain the canary, restore the coupled application/config/database baseline, add the behavioral regression to the release suite, and repeat only after the difference is understood and accepted.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
15

verification

Back up and restore the complete recoverable control plane

caution

Back up PostgreSQL with schema, policy objects, virtual-key metadata, budgets, spend/audit records required by policy and migration history. Store the immutable LiteLLM image digest, redacted configuration, policy files, secret references, reverse-proxy configuration, provider registry, alert rules and release evidence in versioned storage. Secrets remain in their manager and require an independently tested recovery process. Restore into an isolated network with replacement provider credentials and prove auth, key revocation, aliases, limits, accounting and audit continuity.

Why this step matters

A database dump alone cannot reproduce provider aliases, edge routes, secrets, policy and application bytes. Conversely, copying raw secrets into the backup bundle expands exposure. A manifest joins independently protected artifacts without collapsing their controls.

What to understand

Use checksums and immutable retention for backup evidence. Test decryption and restore from a clean operator environment, not from credentials cached on the production host.

Recovery must preserve revoked-key state and budget history. Accidentally reactivating an old key or resetting hard spend can turn a restore into a security or financial incident.

Use replacement provider credentials during drills to avoid production calls. Prove secret references and rotation steps rather than copying active keys.

Measure recovery point and recovery time against objectives; record missing telemetry explicitly during the recovery interval.

System changes

  • Creates encrypted recoverable artifacts and an isolated restored gateway; production state and provider credentials are not modified.

Syntax explained

manifest
Binds database dump, image, config, policies, secret references and evidence to one recoverable revision.
replacement secrets
Validates secret wiring without risking live provider credentials or spend during a drill.
revocation continuity
Ensures a restored control plane does not re-enable credentials that were disabled before the backup.
Command
node ops/recovery-drill.mjs litellm --manifest backups/litellm/latest/manifest.json --isolated --replacement-secrets --run-fixtures ops/litellm/recovery-fixtures.yaml
Example output / evidence
backup checksums: PASS
PostgreSQL restore: PASS
schema revision: expected
virtual-key fixtures: 12/12
revoked key remains denied: PASS
budget state: PASS
provider secrets recovered by reference: PASS
RTO: 34m (target 60m)
result: RECOVERABLE

Checkpoint: Checkpoint: Back up and restore the complete recoverable control plane

Continue whenAn isolated restore reproduces exact application/policy/schema state, keeps revoked keys denied, restores budgets and passes all recovery fixtures within RPO/RTO.

Stop whenThe backup lacks a manifest or encryption key recovery, secrets are embedded, revoked keys return, budget state resets, or the isolated restore cannot pass auth/routing fixtures.

If this step fails

The backup completes but an isolated restore cannot authenticate keys or reproduce budgets.

Likely causeThe database dump omitted required schema/data, secret references were not inventoried, encryption keys are unavailable, or application and database revisions do not match.

Safe checks
  • Read the backup manifest, checksums, application version, schema revision and secret-reference inventory.
  • Restore into an isolated network using replacement provider credentials.
  • Run virtual-key, budget, alias and audit-history verification fixtures.

ResolutionClassify the backup as failed, preserve evidence, fix the backup scope and key escrow process, create a fresh artifact, and do not claim recoverability until a timed restore passes.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • Rehearse the change against a disposable database and provider test project with synthetic prompts before touching the production gateway.

Stop conditions

  • Stop when the deployed image digest, schema migration, secret source, provider retention terms, data residency, budget owner, or tested rollback artifact cannot be identified.
  • Stop when a request can cross a tenant, disclose content in logs, bypass a virtual-key policy, or silently fall back to a provider/model that has not been approved for that data class.
16

decision

Operate a versioned upgrade and full rollback procedure

danger

For every LiteLLM upgrade, read upstream release and migration notes, resolve and verify the new immutable image, restore the latest backup to an isolated database, apply migrations once, and run the complete behavior suite. Decide whether the schema is backward compatible before deploying. Couple image, schema, configuration, model registry, price data, policy and fixtures in one release manifest. Rollback means draining the candidate and restoring that complete baseline; if a migration is not reversible, restore the pre-change database and account explicitly for requests accepted after the snapshot.

Why this step matters

Application rollback is incomplete when a newer replica changed database schema, keys, budgets or configuration. Treating the release as one coupled state prevents a fast image rollback from serving against an incompatible control plane.

What to understand

Do not automatically run migrations in every replica. Use one audited migration job after backup and before canary traffic.

Capture writes after the rollback snapshot through an auditable change window. Decide which key, budget and audit changes must be replayed if a database restore is required.

Keep provider aliases and price metadata versioned with the application. Reverting only code can preserve the behavioral regression in dynamic configuration.

After rollback, rerun negative authentication, unsafe fallback, budget threshold, redaction canary and ledger reconciliation tests before declaring service restored.

System changes

  • Defines and rehearses coupled application/database/configuration upgrade and rollback; executing rollback can discard post-snapshot control-plane changes unless reconciled.

Syntax explained

down plan
Documented path to restore schema compatibility, often by restoring the pre-upgrade database rather than assuming reversible DDL.
coupled release manifest
Immutable set of image, schema, configuration, policies, model registry, pricing and tests.
post-snapshot reconciliation
Accounts for key, budget and audit changes made after the backup used for rollback.
Command
node ops/release-gate.mjs verify-upgrade --from manifests/litellm-v1.93.0.json --to manifests/litellm-candidate.json --restored-database --require-down-plan --require-behavior-suite
Example output / evidence
image/signature: PASS
migration rehearsal: PASS
backward compatibility: documented
behavior suite: PASS
rollback database artifact: verified
post-snapshot reconciliation procedure: present
release decision: READY FOR CANARY

Checkpoint: Checkpoint: Operate a versioned upgrade and full rollback procedure

Continue whenEvery release can be reproduced, migration is rehearsed, compatibility is known, rollback artifacts are verified and security/financial continuity has an owner.

Stop whenA migration cannot be restored or reconciled, release artifacts are not coupled, rollback requires unreviewed manual SQL, or post-snapshot key/budget changes would be lost silently.

If this step fails

LiteLLM cannot start and reports a Prisma or database migration error.

Likely causeThe database schema is behind or ahead of the application, the migration identity lacks required privileges, concurrent replicas attempted an incompatible migration, or a partial migration exists.

Safe checks
  • Keep the old replicas serving and inspect the new replica logs with secrets redacted.
  • Query migration state from a read-only database session and compare it with the v1.93.0 release notes.
  • Restore a production backup into an isolated database and reproduce the migration there.

ResolutionDo not retry blindly. Roll the new deployment back, repair or restore the isolated copy, run the documented migration once under a dedicated identity, validate it, and only then repeat a one-replica canary.

Security notes

  • Never place provider API keys, the LiteLLM master key, virtual keys, database credentials, prompt bodies, model responses, personal data, or customer content in the repository, container image, command line, health output, metrics labels, screenshots, support tickets, or example fixtures.
  • Treat the gateway as a privileged policy enforcement point, not as a source of truth. Authentication, model aliases, budgets, routing, redaction, provider data controls, and downstream authorization require separate tests and owners.

Alternatives

  • If backward compatibility cannot be established, schedule a controlled maintenance window with a write freeze, verified backup, isolated migration rehearsal and explicit recovery objective.

Stop conditions

  • Stop before applying production DDL when the latest encrypted backup has not passed an isolated restore with the target and baseline images.
  • Stop rollback if it would reactivate revoked credentials, erase audit evidence without preservation, reset enforced spend, or strand requests whose provider-side effects cannot be reconciled.

Finish line

Verification checklist

Artifact and statenode ops/release-gate.mjs verify manifests/litellm-v1.93.0.json --signature --digest --schema --restore-evidenceThe running digest, schema, configuration, policies and backup evidence match one approved immutable release.
Authentication, tenancy, budget and limitsnode ops/gateway-acceptance.mjs auth-limits --gateway https://llm-gateway.example.net --multi-replica --concurrency --negative-testsUnknown, expired, revoked and out-of-scope keys fail closed; hard budgets and aggregate limits hold exactly across replicas.
Routing and privacynode ops/gateway-acceptance.mjs routing-privacy --faults ops/litellm/fault-matrix.yaml --provider-matrix ops/litellm/provider-approval.yaml --content-canariesAll selected deployments satisfy policy, attempts stay bounded, incompatible fallback returns 503 and no content/secret canary reaches telemetry.
Cost and recoverabilitynode ops/recovery-drill.mjs litellm --isolated --reconcile-provider-fixture --verify-revocations --verify-budgets --measure-rtoUsage reconciles within policy and an isolated restore preserves revoked keys, budget state, alias policy and audit continuity within RPO/RTO.

Recovery guidance

Common problems and safe checks

The container starts with a different LiteLLM version after a routine restart.

Likely causeThe deployment used a moving tag such as `main-latest`, the registry tag was retargeted, or the image digest was not recorded in the release manifest.

Safe checks
  • Read the running image ID and immutable digest without restarting the workload.
  • Compare the digest with the signed release manifest and approved v1.93.0 artifact.
  • Inspect deployment history for a tag-only image reference.

ResolutionFreeze traffic changes, restore the previously accepted digest, verify the upstream signature, and make version plus digest an admission requirement before the next rollout.

LiteLLM cannot start and reports a Prisma or database migration error.

Likely causeThe database schema is behind or ahead of the application, the migration identity lacks required privileges, concurrent replicas attempted an incompatible migration, or a partial migration exists.

Safe checks
  • Keep the old replicas serving and inspect the new replica logs with secrets redacted.
  • Query migration state from a read-only database session and compare it with the v1.93.0 release notes.
  • Restore a production backup into an isolated database and reproduce the migration there.

ResolutionDo not retry blindly. Roll the new deployment back, repair or restore the isolated copy, run the documented migration once under a dedicated identity, validate it, and only then repeat a one-replica canary.

A request without an approved virtual key reaches a provider.

Likely causeThe public listener bypasses the authenticating proxy path, a passthrough endpoint is exposed, the master key is missing, or a custom authentication hook fails open.

Safe checks
  • Send an unauthenticated synthetic request to every published route and record status codes.
  • List listener and ingress routes and compare them with the endpoint allowlist.
  • Inspect authentication decisions by request ID without logging supplied tokens.

ResolutionRemove the route from service immediately, rotate affected credentials, require fail-closed authentication at both ingress and LiteLLM, and add a negative test for every API route.

A provider alias sends traffic to the wrong model, region, or account.

Likely causeThe alias points at an ambiguous provider model name, configuration drift changed a deployment, or routing groups mix deployments with different privacy and quality properties.

Safe checks
  • Resolve the alias from the running redacted configuration and record deployment IDs.
  • Issue a tagged synthetic request and inspect provider account, region, model and response headers.
  • Compare the result with the approved model registry and residency matrix.

ResolutionDisable the alias, restore the last approved mapping, separate deployments into compatible policy groups, and require alias-resolution tests during every release.

Provider credentials work in one replica but fail in another.

Likely causeSecrets were injected inconsistently, a secret version is stale, workload identity differs, or a key rotation updated only part of the fleet.

Safe checks
  • Compare secret references and versions, never secret values, across replicas.
  • Run the provider health check from each replica with a dedicated low-cost test model.
  • Inspect identity and egress policy differences between healthy and failing replicas.

ResolutionDrain the inconsistent replica, converge secret references through the secret manager, rotate the credential if exposure is possible, and verify every replica before restoring load.

A project exceeds its daily budget even though a budget is configured.

Likely causeThe budget is soft rather than blocking, spend writes are delayed, the key is not attached to the expected team, provider pricing metadata is missing, or concurrent requests race near the limit.

Safe checks
  • Compare virtual-key, team and provider spend ledgers for the same UTC window.
  • Inspect budget mode, reset time, model pricing and rejected-request metrics.
  • Reproduce the threshold with a synthetic key capped at a very small amount.

ResolutionSuspend or reduce the affected key, reconcile usage with provider billing, configure a hard enforcement policy plus headroom and alerts, and test concurrent requests at the exact threshold.

Rate limiting works on one replica but aggregate traffic exceeds the promised limit.

Likely causeCounters are process-local, Redis/shared state is unavailable, identity keys are inconsistent, or retries and streaming requests are counted differently.

Safe checks
  • Send a bounded concurrent test through the load balancer and group results by key and replica.
  • Check shared limiter connectivity, rejected counts and TTLs without flushing state.
  • Compare request identity and token accounting for streaming, retry and fallback paths.

ResolutionFail closed or reduce capacity according to policy, repair shared state, normalize the limiter key, and require a multi-replica burst test before advertising the limit.

A primary provider outage causes requests to cross an unapproved privacy boundary.

Likely causeFallbacks are grouped only by capability or price and do not encode region, retention, contractual terms, data class, or customer consent.

Safe checks
  • Inspect the fallback chain for the affected alias and request data class.
  • Replay a synthetic outage while recording the chosen provider, model, region and policy reason.
  • Compare every candidate with the provider approval matrix.

ResolutionDisable the unsafe fallback and return a clear service-unavailable response. Create separate policy-compatible routing groups and never trade privacy or jurisdiction for availability silently.

Prompt or completion content appears in application logs or an observability vendor.

Likely causeDetailed debugging, request/response callbacks, raw exception serialization, proxy access logs, or tracing attributes capture bodies by default.

Safe checks
  • Search a quarantined logging sample using synthetic canary secrets and unique personal-data markers.
  • Inspect callback, OpenTelemetry, reverse-proxy and error-handler configuration.
  • Check retention, access and deletion controls for every sink that received the marker.

ResolutionStop content logging, revoke unauthorized access, follow incident handling for exposed data, delete where policy and law permit, rotate secrets, and retain only minimal metadata with tested redaction.

Gateway spend metrics disagree materially with provider invoices.

Likely causePricing metadata is stale, cached or failed requests are classified differently, streaming usage is incomplete, currency/time zones differ, or provider-specific tokens are mapped incorrectly.

Safe checks
  • Reconcile a bounded request sample by provider request ID and UTC timestamp.
  • Compare input, cached, reasoning and output token fields before price calculation.
  • Inspect unknown-model and cost-calculation warning metrics.

ResolutionLabel cost estimates as incomplete, block budget-sensitive aliases if necessary, update versioned pricing metadata, backfill only from auditable records, and alert on reconciliation variance.

A provider returns 429 responses and retries amplify the incident.

Likely causeRetries ignore `Retry-After`, exceed the request deadline, synchronize across replicas, or cascade through multiple fallbacks with no attempt budget.

Safe checks
  • Trace one synthetic request through attempts, backoff, fallback and final status.
  • Compare total provider calls with accepted gateway requests.
  • Inspect queue depth, deadline exhaustion and retry reason metrics.

ResolutionCap attempts, use jittered backoff within the caller deadline, reduce concurrency, respect provider limits, and return an explicit overload response rather than creating a retry storm.

The TLS endpoint presents the wrong certificate or accepts obsolete policy.

Likely causeThe reverse proxy loaded an old secret, SNI routes are wrong, renewal did not reload, or an internal plaintext listener is reachable outside the trusted segment.

Safe checks
  • Inspect the public certificate chain, names, expiry and negotiated protocol from an external test host.
  • List bound listeners and network policies without exposing private keys.
  • Confirm the gateway trusts only the intended proxy hop.

ResolutionRemove the affected endpoint from DNS/load balancing, restore the correct certificate and network boundary, rotate exposed material if needed, and retest from outside and inside the trust boundary.

The backup completes but an isolated restore cannot authenticate keys or reproduce budgets.

Likely causeThe database dump omitted required schema/data, secret references were not inventoried, encryption keys are unavailable, or application and database revisions do not match.

Safe checks
  • Read the backup manifest, checksums, application version, schema revision and secret-reference inventory.
  • Restore into an isolated network using replacement provider credentials.
  • Run virtual-key, budget, alias and audit-history verification fixtures.

ResolutionClassify the backup as failed, preserve evidence, fix the backup scope and key escrow process, create a fresh artifact, and do not claim recoverability until a timed restore passes.

A canary upgrade passes health checks but changes routing or accounting behavior.

Likely causeHealth endpoints test liveness only, release notes were not translated into behavior fixtures, or schema/config defaults changed between versions.

Safe checks
  • Compare baseline and candidate responses for alias, auth, budget, fallback and redaction fixtures.
  • Inspect database changes and default configuration differences.
  • Route only synthetic traffic while collecting provider choice and cost deltas.

ResolutionDrain the canary, restore the coupled application/config/database baseline, add the behavioral regression to the release suite, and repeat only after the difference is understood and accepted.

After the procedure

Alternatives and next steps

Consider these alternatives

  • Use one provider directly when multi-provider routing adds no justified availability, cost or policy value; fewer credentials and abstraction layers can be safer.
  • Run separate gateways per jurisdiction or data class when a shared control plane would make policy groups difficult to prove or incidents difficult to contain.
  • Use provider-native gateway, budget and identity features when they meet requirements and reduce operational ownership; preserve the same key isolation, reconciliation and rollback tests.
  • Use a managed LiteLLM offering only after reviewing its control plane, data processing, tenancy, backups, export, incident response and exit strategy.

Operate it safely

  • Automate weekly negative-route, revoked-key, unsafe-fallback and content-canary probes from an external test location.
  • Add per-alias quality and feature fixtures for each approved deployment and rerun them after provider model or behavior changes.
  • Reconcile gateway ledger with provider billing daily and review unknown-price or unknown-model events before budget reporting.
  • Practice provider outage, PostgreSQL loss, Redis loss, telemetry loss, credential rotation and full region recovery on a fixed schedule.
  • Review upstream LiteLLM releases, migration policy and security notices; create a new coupled release rather than updating a tag in place.

Reference

Frequently asked questions

Why pin v1.93.0 when a newer dev or RC tag exists?

The latest non-prerelease available on 2026-07-28 is v1.93.0. Development and release-candidate builds can be evaluated separately, but production adoption requires the same signature, digest, migration, behavioral and rollback gates.

Can one alias contain OpenAI, Anthropic and another provider for maximum uptime?

Only if each deployment has been explicitly accepted as equivalent for the alias's data classes, residency, retention, features, quality, price and customer commitments. Otherwise use distinct aliases or return unavailability.

Is a LiteLLM budget the same as a provider billing limit?

No. Use gateway hard budgets for tenant control, provider-side limits for defense in depth, and reconcile the two because token accounting, failed requests, caches and pricing metadata can differ.

Should prompts be logged for debugging?

Not by default. Diagnose with opaque IDs, status, latency, tokens, provider/deployment, policy reason and synthetic reproductions. Any exceptional content capture needs explicit authorization, minimization, access, expiry and deletion handling.

Does Redis failure mean requests should be allowed without limits?

No. Select and test a conservative degraded mode: reject, apply lower local quotas for a short bounded interval, or disable only non-security caching. Authentication and hard financial/data boundaries must not become permissive.

Can a reverse proxy alone protect LiteLLM?

It reduces route and network exposure, but LiteLLM must still authenticate scoped virtual keys, enforce policy and hide the master key. Defense in depth also includes provider projects, egress restrictions and negative tests.

What must be rolled back together?

Image, database schema/state, configuration, aliases, provider registry, pricing, key/budget policy, edge routes and alert/test revisions form one release. Restoring only the container can preserve or create an incompatibility.

Does the gateway make generated answers safe?

No. It controls access, routing, limits and observability. Applications still need grounding, validation, tool authorization and human review appropriate to the consequence of generated output.

Recovery

Rollback

Drain the candidate, restore the complete last accepted image/configuration/policy/model-registry/price/edge revision, and use the compatible database state. If migration is not backward compatible, restore the verified pre-change database, rotate or preserve credentials as required, reconcile key/budget/audit changes made after the snapshot, and run security plus financial acceptance before reopening.

  1. Stop promotion, remove candidate replicas from routing, preserve redacted logs, request IDs, provider IDs, migration evidence and current database snapshot for analysis.
  2. Determine whether baseline replicas are schema-compatible. If yes, restore baseline configuration and route only synthetic traffic; if no, enter the reviewed database-restore procedure.
  3. Restore the verified pre-change PostgreSQL artifact into isolation first, validate schema, virtual-key revocations, budgets, spend/audit history and secret references, then perform the controlled production cutover.
  4. Restore the exact baseline image digest, edge routes, alias/provider registry, routing, price, privacy, limiter and alert policies. Do not reconstruct them manually during the incident.
  5. Reconcile post-snapshot key creation/revocation, temporary budget changes and administrative events under owner approval without reactivating revoked access or erasing evidence.
  6. Run unauthenticated/expired/revoked/wrong-model tests, hard-budget concurrency, unsafe-fallback outage, privacy canaries and provider billing reconciliation before external traffic resumes.
  7. Record the failed revision and new regression fixtures; create a new release rather than mutating the rejected manifest or reusing its tag.

Evidence

Sources and review

Verified 2026-07-24Review due 2026-10-22
LiteLLM Proxy deployment documentationofficialLiteLLM virtual keys documentationofficialLiteLLM routing and load balancing documentationofficialLiteLLM fallback management documentationofficialLiteLLM logging documentationofficialLiteLLM metrics documentationofficialLiteLLM Docker image security documentationofficialLiteLLM database migration troubleshootingofficialLiteLLM v1.93.0 official releaseofficial