Model or dataset
BerriAI/litellm avatar
BerriAI/litellm

LiteLLM: A Rust-Core AI Gateway With a Python SDK and a Proxy That Speaks OpenAI

Self-hosted AI gateway with a Rust core and Python SDK that calls 100+ LLM providers in OpenAI format, adding cost tracking, guardrails, and load balancing.

58,797 stars11,463 forksPythonLicense varies

At a glance

What is it?
LiteLLM is a self-hosted AI gateway that unifies 100+ LLM providers behind one OpenAI-compatible interface. Its Rust core and Python SDK make it a candidate for teams that want to swap providers without rewriting code, but the maintenance surface is large.
Who is it for?
Adopt LiteLLM if your team needs a single OpenAI-compatible interface across many providers and wants self-hosted control over keys, spend, and routing. The Python SDK is a low-friction way to start, and the proxy adds centralized governance for production.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What LiteLLM Actually Solves

LiteLLM attacks a specific pain: every LLM provider ships its own SDK, auth pattern, request schema, and error format. A team that wants to use OpenAI for one task and Anthropic for another ends up maintaining multiple client libraries and translation layers. LiteLLM collapses that into one interface. You call completion() with a model string like openai/gpt-4o or anthropic/claude-sonnet-4-20250514, and the library handles the provider-specific details. The project positions itself as an AI Gateway, which means it can run as a standalone proxy server, not just as a library. That proxy gives you virtual keys, spend tracking, guardrails, load balancing, and an admin dashboard. The target user is a developer or platform team that manages multiple LLM integrations and wants a single control point for access and cost.

The Rust Core and Python SDK Split

The repository description says Rust core with Python SDK, but the README leads with Python examples. The primary language listed is Python. That mix is worth understanding. The proxy server, which handles high-throughput routing, is where the Rust core matters. The README claims 8ms P95 latency at 1k RPS, citing benchmarks in the docs. That number is a project claim, not something I verified. The Python SDK is the entry point for most users. You import litellm, set environment variables for API keys, and call completion(). The SDK is the thin layer; the proxy is the heavy service. For a small script, the SDK is enough. For a team, you deploy the proxy and point your OpenAI client at it. The split means you can start with the SDK and later add the proxy without changing your application code, since both accept the same model strings.

Getting It Running: SDK and Proxy Commands

The README gives two concrete paths. For the Python SDK, install with uv add litellm, then set API keys as environment variables. The example sets OPENAI_API_KEY and ANTHROPIC_API_KEY, then calls completion(model="openai/gpt-4o", messages=[...]). The model prefix tells LiteLLM which provider to route to. For the proxy, the README shows uv tool install 'litellm[proxy]' followed by litellm --model gpt-4o. That starts a server on port 4000. You then use a standard OpenAI client with base_url="http://0.0.0.0:4000" and any api_key string. The proxy accepts the OpenAI format, so existing OpenAI SDK code works unchanged. The README also points to a Docker quick start and a full E2E tutorial in the docs. The commands are straightforward, but the proxy has more configuration surface: virtual keys, model routing, and spend limits all live in the proxy config, not in the SDK call.

Beyond Chat: A2A Agents and MCP Tools

LiteLLM is not just chat completions. The README documents support for A2A agents and MCP tools. A2A is a protocol for agent-to-agent communication. LiteLLM provides an A2AClient in the Python SDK and lets you register agents in the proxy. The example shows connecting to an agent at http://localhost:10001 and sending a SendMessageRequest. The proxy exposes agents under /a2a/my-agent with a virtual key for auth. MCP (Model Context Protocol) is a different integration: LiteLLM can load tools from an MCP server and expose them in OpenAI format, so any LLM can use those tools. The README shows experimental_mcp_client.load_mcp_tools(session=session, format="openai"). This is a notable expansion beyond a simple gateway. It means LiteLLM is trying to be the connective tissue for the whole LLM ecosystem, not just a request router. That ambition adds complexity, and the MCP client is marked experimental, so treat it as a preview.

A Real Limitation: The Provider Prefix and Key Management

The core abstraction is the model string with a provider prefix. That works, but it puts a burden on the developer. You must know the exact provider name and model identifier for every model you use. A typo like openai/gpt-4 instead of openai/gpt-4o will fail or route to the wrong model. The README does not show a fallback mechanism for unknown models. Also, the SDK requires API keys as environment variables. That is fine for a local script, but in a production service, you do not want keys scattered in the environment. The proxy addresses that with virtual keys, but then you are running a separate service with its own auth and config. For a single-developer project with one provider, LiteLLM is overkill. The abstraction layer adds a prefix to every model call, and if you never switch providers, that prefix is pure overhead. The wrong tool is any project where the provider set is fixed and small.

The Alternative: Provider SDKs or a Hand-Rolled Adapter

The direct alternative is to use each provider's native SDK. OpenAI has its own Python client, Anthropic has its own, and so on. That approach gives you full access to provider-specific features like streaming options, tool schemas, or response formats that LiteLLM might abstract away. The cost is that you write and maintain your own translation layer. A lightweight alternative is to write a thin adapter class that maps a common request format to each provider's SDK. That gives you the same unification without the Rust core or the proxy server. The difference is in maintenance: LiteLLM tracks provider API changes for you, but you inherit its release cycle and its abstraction choices. A hand-rolled adapter is tailored to your exact needs but requires you to update it whenever a provider changes its API. For a team with one or two providers, the native SDKs are simpler and more transparent. For a team with ten providers, LiteLLM's unified interface starts to pay off.

Maintenance and Upgrade Cost

The release cadence is aggressive. The repository shows v1.100.0-dev.2 pushed on 2026-08-28, with v1.99.0-rc.1 a few days earlier. That suggests weekly or more frequent releases. For a proxy that sits in your request path, that means constant review of changelogs and regression testing. The project is under active development, which is good for features but bad for stability if you cannot keep up. The default branch is litellm_internal_staging, not a stable name like main. That is a signal that the project's internal workflow is not conventional. You should pin your version and test upgrades in a staging environment before touching production. The license is listed as unknown in the repository metadata. That is a red flag for enterprise adoption. You cannot assume the license terms without checking the actual LICENSE file in the repository. The README mentions an Enterprise Tier and a Hosted Proxy, so there is a commercial layer, but the open-source license terms are not stated in the README.

Who Should Adopt It and What to Verify First

LiteLLM is a good fit for a platform team that manages LLM access for multiple internal teams and wants to enforce spend limits and key rotation from one place. The proxy's virtual keys and admin dashboard are concrete features that address real governance problems. The Python SDK is a reasonable starting point for a prototype. Before committing, verify three things. First, confirm the license by reading the LICENSE file in the repository; the metadata does not state it. Second, check the docs for the exact list of supported providers and confirm your models are there. The README names Bedrock, Azure, OpenAI, Anthropic, VertexAI, vLLM, and Nvidia NIM, but the full list is in the docs. Third, run your own load test against the proxy. The 8ms P95 claim is a benchmark, not a promise. If your traffic is low and your provider list is fixed, skip LiteLLM and use the native SDKs. If you need to support many providers and centralize control, this project is worth a trial, but treat the fast release cycle as a cost you must budget for.

Editorial conclusion

Adopt LiteLLM if your team needs a single OpenAI-compatible interface across many providers and wants self-hosted control over keys, spend, and routing. The Python SDK is a low-friction way to start, and the proxy adds centralized governance for production. Do not adopt it if you only use one provider and need minimal moving parts, or if you cannot commit to keeping pace with a project that pushes releases weekly. Before adopting, verify the license, which the repository metadata does not state, and confirm the provider list covers the exact models you use. Also test the proxy's latency against your own workload; the 8ms P95 claim is a benchmark from the project, not a guarantee for your network. Start with the SDK, then add the proxy only when you need virtual keys or team-wide logging.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Community notes

Community notes