All articles
April 27, 2025 5 min read

LiteLLM: one OpenAI-shaped interface for a hundred providers

LiteLLM lets you call OpenAI, Anthropic, Bedrock, Gemini, and local models through one consistent format — as a library or a proxy with keys, budgets, and logging. Here's where it fits.

Written forEngineering
LiteLLMInfrastructureTooling

The more providers you use, the more their small differences bite: each SDK is shaped a little differently, each names things its own way. LiteLLM smooths that over. It gives you one OpenAI-style interface to call 100+ model providers — and, in its proxy form, a lightweight gateway with keys, budgets, and logging built in.

Two ways to use it

  • As a library — import it and call any provider with the same completion() function and the familiar OpenAI message format; switch models by changing a string.
  • As a proxy (gateway) — run it as a server your apps point at, and centralise API keys, spend limits, rate limits, fallbacks, and request logging across your whole org.
One function, any provider
from litellm import completion

# same call shape, different model strings
completion(model='gpt-4o',                   messages=msgs)
completion(model='claude-sonnet-4-20250514', messages=msgs)
completion(model='gemini/gemini-1.5-pro',    messages=msgs)
completion(model='ollama/llama3',            messages=msgs)

LiteLLM or OpenRouter?

They solve a similar problem from different angles. OpenRouter is a hosted service — you use their endpoint and billing. LiteLLM is open-source you run yourself: the library adds no hop, and the proxy is infrastructure you own, keeping your own provider keys and contracts. If you want zero-ops routing, OpenRouter; if you want control and self-hosting, LiteLLM.

When it fits

Reach for LiteLLM when you're multi-provider and want one code path, or when a team needs a shared gateway to govern spend and keys without every app hard-coding a provider. If you only ever call one model, you don't need it yet — but the day you add a second, you'll be glad it's a string change.

LiteLLM's value shows up the moment you have a second provider — it turns 'which SDK?' into 'which string?'.
Building something with LLMs?
I help teams ship GenAI that’s reliable and cost-efficient.
Let’s talk