Once a team has two models, three providers, and five scripts that ask an LLM something, the zoo begins: every provider has its own SDK, error format, and limits, and keys end up scattered across configs so nobody remembers who has which anymore. LiteLLM — the open-source AI gateway (MIT license, BerriAI project) — closes this with a single entry point: 100+ providers are called through the OpenAI-compatible format, and on top of that come virtual keys, budgets, and an admin panel. I break down what the gateway really gives an engineer — and where it's already packaged into a ready-made image.
The problem: two providers = two SDKs
While all traffic goes to a single OpenAI API, there's no problem. Then providers appear:
- second provider — different message format, error codes, and auth method;
- local models (vLLM, Ollama) — again, a different way to connect;
- dozens of scripts, agents, and services — each needs a key, and no one is ready to answer for its limit;
- the question "how much do we spend on models" remains rhetorical.
The gateway solves all of this with one move: applications talk only to it, in OpenAI format, and the gateway knows who to forward a request to, what to do on timeout, and where to record costs.
Two forms: library and gateway
LiteLLM exists in two flavors, and you shouldn't confuse them:
| Python SDK | AI Gateway (proxy) | |
|---|---|---|
| What it is | A library in your code: completion(model="anthropic/claude-...", ...) | A separate service with a single endpoint for the whole team |
| For whom | A developer of a specific application | The platform team: one gateway for all services and scripts |
| Key feature | Router with retry/fallback between deployments | Virtual keys, budgets, admin panel, logs |
This post is about the second flavor: the gateway. The SDK is useful, but exactly until there's more than one model and more than one consumer.
What the gateway gives the team
- Single OpenAI-compatible API.
/v1/chat/completions,/v1/embeddings,/v1/images,/v1/audio,/v1/rerank— regardless of what's behind the gateway. Any client speaking the OpenAI format (opencode, n8n, Dify, your code) connects with a changedbase_urland key. - Virtual keys. Provider keys live in one place — in the gateway config. Apps and people get virtual keys with a label ("who this is"), a time and money limit, and can be revoked in one click.
- Budgets and cost tracking. The cost of each request is calculated with provider tariffs; limits can be set per user, per project, per key. The question "how much do we spend" stops being rhetorical — there's a dashboard with numbers.
- Router: fallback, retry, balancing. If one deployment failed — the request goes to the backup; load is balanced across several keys of the same provider; timeouts and retries are set at the gateway level, not in each application.
- Observability. Request logs, span tracking, integrations with Langfuse, MLflow, and other telemetry collectors — the same vocabulary as the rest of the observability.
- Admin panel. Keys, teams, budgets, models — managed via UI, not by editing the single config of the on-call person.
Minimal config
The gateway is described by one YAML: a list of models under aliases, routing rules, and where the master key is stored (model names are example aliases):
model_list:
- model_name: fast # alias visible to clients
litellm_params:
model: openai/gpt-4o-mini # provider/model
- model_name: smart
litellm_params:
model: anthropic/claude-3-5-haiku
- model_name: local # your model on the same shelf
litellm_params:
model: ollama_chat/llama3.2
router_settings:
fallbacks: [{"fast": ["local"]}] # OpenAI unavailable — fall to local
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY # the key is not in git
After this, the client doesn't see the gateway as different from the real OpenAI:
curl http://litellm.internal:4000/v1/chat/completions \
-H "Authorization: Bearer $LITELLM_VKEY" \
-H "Content-Type: application/json" \
-d '{"model": "fast", "messages": [{"role": "user", "content": "hi"}]}'
The same focus works for agent tooling: opencode, CI scripts, custom services — all get the same base_url and their own virtual key. Switching providers is a gateway config change, not edits to twenty repos.
When the gateway pays off
Here's my honest checklist — two coincidences are enough:
- More than one provider or deployment (including local models);
- More than one consumer: services, scripts, agents, colleagues;
- There's a "how much do we spend" question that needs numbers;
- Switching providers shouldn't turn into a release of everything that talks to an LLM;
- Provider keys shouldn't live in every second config.
If you have exactly one provider and one app — the gateway will be an unnecessary hop without value.
It's already in the AI marketplace of Selectela
You don't have to assemble anything yourself: the LiteLLM image is already available in the Selectela AI marketplace — LiteLLM Virtual Machine. This is a pre-configured cloud server where Docker and Docker Compose, nginx as reverse proxy, and PostgreSQL for gateway state sit next to the gateway. From the docs:
- Working with models via the OpenAI-compatible interface;
- Virtual keys with limits on validity and spend;
- Cost tracking per request and budgets per user, project, or key;
- Admin panel for monitoring and management.
Server requirements are modest: 2 vCPU, 4 GB RAM, and 20 GB disk — GPU is not needed at all: the gateway cares about transport and order, not compute. Such a VM costs almost nothing and does one job well.
The next candidates on the radar — RAGFlow (turn a pile of PDF docs into what an LLM actually digests) and n8n (glue automations without code). Both are from the same catalog, and that's the beauty of the format: don't search the internet — pick from one shelf.
When the marketplace isn't needed
- You need your own build. Non-standard dependencies, your own Dockerfile, a special version — the marketplace isn't the helper here, build the image yourself.
- Serious inference load. For predictable SLA an AI platform has products above — Dedicated Inference and Token Factory; these are already about dedicated resources for models.
- Routing as a managed service. If you need smart request routing without your own LiteLLM instance — look at the AI router.
- Nobody is operating it. The image saves a build evening, not years of operations: updates, backups, availability — still your responsibility.
The conclusion is short: as soon as there are more than one model or consumer, the LLM gateway stops being an "infrastructure luxury" and turns into ordinary engineering hygiene — like an HTTP reverse proxy. LiteLLM is the most popular open option: 100+ providers out of the box, virtual keys and budgets in place, and if you don't want to assemble manually — the image already exists in the Selectela AI marketplace.
Links
- github.com/BerriAI/litellm — repository (MIT);
- docs.litellm.ai — LiteLLM Proxy (AI Gateway) — gateway docs: virtual keys, router, config;
- docs.litellm.ai — Supported Providers — table of providers and supported endpoints;
- docs.selectel.ru/ai-marketplace/litellm — LiteLLM Virtual Machine in the Selectela AI marketplace: image, server creation, GUI access;
- Release cycle — why to take docker tags with
-stable.