Table of Contents
The LiteLLM proxy is an open-source LLM gateway that puts one OpenAI-compatible endpoint in front of your model providers and adds virtual keys, budgets, rate limits, load balancing, and fallbacks. You host it yourself, so provider keys live on your own servers and not inside every app.
This LiteLLM proxy tutorial is a test, not a rewrite of the documentation. We installed version 1.111.1 with pip on 1 December 2026, with no Docker, PostgreSQL for the keys, and three local model servers standing in for providers. Then we killed backends, froze one, spent a budget, and measured what the proxy adds to each request.
Two findings are worth knowing before you start. The database setup failed three times on the path the error messages suggest, and the fix is one pinned package. A provider that hangs, as opposed to one that fails, left 4 of 8 requests with no answer until we added one line to the config.
Key points
- What it is: the server half of BerriAI/litellm, which had 64,187 stars on 1 December 2026. The gateway code is MIT; a separate enterprise package is commercial.
- The install that works with a database:
pip install "litellm[proxy]==1.111.1" "prisma==0.11.0", thenprisma generate. The route the error messages point to ends in an open bug. - Keys, limits, and budgets worked: 403 outside a key’s model list, 429 over its rate limit, and 422 over its budget (one run each).
- A dead backend lost no request: 12 of 12 requests were answered with one of two backends killed, and 8 of 8 by the fallback model with both killed.
- A frozen backend is different: by default, 4 of 8 requests had no answer after 45 seconds (one run). With
timeout: 5, every request was answered in 10 runs, the unlucky ones after 5 or 10 seconds. - What it costs to run: about 8 ms per request, and 139 requests a second per worker against a stub provider. Memory is about 790 MB per worker, and about 1 GB on the first start after the install.
- The Rust core ships inside the wheel, but chat completions still run on Python in 1.111.1.
- Pin an exact version. Two malicious LiteLLM releases reached PyPI in 2026.
What is the LiteLLM proxy?
LiteLLM is two things in one repository: a Python SDK that calls many model APIs through one function, and a proxy server that the project calls its AI Gateway. Your applications talk to the proxy in the OpenAI format, and the proxy talks to the providers.
The facts as of 1 December 2026:
- Repository: BerriAI/litellm, 64,187 stars and 13,691 forks, created on 27 July 2023. Its description reads “The fastest, litest AI Gateway. Rust core with Python SDK.”
- Who makes it: Berri AI, a Y Combinator W23 company.
- Latest stable release: 1.111.1, published on 29 November 2026. Stable releases come weekly, according to the project’s release cycle page.
- Code: Python 81.3%, TypeScript 10.0%, and Rust 7.4% by bytes.
The official quick start is current. It does not give you one tested path for pip with a database, or numbers for what a client sees when a provider misbehaves. This guide adds both.
Why an LLM gateway matters
Once a second team or a second provider shows up, three questions come with them: who is spending what, what stops a runaway script, and what happens when a provider has a bad hour.
Without a gateway, each app holds a provider key and answers those questions by itself, or not at all. With one, apps hold virtual keys that you can limit and revoke, and the provider keys sit in one place. The builder gets one endpoint and one request format. The product owner gets a spend per key, a cap per key, and an answer for the day a provider is down.
Our own breakdown of the AI tech stack names LiteLLM, Kong AI Gateway, and Portkey at the gateway layer. Our LLMOps guide has a section on controlling costs.
My view after this test: the gateway features work, and they are worth having early. The pip install with a database is rougher than it should be. I would not go to production without a timeout on every deployment.
How the LiteLLM proxy works
The LiteLLM proxy has five parts, driven by one YAML file and one database.
- A model list. Each entry maps a name clients ask for, such as
chat, to a deployment: a provider, a model, and an address. Entries with the same name form a group to balance over. - A router. It picks a deployment for each request, retries on failure, and falls back to another group.
- Keys. The master key is the admin credential. Virtual keys are created through the API, stored in PostgreSQL, and carry a model list, a budget, and rate limits.
- Spend tracking. The proxy multiplies the token counts of each response by a price per token, and adds the cost to the key.
- An Admin UI at
/ui/for keys, usage, and models.
What we tested, and on what
| Part | What we used |
|---|---|
| Software | LiteLLM 1.111.1 from PyPI, installed with pip into a virtual environment |
| Machine | Ubuntu 24.04.5, x86_64, AMD Ryzen 9 9950X (32 threads), 186 GB of memory, Python 3.12.16 |
| Providers | Three Ollama 0.40.18 servers on the same machine, CPU only, serving qwen2.5:1.5b and qwen2.5:0.5b |
| Database | PostgreSQL 19.0 on 127.0.0.1 |
| Stub provider | A small server of ours that answers at once with a fixed reply, used only to measure the proxy’s own cost per request |
| Date | 1 December 2026, 00:20 to 01:05 IST; repeat runs of the frozen backend and of memory from 08:40 to 09:30 IST |
The machine is a shared lab server with no root and no Docker. Its load average ranged from 3.5 to 17 during the test, so every count below carries its sample. The Ollama servers stand in for three providers, so no API key and no paid account was used.
Three things we did not run, so you can weigh the rest:
- Docker. The project’s main documented route is its Docker image. Our lab account cannot run Docker, so nothing here describes the image. The project’s Docker quick start covers it.
- A hosted provider. No request went to OpenAI, Anthropic, Bedrock, Azure, or Vertex.
- A coding agent or an SDK. Every request came from curl or httpx. We did not point Claude Code or any other agent at the proxy.
How to set up the LiteLLM proxy step by step
This LiteLLM proxy setup uses pip and a virtual environment, because that is the route we could test.
1. Check the prerequisites
- Python 3.10 or newer, below 3.16. The package states
>=3.10, <3.16. We used 3.12.16. - PostgreSQL with an empty database, if you want keys, budgets, or the Admin UI. We used 19.0 and a database named
litellm. - At least one model provider. Ours was Ollama on the same machine.
- A platform with a prebuilt wheel. PyPI has seven wheels for 1.111.1 and no pure Python one.
2. Install a pinned version
python -m venv venv && . venv/bin/activate
pip install "litellm[proxy]==1.111.1" "prisma==0.11.0"In a clean environment, this took 26 seconds and 828 MB of disk (one run). The prisma pin is the important part, and the next section explains why.
The wheel is 48 MB, because a compiled Rust library sits inside it. Before installing, we downloaded the wheel alone and compared its checksum with the one PyPI lists:
pip download "litellm==1.111.1" --no-deps -d wheels -q
sha256sum wheels/*5ade9ddb34133670e612e9fa35576b360d54ec33eabc5e13e19636ba487ea17e litellm-1.111.1-cp310-abi3-manylinux_2_28_x86_64.whlThat digest is equal to the one PyPI gives for the same file in its file list.
3. Generate the Prisma client
prisma generate --schema venv/lib/python3.12/site-packages/litellm/proxy/schema.prismaOn a first run, this took 6 seconds, including the download of the Prisma CLI, and printed Generated Prisma Client Python (v0.11.0). Change python3.12 in the path to your Python version.
4. Write the config
This is the file we ended the test with. Save it as config.yaml.
model_list:
- model_name: chat # the name clients ask for
litellm_params:
model: ollama_chat/qwen2.5:1.5b # provider prefix / model on that provider
api_base: http://127.0.0.1:11434
timeout: 5 # seconds before this deployment counts as failed
input_cost_per_token: 0.000001 # $1 per million tokens, so spend is visible
output_cost_per_token: 0.000002
model_info:
id: ollama-a
- model_name: chat # same name again: a second deployment to balance over
litellm_params:
model: ollama_chat/qwen2.5:1.5b
api_base: http://127.0.0.1:11435
timeout: 5
input_cost_per_token: 0.000001
output_cost_per_token: 0.000002
model_info:
id: ollama-b
- model_name: small # a cheaper model to fall back to
litellm_params:
model: ollama_chat/qwen2.5:0.5b
api_base: http://127.0.0.1:11436
input_cost_per_token: 0.0000002
output_cost_per_token: 0.0000004
model_info:
id: ollama-c-small
router_settings:
routing_strategy: simple-shuffle
num_retries: 1
allowed_fails: 1
cooldown_time: 30
fallbacks:
- chat: ["small"]
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY
database_url: os.environ/DATABASE_URLWhat each part of this LiteLLM proxy config does:
- Two entries named
chatmake one group with two deployments. Theidis the label you will see in response headers. - The
ollama_chat/prefix picks the provider. With a hosted provider, themodelline changes and anapi_keyline appears, by the docs. We did not test one. timeout: 5is the line the hang test below is about.- The two cost lines give a local model a price. By the docs, a model missing from LiteLLM’s price list costs $0 per request, so a budget on it never triggers.
fallbackssends a request forchattosmallwhenchatfails after its retries.
5. Set a real master key
This is how our test made its key and pointed the proxy at the database:
printf 'sk-' > .masterkey
head -c 24 /dev/urandom | base64 | tr -dc 'A-Za-z0-9' | head -c 24 >> .masterkey
export LITELLM_MASTER_KEY=$(cat .masterkey)
export DATABASE_URL="postgresql://litellm:<password>@127.0.0.1:5433/litellm"The docs say a LiteLLM master key must start with sk-. Do not copy sk-1234 from an older tutorial. With that value, and also with no key at all, the proxy ran its database migrations and then refused to start. The message ends:
Local development only: set LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY=true, or
general_settings.dangerously_permit_weak_or_unset_master_key: true, to start anyway.The 1.104.0 release notes of 3 October 2026 list this as a breaking change.
6. Start the proxy and check it
litellm --config config.yaml --validate_config
litellm --config config.yaml --host 127.0.0.1 --port 4000The first command loads the file without starting the server, prints LiteLLM: config OK (3 models), and exits with 0. The second starts the proxy. From another terminal:
curl -s http://127.0.0.1:4000/health/liveliness
curl -s http://127.0.0.1:4000/health/readiness"I'm alive!"
{"status":"healthy","db":"connected"}Warnings appear at every start, among them one for each model with custom prices. None stopped anything.
The database on a pip install: three failed starts and a fix
With pip, litellm[proxy] alone cannot use a database, and the extra that the error message tells you to install pulls a Prisma version that 1.111.1 cannot import. Pin prisma==0.11.0 and run prisma generate yourself. Every start below used the same config and the same DATABASE_URL.

Start 1: litellm[proxy] only. The proxy exits with this message:
LiteLLM Proxy: a database URL is set but the prisma CLI is neither on PATH nor importable as a package, so the database cannot be set up. Install it with `pip install 'litellm[extra_proxy]'` or run a shipped LiteLLM image.Start 2: after pip install "litellm[extra_proxy]==1.111.1". That added 26 packages, among them prisma==0.15.0. The proxy prepared the Prisma CLI (25 seconds the first time), found 252 migrations, and applied them in about 4 seconds. Then it exited:
Exception: Unable to find Prisma binaries. Please run 'prisma generate' first.Start 3: after prisma generate. The command printed Generated Prisma Client Python (v0.15.0), and the proxy exited again:
ModuleNotFoundError: No module named 'prisma.builder'This is issue 54951, filed on 28 November 2026 against 1.111.0. Prisma 0.15 ships that module under another name. The fix, pull request 54416, was merged on 26 November and is only in a 1.113 development build. A backport was still open on 1 December. Our test shows 1.111.1 has the bug.
The published extra accepts any prisma from 0.11.0 up to 1.0, so pip takes the newest. The project’s own lock file pins 0.11.0.
Start 4: after pip install "prisma==0.11.0" on top. This failure was of our own making:
AttributeError: module 'prisma._types' has no attribute 'SortMode'The downgrade had left the client files that 0.15 generated in site-packages/prisma. If you already tried extra_proxy, clean up the way we did:
pip uninstall -y prisma
rm -rf venv/lib/python3.12/site-packages/prisma
pip install "prisma==0.11.0"
prisma generate --schema venv/lib/python3.12/site-packages/litellm/proxy/schema.prismaAfter that, the proxy started and the readiness check said "db":"connected".
Start 5: the same recipe from nothing. We repeated it with a new virtual environment, an empty home directory, and an empty database. The two commands from steps 2 and 3 were enough. The proxy was ready after 19.3 seconds on this first start, which includes applying the 252 migrations to the empty database. Then /key/generate returned 200. So extra_proxy is not needed (one run).
Three more things we saw on the way:
DATABASE_URLin the environment is enough to switch the database on. A config with nodatabase_urlline still connected and created keys.- Prisma downloads its CLI and engines on first use into
~/.cache/prisma-python. That folder was 473 MB in our clean home directory, Node’s cache included. - The docs name a different schema file, in the
litellm_proxy_extraspackage, on their pip upgrade page. We used the one underlitellm/proxyand did not try the other.
Your first request and the headers worth reading
The proxy answers on the OpenAI path. This is the first request of our test, sent with the master key:
curl -s -D headers.txt -o body.json -w 'http %{http_code} in %{time_total}s\n' \
http://127.0.0.1:4000/v1/chat/completions \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" \
-d '{"model":"chat","messages":[{"role":"user","content":"In one short sentence, what is an API gateway?"}],"max_tokens":40}'It returned 200 in 4.49 seconds, because the model was still loading. Later requests took 0.09 to 0.2 seconds for a 3 token answer. The body is in the OpenAI format:
{
"id": "chatcmpl-53076243-1d80-40f4-98ec-7f985d210deb",
"created": 1796065771,
"model": "chat",
"object": "chat.completion",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "An API Gateway is a centralized management system for APIs, which serves as an entry point for external systems to access an application's APIs.",
"role": "assistant"
}
}
],
"usage": {
"completion_tokens": 28,
"prompt_tokens": 40,
"total_tokens": 68
}
}The headers tell you what the proxy did. This is a selection from the same response:
x-litellm-model-id: ollama-a
x-litellm-model-api-base: http://127.0.0.1:11434
x-litellm-version: 1.111.1
x-litellm-response-cost: 9.6e-05
x-litellm-key-spend: 9.6e-05
x-litellm-overhead-duration-ms: 92.0022
x-litellm-model-group: chat
x-litellm-attempted-retries: 0
x-litellm-attempted-fallbacks: 0x-litellm-model-idnames the deployment that answered.x-litellm-response-costis the price of this request in dollars. Here it is 40 input tokens at $0.000001 plus 28 output tokens at $0.000002, so our custom prices were applied.x-litellm-overhead-duration-msis the proxy’s own time. It was high on this first, cold request and settled near 5 ms against the stub provider in the measurements below.- The last two count retries and fallbacks. Log them in your app.
A request with no key got 401. A wrong key got 401 with the message Authentication Error, Invalid API key provided. and the type token_not_found_in_db. With the master key, /v1/models listed chat and small.
Virtual keys: who can call what, and how much
LiteLLM virtual keys are created with the master key, and each one carries its own model list, budget, and limits. We made two:
curl -s http://127.0.0.1:4000/key/generate -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{"key_alias":"team-a","models":["chat"],"max_budget":0.0003}'
curl -s http://127.0.0.1:4000/key/generate -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{"key_alias":"team-b","models":["small"],"rpm_limit":3}'Each response holds a key that starts with sk-. Then we pushed each key past its limits, one run per row:
| What we did | Status | What the proxy said |
|---|---|---|
team-a asked for small, a model outside its list | 403 | The requested model 'small' is not available for this API key, or the model name is invalid. |
team-b sent 5 requests in a row, with a limit of 3 a minute | 200, 200, 200, 429, 429 | Rate limit exceeded for api_key: <hash>. Limit type: requests. Current limit: 3, Remaining: 0. and the header retry-after: 60 |
team-a kept asking until its $0.0003 budget ran out | 200 seven times, then 422 | Budget has been exceeded! Key=team-a (sk-...r5uw) Current cost: 0.000333, Max budget: 0.0003 |
Four details matter here.
The request that crosses the line is served. The key spent $0.000333 against a budget of $0.0003, and request 8 was the first one refused. Leave room for one request when you size a budget.
A spent budget answers 422, not 429. The error type is budget_exceeded, while a rate limit is throttling_error with 429. The 1.104.0 release notes list the move to 422 as a breaking change, so older guides that show 400 or 429 are out of date.
The spend the API reports lags. /key/info showed a spend of 0.0 three seconds after the refusal and 0.000333 a few minutes later. The refusal itself used the live figure.
Without a database, there are no keys. /key/generate returned 500 with DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string. The readiness check said "db":"Not connected".
We tested models, rpm_limit, and max_budget only. The virtual keys page and the budgets page also describe budgets that reset on a schedule, token limits, and team and user budgets. Budgets per model on a single key are marked Enterprise there.
Load balancing and fallbacks when a backend dies
When a backend refused connections, no client in our test saw an error.
Load balancing first. With routing_strategy: simple-shuffle, 40 requests to chat went 15 to ollama-a and 25 to ollama-b. It is a random pick, not round robin (one run of 40).
One of two backends killed. We stopped one Ollama server with kill, so connections were refused at once, and sent 12 requests.
- 12 of 12 were answered with 200, each in 0.08 to 0.15 seconds.
- 6 of them carry
x-litellm-attempted-retries: 1. They went to the dead backend first, then to the live one. - The first request after the kill was answered by the fallback model, with
x-litellm-attempted-fallbacks: 1. - The dead backend kept being tried for the 1.5 seconds this took. With
allowed_fails: 1andcooldown_time: 30, we did not see it taken out of rotation in this run.
Both backends killed. 8 of 8 requests were answered with 200 by the fallback model in 0.07 to 0.09 seconds.
After a restart, the next 6 requests went to the two chat backends again, with no fallback.
A fallback is visible to the client in two places: the header, and the model field of the body, which says ollama_chat/qwen2.5:0.5b where it normally says chat. LiteLLM fallbacks trade quality for availability here, because the answer came from a smaller model. Only that header tells a product owner how often it happens.
One rule from the reliability page that we did not test: a fallback never serves a model the caller’s key could not call directly. We ran these tests with the master key. By that rule, a virtual key needs the fallback group in its model list.
When a provider hangs: set a timeout
A provider that refuses connections is the easy failure. The hard one accepts the request and then says nothing. In our test, retries and fallbacks did not help with that until the config had a timeout.
We froze one of the two chat backends with kill -STOP, so it accepted connections and never answered. A client with a limit of 45 seconds then sent 8 requests.

Default settings, with no timeout in the config. 4 of 8 requests had no answer after 45 seconds. The other 4 were answered by the healthy backend in about 0.1 seconds. Nothing was retried, because nothing had failed yet (one run). In this log, 000 is curl’s code for no response:
1: 000 45.002228s deployment= retries= fallbacks=
2: 200 0.102861s deployment=ollama-a retries=0 fallbacks=0
3: 200 0.119116s deployment=ollama-a retries=0 fallbacks=0
4: 200 0.120396s deployment=ollama-a retries=0 fallbacks=0
5: 200 0.117342s deployment=ollama-a retries=0 fallbacks=0
6: 000 45.002107s deployment= retries= fallbacks=
7: 000 45.001277s deployment= retries= fallbacks=
8: 000 45.002545s deployment= retries= fallbacks=With timeout: 5 on each chat deployment. 8 of 8 requests were answered:
1: 200 0.089344s deployment=ollama-a retries=0 fallbacks=0
2: 200 0.096946s deployment=ollama-a retries=0 fallbacks=0
3: 200 10.076272s deployment=ollama-c-small retries=0 fallbacks=1
4: 200 0.164686s deployment=ollama-a retries=0 fallbacks=0
5: 200 0.133459s deployment=ollama-a retries=0 fallbacks=0
6: 200 0.115237s deployment=ollama-a retries=0 fallbacks=0
7: 200 0.124771s deployment=ollama-a retries=0 fallbacks=0
8: 200 0.106865s deployment=ollama-a retries=0 fallbacks=0The one request that reached the frozen backend took 10.08 seconds and came back from the fallback model. The requests after it all went to the healthy backend, and so did the 3 we sent after thawing the frozen one. A second run had the same shape, with one request at 10.06 seconds.
Eight more runs, about eight hours later, showed a second shape. In 5 of the 10 runs, one request waited about 10.1 seconds and the fallback answered, as above. In the other 5, two requests waited about 5.1 seconds each, and the healthy backend answered both. The retry picks a deployment at random: when it lands on the healthy one, the client waits one timeout, and when it lands on the frozen one again, two.
Either way, the frozen backend took two timeouts before it left the rotation, which fits allowed_fails: 1. After that, none of the 28 requests we sent next reached it. No request went unanswered in any of the 10 runs.
So the worst case for a client is roughly the timeout multiplied by the retries plus one: here 5 seconds twice, the first attempt plus num_retries: 1. Pick the timeout from the slowest answer you expect, and set the client’s own limit above that product.
We did not wait past 45 seconds, so we cannot say when the default would have given up.
What the LiteLLM proxy costs to run
One worker of the LiteLLM proxy took about 15 seconds to start, held about 790 MB of memory once it had served requests, and added about 8 ms to each request. Against a stub provider on our shared machine, it served 139 requests a second.
| What | Measured | Sample |
|---|---|---|
| Ready, with the database | 15.2, 15.2, 15.2, 15.7, and 16.8 seconds | five starts |
| Ready, without a database | 7.1 seconds | one start |
| Memory of one worker after start | 774 MB with the database, 751 MB without | four starts with, one without |
Memory on a clean install, first start after prisma generate | about 990 MB at ready, 1,033 to 1,064 MB after the first requests | four and five starts, one of them on a second machine |
| Memory on a clean install, later starts | 738 to 739 MB at ready, 787 to 795 MB after requests | five starts |
| Memory of one worker after about 2,300 requests | 820 to 841 MB | the latency runs below |
| Memory with four workers | 744 MB for the parent, 790 to 804 MB per worker, about 3.9 GB together | one start |
| Disk | 828 MB for the virtual environment, plus the Prisma cache | the clean install |
The first start is the heavy one. prisma generate writes a client of about 20 MB of Python source into site-packages/prisma, and the first proxy start compiles it in its own process. That start held about 250 MB more than every later one. We checked the cause by deleting the compiled files: the next start was back at about 990 MB, and the one after it at 739 MB (2 tries each way). So restart the proxy once after you install or upgrade.
For latency, a client on the same machine sent 300 sequential requests, alternating between the stub directly and the stub through the proxy. Then it sent 2,000 requests, 32 at a time. A virtual key and the database were in use, so key checks and spend logging are included.
| Setup | Direct p50 | Through the proxy, p50 / p95 / p99 | Added at p50 | 2,000 requests, 32 at a time |
|---|---|---|---|---|
| Default: uvicorn, 1 worker | 0.45 ms | 8.37 / 12.07 / 20.94 ms | 7.9 ms | 139 requests/s |
LITELLM_RUST=1 | 0.50 ms | 8.88 / 13.54 / 21.43 ms | 8.4 ms | 134 requests/s |
LITELLM_RUST_FIRST=1, run 1 | 0.79 ms | 50.34 / 53.07 / 54.93 ms | 49.6 ms | 141 requests/s |
LITELLM_RUST_FIRST=1, run 2 | 0.81 ms | 51.27 / 54.90 / 56.36 ms | 50.5 ms | 135 requests/s |
--run_granian, 1 worker | 0.46 ms | 8.26 / 11.35 / 19.14 ms | 7.8 ms | 135 requests/s |
--num_workers 4 | 0.50 ms | 9.00 / 13.21 / 18.40 ms | 8.5 ms | 360 requests/s |
No request failed in any run: 0 of 2,300 each time. Each row is one run, on a machine with a load average of 3.5 to 5.4. Read it as a measurement, not a benchmark.

What we take from the table:
- The proxy added about 8 ms per request, 7.8 to 8.5 ms in four of the setups. Its own header reports 4.6 to 4.9 ms of that. The rest is the extra HTTP hop and the client.
- Four workers gave 2.6 times the throughput of one, for about five times the memory: 3.9 GB against 774 MB.
The project’s own benchmarks page gives about 100 requests a second per four-worker pod for 1.110.0. Its setup is not ours.
Next to a model call, 8 ms is small. The memory is what I would plan for: the project’s production page says to start load testing with 1 vCPU and 4 GiB per worker.
What the Rust core does in 1.111.1, and what it does not
The repository now describes itself as a “Rust core with Python SDK”. For chat completions on 1.111.1, that changed nothing we could measure.
In the version we installed:
- The Rust library is inside the wheel, as the file
litellm/rust_bridge/_native.abi3.so, 54,557,584 bytes on disk. - Chat completions are marked Python only. In
litellm/rust_bridge/catalog.pyof the installed package, the rules readCHAT_COMPLETIONS: PYTHON_ONLY,EMBEDDINGS: PYTHON_ONLY, andRESPONSES: PYTHON_ONLY. - Rust is required for three things there: OCR, the Anthropic-style messages route for the
anthropicandazure_aiproviders, and Bedrock transcription. - By the release notes, the router runs on Rust since 1.110.0, and budgets are held by a Rust engine since 1.111.0.
What the two switches did in our test:
LITELLM_RUST=1gave 8.4 ms against 7.9 ms, inside the noise of a shared machine. That fits the rules above.LITELLM_RUST_FIRST=1starts a Rust binary,litellm-gateway, on port 4000, with the Python proxy behind it. Sequential requests then took about 50 ms where they had taken 8 (2 runs of 300), and throughput under load stayed the same. We did not investigate the cause.
The 1.111.0 release notes call that second mode “a supervised opt-in Rust forwarding server on the public port”, and say “Python still handles every request”.
The speed claims belong to another setup. The project’s launch post of 22 June 2026 reports about 0.05 ms of overhead for a thin Rust forwarding gateway, and says itself that this is not a full production workload.
My advice for 1.111.1: leave both switches off, and measure again after each upgrade.
What the proxy contacts on the network
A default start with a database contacted two outside hosts, and with two environment variables it contacted none. We traced the whole process tree with strace.
The two hosts:
raw.githubusercontent.com, by the proxy itself. It fetches the model price list from themainbranch of the repository.checkpoint.prisma.io, by the Prisma CLI that the proxy runs for migrations. It is Prisma’s own update check.
No traced start asked DNS for telemetry.litellm.ai, license.litellm.ai, or any other LiteLLM host.
To stop both calls, we started the proxy with these two variables:
export LITELLM_LOCAL_MODEL_COST_MAP=True
export CHECKPOINT_DISABLE=1The trace then showed 0 outside connections and 0 outside DNS names, through 20 idle seconds and one request (one run).
The price list comes from main at every start, so the price of a known model can change between two starts of the same version. In our first traced start, the fetch timed out, and the proxy fell back to its local copy. The first variable above pins prices to the installed version.
We did not trace the Admin UI in a browser. The project’s outbound requests page says the UI fetches from docs.litellm.ai and api.github.com, and that a password login checks api.pwnedpasswords.com with the first five characters of the password’s hash. It also describes one switch for the proxy’s own calls, LITELLM_OFFLINE_MODE, which we did not test.
The Admin UI
The Admin UI is at /ui/ on the proxy’s address, and it needs the database. We signed in as admin with the master key as the password.
It has pages for virtual keys, usage charts per model and per key, and the deployments from the config. The key list shows each alias, a masked value such as sk-...r5uw, and spend against budget.
A banner says Environment-credential login is enabled. The UI page explains how to replace the master key login with a real admin user.
Supply chain history: why you pin an exact version
LiteLLM had two release compromises in 2026, and both hit people who took the newest release on the day it appeared.
- March 2026. Malicious versions 1.82.7 and 1.82.8 were on PyPI on 24 March, for about 40 minutes by the project’s own account. They carried a credential stealer. Snyk’s write-up puts the window at about three hours.
- October 2026. A malicious 1.107.0 was on PyPI for about 2 hours on 21 October. This time the Docker tags
v1.107.0,latest,main-latest, andmain-stablewere compromised too, by the project’s incident post. Socket analysed the wheels the same day.
None of the three versions is on PyPI today. The repository’s advisories page also lists 30 published advisories for the proxy, one more reason to stay on a current stable release.
What follows for an install:
- Pin an exact version. The project recommends pinning to the latest stable release. A proxy holds every provider key you give it, so a floating version is a real risk.
- Let a release age a few days when you can. Both incidents were caught within hours, and ours was not yet two days old.
- A checksum proves less than it seems. Our wheel matched PyPI’s digest, which shows we got the file PyPI lists. Snyk notes that the March packages were published with real credentials, so a checksum would not have flagged them.
- For Docker, the project’s image security guide covers signature checks and pinning by digest. We did not test it.
Licence and pricing: is LiteLLM free?
The self-hosted gateway is free to use, and the gateway code is MIT. There is one thing to read first.
The repository’s LICENSE file holds two rules. Everything outside litellm/enterprise/ is MIT. That folder falls under a separate enterprise licence, which asks for a paid licence in production and allows copying and modifying for development and testing.
It matters on a pip install. In our environment, the proxy extra installed litellm-enterprise==0.1.86.post1 next to litellm. PyPI lists litellm as MIT and that package as proprietary. By the docs, its features are switched on by a licence key, and we used none. I am not a lawyer. If that package matters to your compliance team, show them both files.
On price, the project’s pricing page read like this on 1 December 2026:
- Open Source: “$0”, “Free forever · self-hosted”. It lists virtual keys, spend tracking, budgets and rate limits, and fallbacks as included.
- Enterprise: no public price, “Talk to sales”. It adds SSO and SCIM, audit logs, secret managers, and support with service levels.
The enterprise docs add one limit the pricing page leaves out: SSO is free for up to 5 users. The features we tested here (keys, budgets, rate limits, fallbacks, and spend tracking) are on the free list.
LiteLLM vs OpenRouter and other LiteLLM alternatives
LiteLLM vs OpenRouter is a choice between running software and buying a service. With LiteLLM you run a server and a database, pay the project nothing, and keep the provider keys. With OpenRouter you send requests to its servers and pay it.
OpenRouter’s pricing page, read on 1 December 2026, bills inference at the provider’s list price and charges its fee when you buy credits: 5.5% on the Standard plan. With your own provider keys, the first $25,000 of inference a month carries no fee, and 5% applies after that. Those keys are stored on OpenRouter’s side.
The open-source LLM gateway field is wider than these two. We tested none of the others, so every figure below is from each project’s own repository on 1 December 2026.
| Gateway | How you run it | Language and licence | GitHub stars | Worth knowing |
|---|---|---|---|---|
| LiteLLM | Self-hosted | Python with a Rust core, MIT plus an enterprise licence | 64,187 | Tested here at 1.111.1 |
| OpenRouter | Hosted service | Not a self-hosted project | n/a | Fee on credit purchases, by its pricing page |
| Bifrost | Self-hosted | Go, Apache-2.0 | 10,127 | Its README claims 11 µs of overhead per request at 5,000 requests a second |
| Portkey gateway | Self-hosted core, hosted product | TypeScript, MIT | 13,466 | Latest release 1.15.2 on 12 January 2026 |
| Kong with AI plugins | Self-hosted, with commercial plugins | Lua, Apache-2.0 | 44,433 | Six AI plugins are open source; the advanced ones are Enterprise |
| Respan gateway | Self-hosted, managed version | Rust, Apache-2.0 | 1,154 | Created on 25 September 2026 |
On speed, be careful with every number you find. Most published comparisons are run by a vendor whose product is in the test, including LiteLLM’s own. Our research found two by individuals with no stated vendor tie:
- cuihuan/llm-gateway-bench, 30 November 2026: Bifrost 0.57 ms, Portkey 1.27 ms, and LiteLLM 1.111.1 6.62 ms of overhead per request.
- LF3551/ai-gateway-benchmark, 22 October 2026: Kong 0.85 ms, Portkey 1.73 ms, and LiteLLM 1.106 3.82 ms at the median.
Those are in the range of our 7.9 ms. The Python proxy adds single-digit milliseconds at low load, and compiled gateways add less.
When to use the LiteLLM proxy, and when not
Use it when:
- Several teams or apps share provider accounts, and you want a key, a budget, and a rate limit for each.
- You want a fallback model for the hour a provider is down, and a header that tells you when it was used.
- Provider keys must stay on servers you control.
Think twice when:
- One app talks to one provider. A gateway is one more service to run.
- Nobody on the team will own PostgreSQL, upgrades, and security advisories for it.
- You would rather pay a fee than operate anything.
- Your request rate is high enough that 8 ms and about 139 requests a second per worker decide the design. Measure first.
And where a team would call us: putting a gateway into production means pinned and verified releases, a database with backups, timeouts and fallbacks tuned per provider, and spend alerts that someone reads. That is the MLOps work we do at HyScaler. The proxy is one process; the operations around it are where the care goes.
Limits and gotchas
The short list, each one from our test unless marked:
sk-1234as the master key stops the proxy from starting. So does no key.pip install "litellm[proxy]"alone cannot use a database. Withextra_proxyon 1.111.1, pip pulls a Prisma version the proxy cannot import, andprisma generatehas to be run by hand.- A spent budget answers 422, and the request that crosses the line is served.
- A local model has no price, so a budget does nothing until you set the two cost lines (from the docs).
- Fallbacks do not protect against a provider that hangs unless a timeout is set.
- The first start after
prisma generateholds about 250 MB more than later starts. Restart once. - A fallback changes the model silently unless your app reads the header or the
modelfield. - The price list is fetched from GitHub at every start unless you set
LITELLM_LOCAL_MODEL_COST_MAP=True.
What we did not test
Docker and the project’s image. Any hosted provider, and the Anthropic-style messages route. Streaming, caching, Redis, several proxy instances, Kubernetes, SSO, guardrails, and the MCP gateway. The Enterprise features, TLS, a public address, and throughput against a real model. Claude Code, any other coding agent, and any SDK.
Frequently asked questions
Is LiteLLM free?
Yes, for the self-hosted gateway. The project’s pricing page lists Open Source at $0, “Free forever”, with virtual keys, spend tracking, budgets, rate limits, and fallbacks included. Enterprise adds SSO, audit logs, and support, at a price you get from sales. You still pay for your servers and your providers.
How do I set the LiteLLM master key?
Put a random value that starts with sk- in the LITELLM_MASTER_KEY environment variable, and reference it from the config file. Do not reuse the sk-1234 key that older tutorials show. In our test of version 1.111.1, the proxy refused to start with that value, and also with no master key at all.
Does the LiteLLM proxy need a database?
Not to route requests. Without a database, our proxy started in 7 seconds and answered chat requests sent with the master key. It needs PostgreSQL for virtual keys, budgets, spend logs, and the Admin UI. Without one, creating a key returned HTTP 500.
How do I run the LiteLLM proxy with Docker?
We did not test Docker, because our lab account cannot run it, so this guide shows no Docker command. The project documents its image in a Docker quick start and an image security guide. Its docs say the image bundles Prisma, so the pip database problems described here should not apply to it.
What is the difference between LiteLLM and OpenRouter?
LiteLLM is software you host: your servers, your provider keys, no fee to the project, and the work of running it. OpenRouter is a hosted service: your requests go through its servers, and you pay it. Its pricing page on 1 December 2026 gave a fee of 5.5% on credit purchases for the Standard plan.
Does the LiteLLM proxy work with Claude Code?
We did not test it, so we cannot confirm any Claude Code setup on version 1.111.1. Claude Code’s documentation has a page on LLM gateways, and LiteLLM has an Anthropic-style messages route. Our test used only curl and httpx against the chat completions route.
Is the LiteLLM proxy written in Rust?
Partly. Version 1.111.1 ships a compiled Rust library inside the wheel, and the release notes say the router and the budget engine run on it. In the installed code, chat completions, embeddings, and responses are still marked Python only. In our test, neither Rust switch made chat completions faster.
Which LiteLLM version should I install?
Install an exact version, never whatever is newest that day. Two malicious releases reached PyPI in 2026: 1.82.7 and 1.82.8 in March, and 1.107.0 in October. The project recommends pinning to the latest stable release. We tested 1.111.1 and compared the wheel’s SHA-256 with the one PyPI lists.
How much latency does the LiteLLM proxy add?
About 8 ms per request in our test of version 1.111.1. The median was 8.37 ms through the proxy against 0.45 ms direct, over 300 sequential requests to a stub provider, with key checks and spend logging on. One worker handled 139 requests a second, and four workers handled 360.
Watch the video
The video shows the same test in under three minutes: the pinned install, a spent budget, a killed provider, and a frozen one. It was recorded on a second lab machine, so its request times are a little slower.
The video goes live on the HyScaler YouTube channel with this guide.
Try it
Start without a provider bill. Install the pinned pair from step 2, run two small local models behind the config above, and create one key with a tiny budget. Then stop a backend, and after that freeze one. Watching a request hang for 45 seconds teaches more than any settings page.
The code and the issue tracker are at github.com/BerriAI/litellm.
References
- BerriAI/litellm on GitHub, README, licence files, and source at tag v1.111.1 (read 1 December 2026)
- litellm 1.111.1 on PyPI, the wheels and their digests
- LiteLLM docs: quick start, Docker quick start, production, virtual keys, budgets, reliability, error reference, and outbound requests
- Release notes for 1.111.0, 1.110.0, and 1.104.0
- Issue 54951, the Prisma 0.15 start failure, with pull requests 54416 and 55038
- The project’s posts on the March 2026 and October 2026 incidents
- Independent write-ups: PYSEC-2026-2 on OSV, Snyk, and Socket
- Migrating LiteLLM to Rust, 22 June 2026, and the project’s benchmarks page
- LiteLLM pricing and OpenRouter pricing, both read 1 December 2026
- cuihuan/llm-gateway-bench and LF3551/ai-gateway-benchmark, two gateway comparisons by individuals