API reference
Errors
Handle gateway, authentication, and upstream failures.
Requests can fail before reaching a model. The gateway may reject a missing or invalid key, a key without access to the requested model, malformed input, rate or budget limits, an unavailable model, or an upstream timeout. The HTTP status and error body are authoritative for the request that failed.
LiteLLM's OpenAI-compatible error payload typically contains an error object. Do not depend on provider-specific message text or a fixed error code across gateway upgrades.
| HTTP status | Typical cause | What to check |
|---|---|---|
400 | Invalid request or unsupported parameter | Check JSON shape and the active model's documented capabilities. |
401 | Missing, invalid, or revoked virtual key | Ask the key owner to verify the key and gateway URL. |
403 | Key is not allowed to access the model or route | Check key/team model access with the gateway operator. |
404 | Route or model alias is not configured | Confirm the path and GET /v1/models output. |
429 | Rate or budget limit | Review key limits and retry policy with the operator. |
5xx | Gateway or upstream failure | Check deployment health and request logs; retry only when safe. |
For retries, use bounded exponential backoff and a request deadline. A failed or disconnected streaming request may already have consumed compute; automatic retries can repeat work.