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

CodeMeaningMost common causeFix
401UnauthorizedMissing or invalid keySend your sk-... key as Authorization: Bearer
402Payment requiredAccount spend ceiling reachedAdd funds or raise your plan ceiling
429Too many requestsRate limitedBack off and retry with exponential backoff
5xxServer errorTransient upstream or gateway errorRetry the request with backoff

Every error body follows the OpenAI error shape:

json
{
  "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:

StatusWhat it meansWhat to doRetry?
401Key missing, expired, or malformedRegenerate the key in the dashboard; send it as Authorization: Bearer (or x-api-key on the Anthropic path)Yes, with a valid key
402Monthly credit used upTop up or upgrade on the billing pageNext cycle
402Hourly safety limit hitWait for the retry_after window or slow your request rateAfter retry_after
402Plan does not include this model yetUpgrade your planOn upgrade
402Premium routing needs a payment methodAdd a card in billingNo
402Premium routing temporarily unavailableRetry in a few seconds, or use flux-fast / flux-standard~5s
402Free allowance used upUpgrade or connect your own provider keyNext cycle
402Account on hold for payment reviewEmail billing@ferroxlabs.comNo
403Endpoint not servedUse a supported path: /v1/chat/completions, /v1/responses, /anthropic/v1/messages, /anthropic/v1/messages/count_tokensNo
429Rate limitedBack off and retry with exponential backoff; honor Retry-AfterYes
429This conversation hit its limitStart a new conversationNew conversation
400Bad request body (malformed JSON, wrong shape, stream not a boolean)Fix the request bodyNo
400Model not recognizedUse flux-auto, flux-fast, flux-standard, flux-reasoning, or a valid pinned idNo
400Empty promptAdd message contentNo
413Input too long for your tier's modelsTrim the history or upgradeNo
413Request payload too large (over 32MB, usually images)Compress or remove attachmentsNo
502Upstream provider errorRetry with exponential backoffYes
502Post-call processing glitch (the call may have succeeded)Retry; if it persists, contact support with the request idYes
503Service busy or in maintenanceBack off and retry; check status.fluxrouter.aiYes

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:

    bash
    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 $1 cap. 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 402 is not a routing or model problem. Lowering max_tokens or 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 5xx responses are transient and succeed on retry.
  • If a specific request fails repeatedly, capture the X-Flux-Request-Id from the response and contact support with that id.
  • Persistent 5xx on every request usually points to a malformed request body. Validate your JSON and that messages (or input) 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.