Loading
Loading
If a model’s provider returns 429 or 5xx, the API tries another route. A substitution is always visible in the response headers, and you can turn it off.
The next option is tried on provider responses 408, 425, 429 and 5xx, on network failures, and on 401, 402 and 403 from the provider — those concern our key with the provider, not yours. Errors 400, 404 and 422 aren’t retried: they would be the same everywhere.
| Header | Value |
|---|---|
| x-maxai-fallback-from | id of the model you requested |
| x-maxai-model | id of the model that answered |
If the requested model answered, these headers are absent. You’re charged for the model that actually answered: it costs no more than the requested one, so the hold on your balance covers it.
raw = client.chat.completions.with_raw_response.create( model="mistralai/mistral-nemo", messages=[{"role": "user", "content": "Hello!"}],)print(raw.headers.get("x-maxai-model")) # the model that answeredprint(raw.headers.get("x-maxai-fallback-from")) # the model you asked for, if a fallback was used
Send the X-MaxAI-Fallback: never header (off, no, false and 0 also work), and the request goes only to the requested model. Other routes of the same model stay in use.
curl https://llmproxy.org/v1/chat/completions \ -H "Authorization: Bearer $LLMPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "X-MaxAI-Fallback: never" \ -d '{"model": "mistralai/mistral-nemo", "messages": [{"role": "user", "content": "Hello!"}]}'
Every /v1 response carries the x-maxai-request-id header, including 401 and 402. You can send your own x-request-id (8–128 characters: letters, digits, ., _, -) and it comes back as is. Once the balance hold is placed, x-maxai-request-id is the row id in GET /v1/billing/usage. Include it when you contact .
Without streaming, the amount comes in the x-maxai-charged-cents and x-maxai-charged-usd headers. In a stream the headers are already sent, so the amount comes as an SSE comment : maxai-charged-cents <number> after the last frame.