LiteLLMLiteLLM 1.105 · Python 3.10+
Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
48 small wins to finish your pathNext lesson →

LiteLLM logoLiteLLM overview

LiteLLM is an open-source Python library and server that lets one program call more than a hundred model providers through the OpenAI request format, and adds retries, fallbacks, caching and cost tracking on top.

Last updated: 12 Oct, 2026 · LiteLLM 1.105

A language model is called over the internet. Every provider that sells one has its own request shape, its own error names and its own way of counting tokens. A program that talks to two providers carries two sets of code. LiteLLM puts one function in front of all of them, and the same package can also run as a gateway that a whole company's applications call. This course teaches both, from a single call to a gateway that a support team runs.

Who builds LiteLLM, its licence and the version used

BerriAI develops LiteLLM, and its README carries a Y Combinator W23 badge. The package metadata lists the MIT licence and calls it a library to interface with LLM API providers. The README calls it an open source AI Gateway for 100+ LLM providers. Some gateway features sit in a separate paid Enterprise tier under a commercial licence. Each lesson that touches one says so. Every example here runs on LiteLLM 1.105.0 with Python 3.10 or later.

ExampleCounting the providers this version lists
import litellm

print(len(litellm.provider_list), "entries in the provider list")
print(litellm.provider_list[0].value, litellm.provider_list[1].value, litellm.provider_list[3].value)

The list includes a few variants of one provider, such as a text-completion form of OpenAI. The count is a little higher than the number of companies. Each entry is a name that can start a model string, such as groq. Providers and keys: the model string shows how that string is read.

The problem of one provider per code path

A request to OpenAI, Google and Anthropic asks for the same thing, an answer to some messages, in three different shapes. The system prompt sits in different places. The token limit has different names. The answer is read from different fields, and a bad key is reported in different words. Why LiteLLM: one interface for every provider calls two providers directly to show the difference. It then makes the same two calls with one function.

Two ways to run LiteLLM: the SDK and the proxy

  • The SDK is the Python package. litellm.completion() runs inside your own process, so there is nothing to deploy. The Router belongs here too: it spreads calls over several deployments and handles retries, fallbacks and cooldowns.
  • The proxy is a server, started from the same package with the [proxy] extra. Applications send it requests in the OpenAI format, and it applies keys, budgets, caching and the Router for all of them. The LiteLLM documentation calls it the AI Gateway.

The gateway landscape: where LiteLLM sits places both next to the other gateways, and The words you will meet defines each term used above.

What the eight parts build

  • Why a gateway explains the problem, names the alternatives, defines the vocabulary and installs LiteLLM. It ends with Installation and setup.
  • The SDK, call by call takes one call apart: the response object, the model string, aliases, streaming, cost, exceptions, callbacks and endpoints other than chat. It starts with completion(): your first call.
  • Tools, shapes and a model of your own adds tool calling, structured output, images and sound, and a provider you write yourself. It starts with Tool calling: when the model asks for data.
  • The Router groups deployments under one name and adds routing strategies, retries, fallbacks and cooldowns. It starts with Router: model groups and deployments.
  • Paying less sends easy questions to a cheap model and caches answers in three ways. It starts with The cheap model first.
  • The gateway starts the proxy, calls it from the OpenAI client and compares the three ways to call a model. It starts with The LiteLLM proxy.
  • Running it for a company adds virtual keys, the admin UI, guardrails, observability, MCP tools and one configuration file. It starts with The gateway in a container.
  • The gateway you would run builds the gateway a support team runs, the desk application that calls it, and a morning of tickets through both. It starts with Project: the gateway a team runs.

The learning path through all 41 lessons

The learning path of the LiteLLM course in eight parts, read left to right and then down: Why a gateway, The SDK call by call, Tools shapes and a model of your own, The Router, Paying less, The gateway, Running it for a company and The gateway you would run, with every lesson listed under its part. 41 lessons in all.

Read the parts in order. The Router lessons assume the call and its errors from the SDK part, the caching lessons assume the Router, and the gateway part assumes all three.

Finding a lesson by part

PartLessons
1. Why a gatewayLiteLLM overview, Why LiteLLM: one interface for every provider, The gateway landscape: where LiteLLM sits, The words you will meet, Installation and setup
2. The SDK, call by callcompletion(): your first call, Providers and keys: the model string, Model aliases: names of your own, Streaming: the answer a piece at a time, Tokens and cost, Exceptions: one set for every provider, Callbacks: tracking every call, Endpoints beyond chat
3. Tools, shapes and a model of your ownTool calling: when the model asks for data, Structured output your code can read, Multimodal: pictures and sound in the same call, CustomLLM: writing a provider of your own
4. The RouterRouter: model groups and deployments, Routing strategies: choosing which deployment answers, Retries: trying again when a provider refuses, Fallbacks: another model group when one fails, Cooldowns: resting a failing deployment
5. Paying lessThe cheap model first, Caching responses, Cache keys, Semantic caching, Gateway caching
6. The gatewayThe LiteLLM proxy, Using the OpenAI client with the gateway, Hybrid SDK, Router and gateway, Gateway keys
7. Running it for a companyThe gateway in a container, Virtual keys: a key per application, The admin UI: seeing what the gateway did, Guardrails on every request, Observability: watching every call, MCP tools through the gateway, Fallbacks and caching in the gateway config
8. The gateway you would runProject: the gateway a team runs, Project: the desk that calls it, Project: running the desk on a morning of tickets

The models, keys and tools the examples run on

Calls go to real models. Two free keys are enough: one from Groq, for groq/openai/gpt-oss-120b and groq/openai/gpt-oss-20b, and one from Google AI Studio, for gemini/gemini-2.5-flash-lite. Installation and setup shows how to get both and makes the first call. No OpenAI key is needed anywhere. Anything that needs Docker, Redis, a database or a paid provider is shown as code. A plain line says it is not run here, and no output is claimed for it.

Who the LiteLLM course is for

  • Python developers who call more than one model provider, or expect to, and want one calling style.
  • Backend and platform engineers who need one place for keys, limits, fallbacks and spending across several applications.
  • AI engineers who build agents and want a model to be a setting they change, not code they rewrite.

What to know before starting

  • Basic Python: functions, dictionaries, imports and try with except. Python for AI covers them.
  • What an API call is: a request, a response and a key. APIs for AI covers it.
  • A terminal and a way to run a Python file or a notebook.

Reading the LiteLLM documentation alongside

The official LiteLLM documentation is the reference for everything taught here. Each lesson names the page for its topic in its Related list. The providers page lists every provider with its model strings.

Back toAll frameworks

Every expert started right here.