llmboxDocumentationSign in
API · Errors

Errors

The error format, the codes, what to do about them and which requests to retry.

An error comes in the OpenAI envelope — the way your SDK understands it. Include request_id when contacting support; it also comes in the x-request-id header of every response.

json
{"error": {"message": "...", "type": "...", "code": "...", "param": "...", "request_id": "req_..."}}

The param field is present only when the error concerns a specific parameter.

Error codes

HTTPcodeWhat it means
400invalid_requestMalformed request body (no model, broken JSON) — check the parameters. A provider rejection the gateway could not classify uses the same code; the HTTP status is then the provider's (4xx).
400unsupported_parameterA request parameter is not supported — its name is in the param field. Remove it and retry. For video models with a conditions table this is the answer to size (param: "size") — set the resolution with resolution or mode. See Request parameters.
400unsupported_video_optionsA video model with a conditions table has no price for the combination of resolution (mode), audio, length and operation (text to video, image to video or video to video). The message lists the supported values — pick one of them. See Video.
400invalid_resolutionresolution (or mode) of a video model with a conditions table is not a string.
400invalid_effortThe effort level is not a string or not one of none, minimal, low, medium, high, xhigh, max. See Request parameters.
400unsupported_effortThe model does not offer this effort level — the allowed values are in the model catalog.
400unsupported_value, invalid_valueThe model's provider rejected a parameter value; the parameter name is in the param field when it could be determined.
400context_length_exceededThe request does not fit the model's context window. The message starts with “Prompt is too long:”.
400content_policy_violationThe model's content policy rejected the request — change the prompt.
400invalid_imageThe model rejected the reference image — try a different one.
401invalid_api_keyKey missing, not found or revoked — check the Authorization header.
402insufficient_quotaThe free balance does not cover the request reserve. The message names the reserve and the amount missing, for example: "Insufficient balance: this request reserves $0.41 (input estimate + maximum output), $0.36 more is needed. Reduce max_tokens or top up." Lower max_tokens (n for images, the length for video) or top up your account. With a zero balance the response comes right after the key check, before the request body is read. If the remainder is held by requests in progress, retry once they finish.
403spend_limit_exceededThis key hit its spend limit, or the request reserve would exceed it (the message names the excess) — raise the limit, lower max_tokens or create a new key.
404model_not_foundThe model does not exist, is disabled, is not available to your account or does not fit the endpoint (an image model on chat) — check GET /v1/models with your key.
404not_foundUnknown endpoint, video job not found or the video is not ready yet.
413invalid_requestThe request body exceeds the limit — see Limits.
415invalid_requestThe body was not sent as JSON: the Content-Type: application/json header is missing or names another type — for example application/x-www-form-urlencoded, which curl -d sets by default. Add the header.
422generation_failedThe model returned no image. Retry the request or rephrase the prompt.
429rate_limit_exceededThe requests-per-minute limit of the key or account is exhausted (without a key — of the IP address), too many concurrent requests on your account, or the model is overloaded at the provider. Retry after the pause in the Retry-After header.
500—Internal gateway error (type: server_error, no code). Retry; if it persists, contact support with the request_id.
502upstream_unavailableThe model is temporarily unavailable — retry later.
503server_restartingThe server is restarting and the request was cut off before a response — retry the request.
503service_unavailableService under maintenance, temporarily unavailable, or its database is temporarily unreachable — retry after Retry-After (when the header is present) or later.
503overloadedThe server is handling too many heavy media requests at once: image generations and video jobs with a body over 5 MiB. Retry after the pause in Retry-After (5 seconds). See Limits.
503video_disabledIntake of new video generations is turned off (POST/v1/videos; polling and download keep working) — retry later.
503video_options_unavailableThe selected video options are unavailable right now — choose other options; retrying with the same options may not help for a while.
503effort_options_unavailableThere is no available provider for the selected effort level right now; retry later or choose another level.
503—The model is temporarily unavailable (type: server_error, no code) — retry later or pick another model.
504upstream_timeoutThe provider did not answer a request without streaming within 10 minutes. The request is not retried: generation may have started; nothing is charged. Retry the request, and use stream: true for long answers. See Limits.

Retries

Retrying makes sense for 429, 500, 502, 503, 504 and 422. Other errors will not go away on retry — fix the request, key or balance first.

  • On 429 wait for the pause in the Retry-After header; without it, use exponential backoff (1, 2, 4… seconds). The OpenAI SDK does this itself.
  • An error that arrives as an event mid-stream is also a reason to retry the whole request (see Streaming).

Errors in a stream

Once the response has started (HTTP 200), an error arrives as an event in the endpoint's format, and no [DONE] follows it. The gateway does not forward the provider's error — it sends its own event with one of these codes:

codeWhat it means
upstream_interruptedThe provider cut the response off or sent an error. If part of the response already arrived, the message says so ("The partial output above was delivered"). Retry the request.
upstream_timeoutThe provider did not deliver the response in time: no first fragment within 10 minutes, a pause of more than five minutes after it, or a stream longer than an hour — see Streaming. If part of the response already arrived, the message says so. Retry the request.
server_restartingThe server is restarting ("The server is restarting. Please retry the request."). Retry the request.

The event carries no amounts and no provider name. Event shapes are in Streaming.

Stuck? Message us on Telegram — @llmbox_support_bot — with the request_id from the response.