Skip to content

LiteLLM: 429 Rate limit exceeded for api_key

AItested on LiteLLM v1.104.2

An LLM gateway such as LiteLLM protects expensive model servers with limits per key. If a client exceeds its requests per minute it gets 429 – not because the model is overloaded, but because its key is throttled.

Symptom

Aufruf 1: 200
Aufruf 2: 200
Aufruf 3: 429
Rate limit exceeded for api_key: 7fd67576a0e2bc5fb9a77c2584e

In the course the key ci-bot gets an rpm_limit of 2 and sends three requests in quick succession (“Aufruf” = call).

Diagnosis

The key was created with rpm_limit – that is the limit that applies.

CI_KEY=$(curl -s $GW/key/generate -H "$M" -H "$J" \
  -d '{"key_alias":"ci-bot","models":["chat-small"],"rpm_limit":2}' | jq -r .key)

Causes

rpm_limitThe key's limit is reached

rpm_limit and tpm_limit on a key apply to one client. The third request within the minute gets 429.

422 / 403Other limits, other codes

An exceeded max_budget means 422 budget_exceeded, a model that is not allowed 403 key_model_access_denied. Only the rate limit returns 429.

Fix

Retry in the client with backoff – or raise the key's rpm_limit on purpose if the client needs more requests.
jq -r .error.message ~/ki-lab/tag04/r3.json | cut -c1-60

Don't: Confuse the limit on a backend deployment (rpm in litellm_params) with the one on a key – one protects the model server, the other shares it fairly between clients.

▶
Break it yourself and find it – free
LLMs on Kubernetes hands-on, Day 4: LiteLLM as a gateway with keys, budgets, model rights and rate limits.
Go to day 4 →

FAQ

Does the key stay blocked after a 429?

No, a rate limit applies per time window. A budget (422) is different – it stays blocked until budget_reset_at or until an admin raises it.

What does rpm in litellm_params do?

It limits a backend deployment; the router then falls back to another one or answers with 429 itself.

Related error patterns

More