LiteLLM gateway is an open-source AI gateway that puts more than 100 LLM providers behind a single OpenAI-compatible API. The central question is whether one gateway can really replace a dozen provider SDKs, and the short answer is yes for most teams: if your code already speaks the OpenAI format, it can talk to Anthropic, Google, AWS Bedrock, Azure and many more through LiteLLM without changing how it sends requests.
Every new provider adds friction. Each one has its own SDK, its own authentication pattern, its own request format and its own error types, and every team that integrates two or three providers ends up maintaining glue code that nobody wants to own. LiteLLM gateway removes that glue by translating one standard request into whatever each provider expects, and translating the response back again.
Key takeaways
- LiteLLM gateway is a self-hosted, OpenAI-compatible proxy for 100+ LLM providers, under the MIT licence.
- It comes in two forms: a Python SDK for direct use and a proxy server for centralised access.
- Virtual keys, budgets and spend tracking give platform teams control without handing out provider keys.
- Built-in retries, fallbacks and load balancing keep applications running when a provider fails.
- LiteLLM adds no fee to token costs in the open-source gateway; the cost is the hosting and the upkeep.
What the LiteLLM gateway is
LiteLLM is an open-source project from BerriAI that gives you a single, unified interface to call 100+ LLMs using the OpenAI format. It exists in two forms that share the same core: a Python SDK for calling providers directly from application code, and a proxy server, often called the LiteLLM gateway, that runs as a central service for a whole team or organisation. The gateway is the form that matters most for platform engineering, because it turns provider access into a shared service instead of a per-application problem.
The proxy is a self-hosted OpenAI-compatible gateway. Any client that works with OpenAI works with the proxy with no code changes: you point it at the gateway, give it a virtual key, and name the model you want. The gateway then routes the request to the right provider, handles authentication with that provider’s real key, and returns the response in the format your client expects.
Our guide to AI gateway architecture explains the broader pattern, and LiteLLM is the most widely adopted open-source implementation of it.
The project is MIT licensed, and the open-source gateway can be used in production free of charge. There is also an enterprise tier that adds governance, security and support on top of the same code. Best for: teams using two or more LLM providers who want one API, one key system and one place to watch spend.
How requests flow through the gateway
A request arrives at the gateway in the OpenAI format, naming a model such as gpt-4o or claude-sonnet. The gateway looks up the model in its configuration, finds which provider and deployment should serve it, and translates the request into that provider’s format. The provider’s response is translated back, and your application never sees the difference.
The translation covers chat completions, embeddings, image generation, audio and more, so the same gateway serves every kind of model call your applications make.
Routing is controlled by configuration, not by code changes. The gateway supports multiple deployments of the same model, with weights, priorities and fallbacks, so you can split traffic between two providers, keep a cheaper model as a fallback for an expensive one, or route a particular team to a particular deployment. When a provider returns an error or a rate limit, the gateway can retry the request or fall back to the next deployment automatically.
That routing is also where cost control happens. Because every request passes through one place, the gateway can record exactly who called which model and how many tokens it used, and it can enforce budgets per key, per team or per project. Requests that exceed a budget are rejected at the gateway, before any provider is billed.
Best for: organisations where LLM spend is spread across teams and nobody can currently say who spent what.
Virtual keys, budgets and access control
Virtual keys are the gateway’s answer to the problem of provider keys. Instead of giving every application a real provider key, you give it a virtual key issued by the gateway. The real provider keys live in the gateway’s configuration, and the virtual key controls which models the holder may call, how much they may spend and how long the key lasts.
If a virtual key leaks, you revoke it at the gateway without touching any provider account.
Budgets attach to keys, teams and projects. A team can have a monthly spend limit, a single key can have a per-minute rate limit, and the gateway tracks usage against both. This turns cost management from a monthly surprise into a live control: the platform team sees spend accumulating in the admin UI and can act before the bill arrives, rather than explaining it afterwards.
Access control extends to model choice as well. Not every team needs access to every model, and some models carry data-handling constraints that only certain teams may accept. The gateway lets you define which keys may call which models, so the policy is enforced at the point of use instead of relying on every developer to remember the rules.
Best for: platform teams that need to give many applications LLM access without giving any of them a real provider key.
Comparing LiteLLM with other gateway options
| Option | Deployment | Main strength | Main risk |
|---|---|---|---|
| LiteLLM gateway | Self-hosted proxy, MIT licence | 100+ providers, virtual keys, spend tracking | You run and upgrade it yourself |
| LiteLLM Python SDK | Library inside your app | Zero infrastructure, same unified API | No central control or shared budgets |
| Hosted unified API | Managed service, one key | Nothing to run or maintain | Your traffic passes through a third party |
| Direct provider SDKs | One SDK per provider | Full access to each provider’s features | Glue code grows with every provider |
| Cloud provider gateway | Managed inside one cloud | Tight integration with that cloud’s tools | Weakest outside that cloud’s ecosystem |

Reliability features that matter in production
Retries and fallbacks are built into the gateway’s router. If a provider fails, the gateway can retry the request, fall back to another deployment of the same model, or fall back to a different model entirely, depending on how you configure it. This is the difference between an application that survives a provider outage and one that shows users an error page because a single API went down.
Caching cuts both cost and latency. The gateway can cache responses, so repeated identical prompts are served from the cache instead of billed again, and semantic caching extends that to prompts that mean the same thing even when the wording differs. Caching needs care: it must never serve a stale answer for a question whose answer changes, and it must never leak one user’s cached response to another.
Our guide to AI caching cost savings covers where caching pays and where it quietly breaks things.
Logging and observability come through integrations with tools such as Langfuse, MLflow and Helicone, which can be enabled with a single line of configuration. Every request through the gateway can be traced, which makes debugging far easier than chasing logs across a dozen provider dashboards. Best for: production applications where a provider outage or a cost spike must be visible within minutes, not discovered at the end of the month.
Running the gateway yourself
Deployment is straightforward at small scale: the gateway runs as a container, and a minimal setup needs only the container and a configuration file listing models and keys. Production use adds two dependencies that matter: a database, usually Postgres, for keys, budgets and usage records, and Redis for caching and rate limiting. The project publishes Terraform modules for AWS and GCP that deploy the gateway as a production-ready stack with managed database and cache services.
Upgrades deserve attention because the project releases frequently. The stable Docker images carry a -stable tag and have undergone load testing before publication, and those are the images to run in production. Pin a stable version, test upgrades in staging, and read the release notes before moving, because provider behaviour and configuration options change often in a fast-moving project.
One practical limit to plan for is that the gateway is a single control point, so it must be highly available if your applications depend on it. Run more than one replica behind a load balancer, keep the database backed up, and make sure a gateway outage degrades gracefully rather than taking every application down with it. Best for: teams with enough platform capacity to run a stateful service properly, including backups and upgrades.
LiteLLM gateway checklist
- Every application calls models through the gateway, not through direct provider keys.
- Each team and application has its own virtual key with a spend budget and rate limit.
- Real provider keys live only in the gateway configuration, never in application code.
- Fallbacks are configured for every production model, so a provider failure does not stop the application.
- Caching is enabled only where stale answers are safe, and never across users.
- Usage is logged and visible per key, per team and per model.
- The gateway runs on stable-tagged images, with more than one replica in production.
- Postgres and Redis are backed up, and a restore has been tested.
- Upgrades are tested in staging before they reach production.
- Model access policy is enforced at the gateway, not left to developer memory.
Frequently asked questions
Is LiteLLM gateway the same as the LiteLLM Python SDK?
They share the same core, but they solve different problems. The SDK is a library you call from your application code; the gateway is a server that centralises access for many applications, adding virtual keys, budgets and shared routing. Most platform teams end up running the gateway.
Does LiteLLM charge per token?
No. The open-source gateway is MIT licensed and adds no fee to your model costs; you pay the providers directly and pay for the hosting. The enterprise tier is an annual licence for governance, security and support.
How many providers does LiteLLM support?
The project describes support for 100+ LLM providers, including OpenAI, Anthropic, Google, AWS Bedrock and Azure, across chat, embeddings, image, audio and other endpoints. The exact count grows with each release, so check the supported-providers list for the version you run.
Can I use LiteLLM with self-hosted models?
Yes. The gateway supports self-hosted serving stacks alongside hosted providers, so the same API can reach a model running on your own GPUs and a model running on a provider, with routing and fallbacks between them.
What happens if the gateway goes down?
Every application that depends on it loses model access, which is why production deployments run multiple replicas behind a load balancer. Some teams also keep a direct-provider fallback for their most critical path, accepting the extra complexity in exchange for resilience.
When should I not use a gateway at all?
If you use a single provider, a single application and a small team, the gateway adds infrastructure for little benefit. Our guide to model routing cost optimisation can help you decide whether routing control is worth the operational cost at your scale.







