Skip to content
LiteLLM proxy tested: version 1.111.1 as a self-hosted LLM gateway added about 8 ms per request in our run

Insight // LLM

LiteLLM Proxy Tutorial: A Self-Hosted LLM Gateway, Tested

Nov 30, 2026 31 min read

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", then prisma 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.

  1. 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.
  2. A router. It picks a deployment for each request, retries on failure, and falls back to another group.
  3. 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.
  4. Spend tracking. The proxy multiplies the token counts of each response by a price per token, and adds the cost to the key.
  5. An Admin UI at /ui/ for keys, usage, and models.

What we tested, and on what

PartWhat we used
SoftwareLiteLLM 1.111.1 from PyPI, installed with pip into a virtual environment
MachineUbuntu 24.04.5, x86_64, AMD Ryzen 9 9950X (32 threads), 186 GB of memory, Python 3.12.16
ProvidersThree Ollama 0.40.18 servers on the same machine, CPU only, serving qwen2.5:1.5b and qwen2.5:0.5b
DatabasePostgreSQL 19.0 on 127.0.0.1
Stub providerA small server of ours that answers at once with a fixed reply, used only to measure the proxy’s own cost per request
Date1 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.whl

That 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.prisma

On 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_URL

What each part of this LiteLLM proxy config does:

  • Two entries named chat make one group with two deployments. The id is the label you will see in response headers.
  • The ollama_chat/ prefix picks the provider. With a hosted provider, the model line changes and an api_key line appears, by the docs. We did not test one.
  • timeout: 5 is 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.
  • fallbacks sends a request for chat to small when chat fails 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 4000

The 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.

Five starts of the LiteLLM proxy with PostgreSQL on a pip install: four fail, and the pinned prisma 0.11.0 works
Each row is one start of the proxy, with what was installed and what it printed.

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.prisma

After 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_URL in the environment is enough to switch the database on. A config with no database_url line 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_extras package, on their pip upgrade page. We used the one under litellm/proxy and 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: 0
  • x-litellm-model-id names the deployment that answered.
  • x-litellm-response-cost is 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-ms is 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 didStatusWhat the proxy said
team-a asked for small, a model outside its list403The 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 minute200, 200, 200, 429, 429Rate 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 out200 seven times, then 422Budget 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: 1 and cooldown_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.

One frozen backend: with default settings 4 of 8 requests got no answer in 45 seconds, with timeout 5 all 8 were answered
Request times from our logs. The run with the timeout is the first of ten.

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=0

The 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.

WhatMeasuredSample
Ready, with the database15.2, 15.2, 15.2, 15.7, and 16.8 secondsfive starts
Ready, without a database7.1 secondsone start
Memory of one worker after start774 MB with the database, 751 MB withoutfour starts with, one without
Memory on a clean install, first start after prisma generateabout 990 MB at ready, 1,033 to 1,064 MB after the first requestsfour and five starts, one of them on a second machine
Memory on a clean install, later starts738 to 739 MB at ready, 787 to 795 MB after requestsfive starts
Memory of one worker after about 2,300 requests820 to 841 MBthe latency runs below
Memory with four workers744 MB for the parent, 790 to 804 MB per worker, about 3.9 GB togetherone start
Disk828 MB for the virtual environment, plus the Prisma cachethe 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.

SetupDirect p50Through the proxy, p50 / p95 / p99Added at p502,000 requests, 32 at a time
Default: uvicorn, 1 worker0.45 ms8.37 / 12.07 / 20.94 ms7.9 ms139 requests/s
LITELLM_RUST=10.50 ms8.88 / 13.54 / 21.43 ms8.4 ms134 requests/s
LITELLM_RUST_FIRST=1, run 10.79 ms50.34 / 53.07 / 54.93 ms49.6 ms141 requests/s
LITELLM_RUST_FIRST=1, run 20.81 ms51.27 / 54.90 / 56.36 ms50.5 ms135 requests/s
--run_granian, 1 worker0.46 ms8.26 / 11.35 / 19.14 ms7.8 ms135 requests/s
--num_workers 40.50 ms9.00 / 13.21 / 18.40 ms8.5 ms360 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.

LiteLLM proxy 1.111.1 measured: about 8 ms added per request in four setups, about 50 ms with LITELLM_RUST_FIRST
Stub provider, virtual key, database on. 300 sequential requests for latency, 2,000 at 32 concurrent for throughput.

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.py of the installed package, the rules read CHAT_COMPLETIONS: PYTHON_ONLY, EMBEDDINGS: PYTHON_ONLY, and RESPONSES: PYTHON_ONLY.
  • Rust is required for three things there: OCR, the Anthropic-style messages route for the anthropic and azure_ai providers, 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=1 gave 8.4 ms against 7.9 ms, inside the noise of a shared machine. That fits the rules above.
  • LITELLM_RUST_FIRST=1 starts 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:

  1. raw.githubusercontent.com, by the proxy itself. It fetches the model price list from the main branch of the repository.
  2. 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=1

The 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, and main-stable were 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.

GatewayHow you run itLanguage and licenceGitHub starsWorth knowing
LiteLLMSelf-hostedPython with a Rust core, MIT plus an enterprise licence64,187Tested here at 1.111.1
OpenRouterHosted serviceNot a self-hosted projectn/aFee on credit purchases, by its pricing page
BifrostSelf-hostedGo, Apache-2.010,127Its README claims 11 µs of overhead per request at 5,000 requests a second
Portkey gatewaySelf-hosted core, hosted productTypeScript, MIT13,466Latest release 1.15.2 on 12 January 2026
Kong with AI pluginsSelf-hosted, with commercial pluginsLua, Apache-2.044,433Six AI plugins are open source; the advanced ones are Enterprise
Respan gatewaySelf-hosted, managed versionRust, Apache-2.01,154Created 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:

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-1234 as the master key stops the proxy from starting. So does no key.
  • pip install "litellm[proxy]" alone cannot use a database. With extra_proxy on 1.111.1, pip pulls a Prisma version the proxy cannot import, and prisma generate has 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 generate holds about 250 MB more than later starts. Restart once.
  • A fallback changes the model silently unless your app reads the header or the model field.
  • 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