One API for 100+ LLM providers · OpenAI-compatible · router / fallbacks / proxy · verified against LiteLLM 1.x (2026)

LiteLLM cheat sheet

LiteLLM gives you a single, OpenAI-shaped interface to call 100+ providers — OpenAI, Anthropic, Gemini, Bedrock, Azure, Groq, Ollama and more — by just changing the model string. Same request format, same response object (response.choices[0].message.content), everywhere. Use it as a Python SDK (completion()), a Router for load-balancing/fallbacks across deployments, or a standalone proxy gateway. This sheet targets LiteLLM 1.x.

core calls streaming / async providers & params router / reliability cost / proxy gotcha most common

Verified 2026-08-24 against the official docs at docs.litellm.ai (LiteLLM 1.x). Responses follow the OpenAI schema; the same code runs against any supported provider by swapping the model prefix.

Outline

Learn completion() once; it works for every provider. Reach for the Router when you need failover/load-balancing, and the proxy when non-Python apps need a gateway.

Call

  1. 1 · Install & completion()
  2. 2 · Messages, params, response
  3. 3 · Streaming & async
  4. 4 · Embeddings & more

Providers

  1. 5 · Provider prefixes
  2. 6 · Keys & provider params

Reliability

  1. 7 · Router — load balance
  2. 8 · Fallbacks & retries

Ops

  1. 9 · Cost, caching, callbacks
  2. 10 · Proxy gateway
  3. 11 · Gotchas
  4. Worth memorizing

Call Any Model

One function, OpenAI-shaped, for every provider.

1Install & completion()the one call
2Messages, params, responsethe request
3Streaming & asyncnon-blocking
4Embeddings & moreother endpoints

Providers & Params

The model prefix routes the call; keys and quirks per provider.

5Provider prefixesprovider/model
6Keys & provider paramsconfig

Router & Reliability

Load-balance across deployments and fail over automatically.

7Router — load balancingmany deployments
8Fallbacks & retriesfailover

Cost, Observability & Proxy

Track spend, add logging, and expose a gateway for other apps.

9Cost, caching, callbacksobservability
10Proxy gatewayOpenAI-compatible server

Gotchas

The cross-provider surprises.

!Common gotchasread before shipping

Worth memorizing

one call, any providercompletion(model="provider/name", messages=...) with an OpenAI-shaped response
prefix picks the backendopenai/ anthropic/ gemini/ bedrock/ azure/ ollama/ ...
response is always OpenAI schemar.choices[0].message.content; r.usage.total_tokens
stream=True yields deltaschunk.choices[0].delta.content — same for every provider
acompletion / aembeddingasync twins of the sync calls
drop_params=True for portabilityquietly drop params a provider doesn't support
Router = load balance + failovermodel_list, fallbacks, retries, cooldowns, cost tracking
completion_cost + callbacksper-call spend; one-line Langfuse/Prometheus/OTel logging
proxy = OpenAI-compatible gatewaylitellm --config; point any OpenAI SDK at it