← Back to AI Infrastructure

LiteLLM

Open-source AI gateway and Python SDK to call hundreds of LLM services using a unified OpenAI-compatible format.

AI InfrastructureFree tier + paidGlobal★ 1.4

At a Glance & Reviews

PricingFree tier + paid
OriginGlobal
Community Score★ 1.4 / 5 (8)

About LiteLLM

LiteLLM is an open-source model gateway maintained by BerriAI. It addresses the problem of organizations connecting to multiple large models at once, where API formats, key issuance, spend tracking, and access control are each handled separately. It consolidates these into a self-hosted gateway layer: applications face a single OpenAI-compatible interface, and switching models only requires a configuration change.

It comes in two forms. One is a Python library that unifies calls to different providers inside a single application into one completion function; the other is a proxy gateway deployed independently for multiple applications and teams to share, with virtual keys, spend tracking, and an admin interface. Team-level governance generally uses the latter, while quick integration for personal projects generally uses the former.

According to official website figures, one OpenAI-compatible interface connects to more than 140 providers and 1,800 models. The documentation homepage, however, says more than 100 providers. The two figures differ because their counting scopes and update times differ; when actually connecting, use the provider list in the documentation as the reference. Common sources include OpenAI, Anthropic, Azure, AWS Bedrock, Google's Vertex AI and Gemini, Mistral, Cohere, Hugging Face, Ollama, and various self-hosted inference services.

What gets unified is not just the request format: the official documentation emphasizes that every provider's response is converted into the OpenAI chat completion format, and errors are likewise mapped to OpenAI exception types, so existing error-handling code can be reused. Streaming responses follow the same unified chunk structure, so business code does not need a separate parser for each provider.

The speed of support for new models is a point it emphasizes: the official website states that models can be available on their release day, so platform teams do not need to wait for individual business units to upgrade dependencies. An organization's internally fine-tuned and self-hosted models can also be connected to the same gateway, sharing the same key and statistics conventions as external models.

The key system is the core of the gateway. Administrators issue virtual keys rather than distributing providers' real keys to teams, and a key can be restricted by team, project, and application to the models it may access, combined with single sign-on for identity management. Real keys are kept centrally on the gateway side and can also integrate with an organization's existing secrets management tools.

Budgets and rate limits are set at multiple levels. According to the official website, hard budgets can be set per key, team, organization, and even per model, with daily and monthly resets, along with two types of limits—requests per minute and tokens per minute—beyond which requests are blocked outright. The official website also notes that limits and leak protection prevent a runaway task or a leaked key from inflating the bill.

Spend visibility is relatively granular: usage and spend can be broken down by key, user, team, organization, tool, agent, and MCP, among other dimensions. The admin interface shows each team's spend against its budget, and in enterprise scenarios this supports internal cost allocation, attributing every request to a specific team and business unit.

Routing and cost optimization are another set of capabilities: it can load-balance across multiple providers, regions, and keys, and can also route requests by cost to a cheaper deployment capable of handling them. Automatic routing splits traffic by prompt difficulty, sending simple requests to cheaper models and difficult ones to more capable models, with the specific strategy set by administrators in configuration.

Caching and prompt compression are also built into the gateway. Response caching and semantic caching support backends such as Redis, S3, and GCS, so identical questions do not require repeated paid calls, while prompt compression reduces token counts before sending. These features suit customer service and Q&A businesses with high call volumes and frequently repeated questions.

Guardrail policies run before and after requests. The directions listed on the official website include sensitive information redaction, prompt injection detection, and secret detection. The admin interface shows the block and pass status of each guardrail, allowing security teams to configure policies centrally before opening model access to business units, while every request also leaves an audit trail.

The gateway's scope is no longer limited to language models: both the official website and documentation note that agents and MCP services can be accessed through the same gateway—that is, model, agent, and tool entry points sit behind a single login and the same permission set, without needing a separate agent gateway.

Observability is integrated through callbacks: the documentation describes a one-line configuration that sends inputs and outputs to external observability tools such as Langfuse, MLflow, and Helicone, with custom callbacks also available to tally the cost of each call. This suits teams that already have a monitoring stack and simply want the gateway to forward data to it.

Getting started with the library-only form is lightweight: in a Python project, run uv add litellm to install it, set the environment variable key for the corresponding provider, and call completion specifying the model as provider plus model name, with return values consumed directly in OpenAI format. There is also a leaner litellm-core distribution for in-application calls that do not need the gateway CLI and admin interface; the two cannot be installed at the same time.

When setting up a team gateway, follow the official quickstart: run the official one-click script or use a container to launch the full gateway and admin interface, or start the proxy from the command line—for example, starting with litellm plus a model parameter makes the proxy listen on local port 4000, after which the OpenAI client's API address can be pointed at that port and called with a virtual key.

Gateways spanning multiple models and providers are generally managed with a configuration file: in config.yaml, model_list declares each public model name alongside the provider model, API address, and other parameters it actually points to. The proxy is launched with this configuration file, and subsequent model adjustments usually only require editing this file, while the admin interface is used to create keys, view spend, and change team settings—suited to daily operations where editing the configuration file each time is undesirable.

For deployment, the official website lists official container images, Helm charts, and Terraform modules, supporting deployment within an organization's own cloud or even in a fully isolated network environment, with data and logs remaining in the organization's own infrastructure. This is also the main difference from hosted aggregation services in terms of compliance.

One typical scenario is a company centrally issuing virtual keys and capping budgets per team, allowing the platform team to see each team's spend on each model. A second is applications performing failure fallback and load distribution across multiple models, automatically switching to a backup deployment when the primary provider fails. A third is connecting tools such as coding assistants to the gateway so they can only use approved models and leave a complete record.

Regarding pricing, the open-source gateway itself is free, with the official website marking the self-hosted version as available at zero cost long-term; users only bear the infrastructure costs of their own servers, databases, and similar resources. The Enterprise edition has no public pricing: according to the official website, pricing is based on annual gateway request volume, deployment architecture, and support needs, not charged per token, with quotes available through sales or cloud marketplace channels and a 30-day Enterprise trial key available for validation first.

The difference between the Enterprise and open-source editions lies mainly in governance and support. The open-source edition already includes gateway capabilities such as multi-provider access, virtual keys, budgets, rate limits, and logs, while the Enterprise edition adds single sign-on and fine-grained permissions, audit logs, security integrations, and technical support with response-time commitments—generally what organizations needing compliance audits pay for.

On licensing, its open-source boundaries deserve attention: the repository's license notes state that code outside the enterprise directory is licensed under the MIT license, while code under the enterprise directory is subject to a separate enterprise license. Evaluations should not treat the entire repository as a single license, especially for secondary development involving enterprise features, where this clause should be read carefully first.

Compared to hosted aggregation services, LiteLLM's difference is that the gateway runs in the organization's own hands, with real keys and call logs never leaving the internal network, and rules adjustable through source code and configuration—but deployment, upgrades, databases, and high availability are all the team's own responsibility. Compared to integrating with each provider in business code, it extracts adaptation, routing, and statistics from the business logic, at the cost of long-term maintenance of this infrastructure layer; for projects with very small call volumes and a single model source, using the library form or direct connections is often simpler.

Frequently Asked Questions

Is LiteLLM free?

Partly. LiteLLM has a free tier; higher limits or advanced features are paid. Check the official site for current plans and limits.

Sign in to Lumo

Sign in with a one-time code sent to your email — no password. Your saved tools will sync across your devices.

The code is only used to sign you in. We store just your email and saved list (privacy policy, in Chinese).

—

Signed in. Your saved tools sync across all your devices.

0saved
View saved tools

Send feedback

Found a mistake, missing something, or have a suggestion? Tell us.