Error reference (401, 402, 429, 5xx)
What each FluxRouter error code means: 401 auth, 402 spend ceiling, 429 rate limit, 5xx upstream, and how to fix each one.
FluxRouter returns standard HTTP status codes with an OpenAI-compatible JSON error body. Use this page to map a code to a cause and a fix.
Quick reference
| Code | Meaning | Most common cause | Fix |
|---|---|---|---|
| 401 | Unauthorized | Missing or invalid key | Send your sk-... key as Authorization: Bearer |
| 402 | Payment required | Account spend ceiling reached | Add funds or raise your plan ceiling |
| 429 | Too many requests | Rate limited | Back off and retry with exponential backoff |
| 5xx | Server error | Transient upstream or gateway error | Retry the request with backoff |
Every error body follows the OpenAI error shape:
{
"error": {
"message": "Incorrect API key provided.",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
The Anthropic-compatible endpoint returns the Anthropic error shape instead, with a top-level type of error and an error object inside it. The status codes and meanings below apply to both.
Full status reference
Read the message field for the specific reason. The most common cases:
| Status | What it means | What to do | Retry? |
|---|---|---|---|
| 401 | Key missing, expired, or malformed | Regenerate the key in the dashboard; send it as Authorization: Bearer (or x-api-key on the Anthropic path) | Yes, with a valid key |
| 402 | Monthly credit used up | Top up or upgrade on the billing page | Next cycle |
| 402 | Hourly safety limit hit | Wait for the retry_after window or slow your request rate | After retry_after |
| 402 | Plan does not include this model yet | Upgrade your plan | On upgrade |
| 402 | Premium routing needs a payment method | Add a card in billing | No |
| 402 | Premium routing temporarily unavailable | Retry in a few seconds, or use flux-fast / flux-standard | ~5s |
| 402 | Free allowance used up | Upgrade or connect your own provider key | Next cycle |
| 402 | Account on hold for payment review | Email billing@ferroxlabs.com | No |
| 403 | Endpoint not served | Use a supported path: /v1/chat/completions, /v1/responses, /anthropic/v1/messages, /anthropic/v1/messages/count_tokens | No |
| 429 | Rate limited | Back off and retry with exponential backoff; honor Retry-After | Yes |
| 429 | This conversation hit its limit | Start a new conversation | New conversation |
| 400 | Bad request body (malformed JSON, wrong shape, stream not a boolean) | Fix the request body | No |
| 400 | Model not recognized | Use flux-auto, flux-fast, flux-standard, flux-reasoning, or a valid pinned id | No |
| 400 | Empty prompt | Add message content | No |
| 413 | Input too long for your tier's models | Trim the history or upgrade | No |
| 413 | Request payload too large (over 32MB, usually images) | Compress or remove attachments | No |
| 502 | Upstream provider error | Retry with exponential backoff | Yes |
| 502 | Post-call processing glitch (the call may have succeeded) | Retry; if it persists, contact support with the request id | Yes |
| 503 | Service busy or in maintenance | Back off and retry; check status.fluxrouter.ai | Yes |
Why am I getting a 401?
Symptom: Every request fails with 401 and an authentication error message.
Cause: The key is missing, malformed, or not a Flux key. This includes a leftover OpenAI/Anthropic key, a typo, or a missing Authorization header.
Fix:
Send your Flux key, which starts with
sk-, as a bearer token:curl https://api.fluxrouter.ai/v1/chat/completions \ -H "Authorization: Bearer sk-..." \ -H "Content-Type: application/json" \ -d '{"model":"flux-auto","messages":[{"role":"user","content":"ping"}]}'On the Anthropic path you can use
x-api-key: sk-...instead.Confirm there is no trailing whitespace or quote characters around the key.
If you rotated the key, update it everywhere your client reads it (env var, config file, secrets store).
Why am I getting a 402?
Symptom: Requests fail with 402 after previously working.
Cause: Your account hit a spend ceiling. On the Free plan this is a hard $1 cap. On paid plans it is your account ceiling.
Fix:
- If you are on Free, you have reached the
$1cap. Add a payment method or upgrade to keep going. - If you are on a paid plan, raise your account ceiling or add funds in the dashboard.
- A
402is not a routing or model problem. Loweringmax_tokensor switching models will not clear it; the cap is per account.
Why am I getting a 429?
Symptom: Bursts of requests fail with 429.
Cause: You are sending requests faster than the allowed rate.
Fix:
- Back off and retry. Use exponential backoff (for example 1s, 2s, 4s) with jitter.
- Reduce concurrency, or add a small delay between requests in tight loops.
- A single retry after a short pause clears most transient
429s.
Why am I getting a 5xx?
Symptom: Occasional 500, 502, 503, or 504 responses.
Cause: A transient upstream model error or a gateway hiccup.
Fix:
- Retry the request with backoff. Most
5xxresponses are transient and succeed on retry. - If a specific request fails repeatedly, capture the
X-Flux-Request-Idfrom the response and contact support with that id. - Persistent
5xxon every request usually points to a malformed request body. Validate your JSON and thatmessages(orinput) is well formed.
Including the request id
For any error you escalate, include the X-Flux-Request-Id response header. It lets support locate your exact request. See Find out which model answered for how to read response headers.