LiteLLM in open-source AI tools: one gateway for 100+ model providers in 2026
What LiteLLM does
LiteLLM comes in two forms. The Python SDK lets code call litellm.completion(model="anthropic/claude-...", messages=...) and get an OpenAI-shaped response regardless of provider. The proxy server wraps the same logic in an HTTP API that any language or app can call.
The proxy is the part most self-hosted setups use. It adds:
- Virtual keys. Issue a key per user, team or app, with its own model access list and budget.
- Budgets and rate limits. Daily or monthly spend caps and requests-per-minute limits per key, user or team.
- Routing and fallbacks. Send
gpt-defaultto one model and fall back to another on errors, timeouts or rate limits; spread load across several deployments. - Spend tracking. Store every request's cost in Postgres and show it in the admin UI.
- Caching. Return stored answers for repeated prompts, using Redis or other backends.
- Logging. Send traces to Langfuse, OpenTelemetry tools, Datadog and others.
- Guardrails and MCP gateway. Run content checks and expose MCP tools to models with rate limits.
Which directory projects use it
| Project | Relationship |
|---|---|
| LiteLLM | The gateway itself |
| Portkey AI Gateway | Alternative gateway written in TypeScript with a hosted control panel |
| Bifrost | Alternative gateway written in Go, focused on low overhead |
| LLM Gateway | Alternative open-source gateway with a hosted option |
Chat apps such as LibreChat, Open WebUI and LobeChat connect to LiteLLM as an OpenAI-compatible endpoint, which is a common way to give them access to Bedrock, Vertex or Azure models they do not support directly.
Setting up the proxy
- Write a
config.yamllisting models:
model_list:
- model_name: claude
litellm_params:
model: anthropic/claude-opus-5-5
api_key: os.environ/ANTHROPIC_API_KEY
- model_name: local
litellm_params:
model: ollama_chat/llama3.1:8b
api_base: http://ollama:11434
- Run the Docker image with the config mounted, a
LITELLM_MASTER_KEY, and aDATABASE_URLpointing at Postgres if you want keys and spend tracking. - Open the admin UI at
/ui, create virtual keys and teams, and set budgets. - Point apps at
http://your-proxy:4000with a virtual key.
Redis becomes necessary when you run more than one proxy instance, so rate limits and budgets are shared.
Releases and stability
LiteLLM moves fast. The v1.105 and v1.106 lines in autumn 2026 added support for Claude Sonnet 5.5 and Haiku 5.5, a Decisions API, an agent() helper, a standalone Rust service for some components, and rate limits for the MCP gateway. Fast releases mean new models are supported within days, but also that upgrades occasionally break things. Pin a version in production, read release notes before upgrading, and test on a staging proxy first. The project publishes stable tags separately from nightly builds.
Gateways compared
| Gateway | Language | License | Strength |
|---|---|---|---|
| LiteLLM | Python | MIT core, commercial enterprise folder | Widest provider coverage, budgets, admin UI |
| Portkey AI Gateway | TypeScript | MIT | Fast edge deployments, hosted observability option |
| Bifrost | Go | Apache 2.0 | Very low added latency at high request rates |
| LLM Gateway | TypeScript | Open core | Hosted dashboard with self-host option |
| OpenRouter | Hosted only | Proprietary | No infrastructure, one bill for hundreds of models |
LiteLLM is the default when you need breadth and budget controls. Teams with very high throughput or strict latency budgets look at Bifrost. Teams that want no servers at all use OpenRouter.
Costs
LiteLLM itself is free. Running it needs a small container (1 to 2 vCPUs and 2 to 4 GB of memory handles most teams), a Postgres database for keys and spend logs, and Redis if you run several instances. On a cloud provider that is roughly $20 to $80 a month. The savings usually come from what it enables: routing simple requests to cheaper models, caching repeated prompts, and catching runaway spend through budgets before the monthly invoice.
A budget plan for a team rollout
A typical setup for a 50-person company giving staff access to several models:
| Group | Models allowed | Monthly budget per user |
|---|---|---|
| Everyone | Mid-priced model, local model | $10 |
| Engineering | Above plus Opus-class model | $50 |
| Data team | Above plus long-context model | $75 |
| Automations (service keys) | Small fast model only | $200 per key |
Create a team per group in the admin UI, attach models and budgets, and issue each person a virtual key, or connect LiteLLM to your identity provider with the enterprise SSO feature. Budgets reset on the schedule you set, and requests over budget return an error the chat app shows to the user. Review the spend report after the first month and adjust; most companies find a small number of heavy users account for most of the cost.
Observability
LiteLLM records cost and tokens but not the full content of conversations by default. For tracing prompts, responses and agent steps, connect a callback to Langfuse, an OpenTelemetry collector, or another logging tool. Set this up before a rollout, because debugging a bad answer is far easier when you can see the exact prompt the model received. Be deliberate about what you store: conversation logs may contain personal data and fall under the same retention rules as email.
Security
Treat the proxy as a vault, since it holds every provider key your company uses. Run it on a private network, put the admin UI behind single sign-on or a VPN, rotate the master key, and give each app its own virtual key so one leak does not expose everything. Keep provider keys in environment variables or a secret manager such as Infisical rather than in config.yaml. LiteLLM's release pipeline was compromised twice in 2026. On March 24, versions 1.82.7 and 1.82.8 on PyPI carried a credential stealer for about 40 minutes, traced to a compromised Trivy dependency in its CI. On October 21, a malicious v1.107.0 reached PyPI for about two hours and the Docker tags v1.107.0, latest, main-latest and main-stable for about two and a half hours; LiteLLM told users to pin 1.106.2. If you pulled either during those windows, LiteLLM's advice is to assume every key the host could reach was stolen, rebuild the environment and rotate all provider keys, the master key and the database password. Pin exact versions or image digests, never deploy from latest, and subscribe to the project's security advisories.
Common problems
- Spend logs grow fast. Every request is a row. Set retention or move logs to a separate store on busy deployments.
- Model names differ by provider. Use LiteLLM aliases so apps request
defaultorfast, and change the real model in one place. - Streaming quirks. Some providers stream tool calls differently; test agents that rely on tool calls after any upgrade.
- Exposed admin UI. Protect
/uiand the master key; anyone with it can create keys with unlimited budgets.
Related: OpenAI API stack, Anthropic API stack, Langfuse stack, Redis stack, Stack index.
Frequently asked questions
What is LiteLLM used for?
It sits between your apps and model providers. Apps send OpenAI-style requests to LiteLLM, and it forwards each one to the right provider, converts the response back, records the cost, enforces budgets and retries on failure. Teams use it to give many people access to many models through one key system.
Is LiteLLM free?
The library and proxy are MIT-licensed and free to self-host, including virtual keys, budgets, fallbacks and the admin UI. The Enterprise edition, in a separate folder under its own license, adds SSO, audit logs, advanced guardrails and support.
Do I need LiteLLM if I only use one provider?
Probably not at first. It becomes useful when you add a second provider, need per-user spending limits, want automatic fallback when a provider is down, or need one place to see costs across apps.
Was LiteLLM hacked?
Its release pipeline was. Malicious packages were published on March 24, 2026 (versions 1.82.7 and 1.82.8) and on October 21, 2026 (version 1.107.0 and several Docker tags). Each was pulled within hours. Anyone who installed them should rebuild and rotate every credential the host could reach. LiteLLM advised pinning 1.106.2 after the October incident.
How fast is LiteLLM?
The Python proxy adds a few milliseconds per request under normal load, which is small next to model response times. At very high request rates, Go or Rust gateways such as Bifrost add less overhead. LiteLLM has added a standalone Rust service for some components in 2026.
Can LiteLLM work with Ollama?
Yes. Add a model with the ollama/ or ollama_chat/ prefix and the api_base of your Ollama server. You can then mix local and hosted models behind one endpoint, with fallbacks from one to the other.