Errors
Errors are returned in your ingress format’s native error shape with the correct
HTTP status code. Upstream provider failures are mapped to a stable taxonomy — the
code values below never change meaning, so you can switch models and providers
without rewriting error handling.
Error envelopes per format
Chat Completions / Responses
OpenAI-format requests get the OpenAI error object:
{
"error": {
"message": "Workspace balance is not positive. Top up to resume.",
"type": "insufficient_credits",
"code": "insufficient_credits",
"param": null
}
}HTTP status: 402 Payment Required.
The taxonomy
This table is rendered from the gateway’s own error constants
(@hyperinfer/shared), so it cannot drift from the implementation:
| Code | HTTP status | Meaning |
|---|---|---|
provider_auth | 502 | The upstream provider rejected our credentials. Not caused by your key. |
provider_rate_limit | 429 | The upstream provider rate-limited the request. Retry with backoff. |
provider_overloaded | 529 | The upstream provider is overloaded. Retry with backoff. |
context_length_exceeded | 400 | The request exceeds the model's context window. |
content_filter | 400 | The upstream provider's content filter blocked the request or response. |
provider_timeout | 504 | The upstream provider timed out before completing the response. |
provider_unavailable | 502 | The upstream provider could not be reached or returned a server error. |
insufficient_credits | 402 | The workspace balance is not positive. Top up to resume. |
key_limit_exceeded | 402 | A daily, monthly, or total spend limit on this API key was reached. |
model_not_allowed | 403 | The key is pinned to specific models and this slug is not on its list. |
invalid_api_key | 401 | The key is missing, malformed, revoked, disabled, or expired. |
workspace_locked | 403 | The workspace has been locked by operations. |
rate_limit_exceeded | 429 | Too many requests per minute on this key. Honor Retry-After. |
invalid_request | 400 | The request body failed validation for the ingress format. |
payload_too_large | 413 | The request body exceeds the 50 MB limit. |
internal_error | 500 | Unexpected error on our side. Safe to retry. |
Handling guidance
- Retry with backoff:
provider_rate_limit,provider_overloaded,provider_timeout,provider_unavailable,rate_limit_exceeded,internal_error. Honor theRetry-Afterheader when present. - Fix the request:
invalid_request,context_length_exceeded,payload_too_large,model_not_allowed. - Fix the account:
insufficient_credits(top up),key_limit_exceeded(wait for the reset or raise the limit),invalid_api_key(rotate the key),workspace_locked(contact support).
The gateway itself retries upstream connect failures and pre-stream 5xx/429s at most twice with jittered backoff — and never retries once a response has started streaming, so you will never receive duplicated content.