API errors
OpenAI-compatible errors include an error object with message, type, param, and code. Anthropic errors use a top-level type: "error", an error object with type and message, and a request_id.
| Status | OpenAI-compatible code | What to check |
|---|---|---|
| 400 | invalid_json, invalid_request, unsupported_parameter, model_required, invalid_pagination |
Validate the payload, model ID, or query. Responses needs stateless input. |
| 401 | invalid_api_key |
Verify your key is active and sent to the correct Inference origin. |
| 402 | billing_required |
Check that usage billing is active in the Inference dashboard. |
| 403 | permission_denied |
Check whether the selected model accepts the request. |
| 404 | model_not_found, not_found |
Check the model ID and the endpoint path. |
| 413 | request_too_large |
Keep the request body below 64 MiB. |
| 429 | rate_limit_exceeded |
Reduce concurrency and honor Retry-After when provided. |
| 500 | internal_error |
If it recurs, contact support. |
| 502 | bad_gateway |
Retry transient failures with backoff. |
| 503 | service_unavailable |
Check Retry-After, or wait and retry with backoff. |
| 504 | gateway_timeout |
Reduce the request size or requested output and retry. |
For a failed stream, check what the client received before retrying. If your application executes tools, avoid replaying work that already completed.
