What is the LiteLLM proxy and where does it fit in a self-hosted AI gateway?
The LiteLLM proxy is a self-hosted AI gateway that exposes one OpenAI-compatible API in front of many model providers and self-hosted runtimes such as vLLM or Ollama. Applications call a single internal endpoint. The gateway holds provider credentials, checks each caller's key, applies model access rules, budgets and rate limits, retries or falls back when a deployment fails, and records spend and request logs. The project's README describes it as an open source AI gateway for 100+ LLMs and lists endpoints such as /chat/completions, /responses, /embeddings, /images, /audio, /batches and /rerank.
LiteLLM does not run inference. Capacity and model quality stay with the runtimes behind it. What the gateway adds is one place to decide which teams may call which models, how much they may spend and where their prompts may go.
That position makes it a high-value target, because one deployment can hold keys for every provider the organization uses. It also makes the deployment shape matter. A single container works for evaluation. Production needs PostgreSQL, Redis, controlled migrations, pinned images and egress rules. The sections below cover each of those, the split between the open-source core and enterprise features, failure behavior, upgrades and who owns what.
What components does a production LiteLLM deployment need?
A single container works for evaluation. Production adds a database, shared state and controlled migrations.
Proxy
The gateway process, configured by a config file and environment variables. The Docker quickstart mounts the config read-only at /app/config.yaml and publishes port 4000 on 127.0.0.1. The production guide says to run one worker per pod on Kubernetes and scale by pods, or to set NUM_WORKERS to the vCPU count on a single VM. Start with 1 vCPU and 4Gi memory per worker.
PostgreSQL
Stores virtual keys, users, teams, budgets and spend. Virtual keys need a database, and a request carrying one fails with 'No connected db.' when none is connected. DATABASE_URL takes the form postgresql://user:password@host:port/dbname. The production guide sets database_connection_pool_limit (default 10) and suggests proxy_batch_write_at: 60 to batch spend writes.
Redis
Shares rate-limit counters, router state and caches across instances. The production guide calls for Redis 7.0 or newer once more than one instance runs, configured with REDIS_HOST, REDIS_PORT and REDIS_PASSWORD. It also says to keep router_settings.routing_strategy set to simple-shuffle. Without shared Redis, each instance enforces limits on its own view of traffic.
Admin UI
Manages keys, teams, models and spend. Single sign-on supports Okta, Google, Microsoft and generic OIDC providers, and the provider callback is PROXY_BASE_URL/sso/callback. SSO is free for up to 5 users, and larger admin groups need an enterprise license. Treat admin access as privileged and keep the UI on an internal network.
Migrations job
Applies schema changes once per upgrade. The Helm docs enable the job by default, in data-plane mode with 4 retries, a 1800-second deadline and a 120-second cleanup delay. The production guide says to keep DISABLE_SCHEMA_UPDATE=true on serving pods and migrationJob.enabled: true, so only the job changes the schema.
Logging callbacks
Send request metadata, and optionally message content, to configured logging providers such as Langfuse. Setting turn_off_message_logging: True under litellm_settings keeps content out of those providers while spend metadata is still tracked. The production guide also recommends json_logs: true and LITELLM_LOG set to ERROR. Decide per destination what may be stored.
Which LiteLLM features are open source and which need an enterprise license?
LiteLLM is MIT-licensed outside its litellm/enterprise/ directory, per the LICENSE file. Enterprise features need a license key, and the list changes, so confirm it on the enterprise features page before committing to a design.
| Feature | Open-source core | Enterprise license |
|---|---|---|
| Admin UI single sign-on | Free for up to 5 users from v1.76.0. Supports Okta, Google, Microsoft and generic OIDC providers. | Required beyond 5 users. |
| Virtual keys, budgets and spend | Keys with model lists, max_budget, budget_duration and TPM and RPM limits, with spend tracked per key, user and team. | Key rotations, model-specific budgets per key, tag-based budgets and spend reports. |
| Guardrails | Custom guardrails that you write and configure. | Guardrails per key or team, plus built-in integrations such as llmguard_moderations, llamaguard_moderations, hide_secrets, openai_moderations, google_text_moderation, lakera_prompt_injection and aporia_prompt_injection. |
| Authentication and access control | A master key and virtual keys. | JWT authentication, role-based access control and IP-based ACLs. |
| Logging and audit | Logging to configured callbacks, with turn_off_message_logging to keep content out. | Audit logs with retention and team-based logging. |
| Secrets | Provider credentials are stored encrypted with LITELLM_SALT_KEY. | Secret manager integrations. |
| Enabling and buying | No license key is needed. | Set LITELLM_LICENSE and restart the proxy. The enterprise page offers a free 30-day trial, and purchase is through AWS Marketplace, Azure Marketplace or direct invoice. |
Which LiteLLM deployment shape fits: Docker, Kubernetes Helm chart or an isolated network?
The Docker quickstart runs docker.litellm.ai/berriai/litellm:latest with the config mounted read-only and port 4000 published to 127.0.0.1:4000. For production, pin a tested release tag or digest instead of :latest. Set NUM_WORKERS to the vCPU count and connect the proxy to PostgreSQL, because virtual keys need a database. This shape suits a pilot or a small internal team. Add Redis before running a second instance, otherwise each instance enforces rate limits on its own. Set general_settings.trusted_proxy_ranges to the load balancer's CIDR ranges, or to [] if clients connect directly. The README also lists Terraform modules for AWS and GCP that can serve as references.
The Helm docs require Kubernetes 1.25+ and Helm 3.8+, plus PostgreSQL and Redis reachable privately from the cluster. The chart is published at oci://ghcr.io/berriai/litellm/chart/litellm. By default it deploys gateway, backend and ui as separate workloads. Setting monolith.enabled: true runs a single proxy that uses only the gateway.* values. Ingress is off by default, so install an ingress controller separately. Run one worker per pod and scale by pods. Pin the image version in values instead of :latest, keep DISABLE_SCHEMA_UPDATE=true on serving pods and let the migration job apply schema changes.
The HA overview says to run at least two serving replicas on separate nodes across zones, with one shared PostgreSQL that has replication and failover, and shared Redis for rate-limit counters, router state and caches. Use /health/liveliness for process liveness and /health/readiness to gate traffic. Readiness returns 503 by default when the database is unreachable. Database connections equal instances times workers times the pool limit, and the autoscaler's maximum replicas count as instances. Compare that figure with PostgreSQL's connection limit. The blue/green guide says both sets share the database, salt key and authentication settings. Traffic weights apply to new requests, and an open stream does not move.
Mirror pinned images into an internal registry after review. The security update says GHCR images are signed with cosign from v1.83.0-nightly, so verify signatures before mirroring. Route only to internal model endpoints such as vLLM or Ollama runtimes, send logs to internal collectors and block outbound traffic except to approved providers, log destinations and the database. Set LITELLM_MODE=PRODUCTION to disable load_dotenv(). If you use Admin UI SSO, the identity provider must be able to reach the callback at PROXY_BASE_URL/sso/callback.
How do you harden LiteLLM against a supply chain attack?
Malicious litellm 1.82.7 and 1.82.8 were live on PyPI from 10:39 UTC on March 24, 2026, for about 40 minutes before PyPI quarantined them. The security update says the official Docker image ghcr.io/berriai/litellm, which pins dependencies, was not affected, and neither was LiteLLM Cloud. A clean release, v1.83.0, followed on March 30, 2026 through a new CI/CD v2 pipeline. The remediation steps are to rotate all secrets on affected systems, check site-packages for litellm_init.pth, and check for outbound traffic to models.litellm[.]cloud or checkmarx[.]zone.
Pin exact version tags and never run :latest in production. Deploy from the official images, verify the cosign signature, mirror them internally after review and promote through staging. Keep unrelated credentials off the gateway host. Restrict outbound traffic to approved providers, log destinations and the database. That limits what a compromised dependency could reach.
Keep the master key in a secret manager. It must start with sk- and is set as LITELLM_MASTER_KEY or general_settings.master_key. Set LITELLM_SALT_KEY before adding models and never change it, because stored provider credentials become unreadable otherwise. Create virtual keys through /key/generate, one per application, with an explicit model list, max_budget, budget_duration, tpm_limit and rpm_limit. Values above upperbound_key_generate_params return HTTP 400, so set ceilings as well as defaults.
Decide what logs may contain. The turn_off_message_logging setting keeps prompts and responses out of logging providers while spend metadata is still tracked. A request can send "no-log": true to skip logging, and global_disable_no_log_param: True blocks that parameter. Set request_timeout to 600 instead of the 6000-second default, and set set_verbose to False.
How do LiteLLM retries, fallbacks and cooldowns change where data goes?
Reliability rules change where a request ends up, so each needs a data-handling review and a test.
Retries
Each model group is retried a set number of times. Keep counts low enough that clients do not time out first, and compare the total retry time with the request_timeout you set. Test with a failing endpoint and watch what the calling application receives, including how long it waits before an error returns.
Fallbacks
After retries fail, requests move to the next model group. A fallback from a private model to a public provider moves data outside your boundary, so approve each path in writing. Record every approved fallback in the model and provider register, and test that no unapproved path exists.
Cooldowns
A deployment that exceeds its allowed failures per minute leaves rotation for a cooldown period. Traffic then concentrates on the remaining deployments, which can raise latency and spend there. Alert on cooldowns so the platform team sees a failing runtime before users report it.
Context window fallbacks
Oversized requests can move to a larger-context model when pre-call checks are on. Confirm that the larger model is approved for the same data class, and that its provider terms and data location match the original. Include an oversized request in your test set to prove the path works.
How do you back up, upgrade, roll back and recover LiteLLM?
Back up PostgreSQL, which holds keys, teams, budgets and spend. The rollback guide says to use pg_dump -F c, or a snapshot on managed databases. Store the salt key and master key separately with the same retention, because a restored database without the original salt key cannot decrypt its stored provider credentials. Keep the config file and Helm values in version control, with secrets referenced and never committed.
The upgrade guide says to back up the database, pin versions, rehearse on a migrated copy of production and run one migration job with the target image before rollout. Its Helm example sets maxUnavailable: 0, maxSurge: 1, terminationGracePeriodSeconds: 650, GRACEFUL_SHUTDOWN_TIMEOUT 610 and a 10-second preStop sleep, assuming a 600-second request limit. Stable versions are plain numbers such as 1.84.0, release candidates publish as 1.x.xrcN and nightlies as 1.x.x.devN. Since the week of November 2, 2026, release candidates and stable releases ship on Tuesday mornings, and each Tuesday promotes the previous week's candidate to stable.
An image rollback does not undo migrations. Restoring a database snapshot requires downtime and can lose writes made since the snapshot. On Helm, roll back with helm rollback followed by the release name and an optional revision number, and never change LITELLM_SALT_KEY. Before any upgrade, test representative keys, models, fallbacks and spend records, and keep the previous tag available.
Who owns each part of a LiteLLM gateway?
The gateway sits between application teams, model owners and security, so each group owns a distinct part of it. Named owners keep key, budget and fallback decisions from falling between teams.
Platform team
- Run the proxy, PostgreSQL, Redis and the migrations job.
- Monitor latency, errors, cooldowns and database connections.
- Pin, verify and promote new versions through staging.
- Run backups and rehearse upgrades and rollbacks.
AI or model owners
- Approve models, providers and fallback paths.
- Set budgets and rate limits per team.
- Review provider terms and data locations.
- Keep the model and provider register current.
Security
- Hold the master key, salt key and provider credentials.
- Review egress rules and logging settings.
- Track the project's security advisories.
- Decide what prompts and responses may be logged.
Application teams
- Use one virtual key per application and environment.
- Handle rate-limit and fallback responses.
- Report unexpected spend or model behavior.
- Request new models or budget changes through the model owners.
LiteLLM deployment questions
Do we need PostgreSQL and Redis to run LiteLLM in production?
Use PostgreSQL for virtual keys, teams, budgets and spend. A request with a virtual key fails with 'No connected db.' when no database is connected. A config-only proxy shares the master key across every caller and should not reach production. Add Redis 7.0 or newer once more than one instance runs, so rate-limit counters and router state are shared. A pilot on one instance can start without Redis.
Is LiteLLM open source under the MIT license?
Mostly. The LICENSE file says everything outside the litellm/enterprise/ directory is MIT-licensed, copyright 2023 Berri AI. Content under litellm/enterprise/ follows its own license, which the README calls the LiteLLM Commercial License. The pyproject.toml on the main branch also lists the package license as MIT. Check your planned features against the enterprise list before the design is final.
What does the LiteLLM enterprise license add, and how is it enabled?
The enterprise page lists Admin UI SSO beyond the free tier, JWT authentication, audit logs with retention, role-based access control, IP-based ACLs, key rotations, secret manager integrations, tag-based budgets, model-specific budgets per key, spend reports, team-based logging and guardrails per key or team. Set LITELLM_LICENSE and restart the proxy. The page offers a free 30-day trial and purchase through AWS Marketplace, Azure Marketplace or direct invoice.
Does LiteLLM SSO with Okta work without a license?
For small groups, yes. The SSO docs say SSO is free for up to 5 users from v1.76.0, and an Enterprise license is required beyond that. Admin UI SSO supports Okta, Google, Microsoft and generic OIDC providers. Set the client variables such as GENERIC_CLIENT_ID, GOOGLE_CLIENT_ID or MICROSOFT_CLIENT_ID, set PROXY_BASE_URL, and register PROXY_BASE_URL/sso/callback as the callback with the identity provider.
How does turn_off_message_logging keep prompts out of logs?
Set turn_off_message_logging: True under litellm_settings. Message content then stays out of logging providers while request metadata such as spend is still tracked, per the logging docs. A request can also send "no-log": true to disable logging for that call, and global_disable_no_log_param: True blocks that parameter. Check each log destination's own retention as well, since every destination applies its own.
How does LiteLLM compare with Langfuse?
LiteLLM routes and controls requests. Langfuse stores traces, prompts and evaluations. LiteLLM can send request logs to Langfuse through a callback, and both can run in the same private network. The gateway enforces keys, budgets and routing, and Langfuse gives teams a place to review traces. If you send message content to Langfuse, apply the same logging decision you made for the gateway.
How do LiteLLM budgets and rate limits work per virtual key?
Create a key with the /key/generate endpoint, using the master key as a Bearer token. The virtual keys docs list the parameters models, max_budget, budget_duration, tpm_limit and rpm_limit. Set default_key_generate_params for defaults and upperbound_key_generate_params for ceilings. Values above a ceiling return HTTP 400 rather than being reduced. Issue one key per application and environment so spend and limits trace to one owner.
What does DeployOpen deliver for a LiteLLM gateway, and what is handed over?
DeployOpen deploys LiteLLM inside your cloud account, data center or isolated network. We connect approved providers and private model runtimes, configure PostgreSQL, Redis and migrations, integrate SSO within your license, restrict egress and set logging to match your data policy.
We document the platform, plan and test upgrades, and can provide ongoing support. Upgrade planning follows the rehearsal pattern described above: a staging copy of production, representative keys, models, fallbacks and spend records, and a known rollback path.
Handover includes the model and provider register with approved fallbacks, the key and budget structure, pinned versions with the image verification step, egress rules, logging settings, the backup and key escrow procedure, and named owners for each operating area. AI and LLM security testing of the gateway and its applications is a separate engagement.
Sources and further reading
- LiteLLM proxy production guidance ↗
- LiteLLM enterprise features ↗
- LiteLLM security update, March 2026 ↗
- LiteLLM license ↗
- LiteLLM GitHub README ↗
- LiteLLM pyproject.toml ↗
- LiteLLM Docker quickstart ↗
- LiteLLM virtual keys docs ↗
- LiteLLM Helm docs ↗
- LiteLLM logging docs ↗
- LiteLLM Admin UI SSO docs ↗
- LiteLLM HA overview ↗
- LiteLLM upgrade guide ↗
- LiteLLM rollback guide ↗
- LiteLLM blue/green guide ↗

