Skip to navigation

Errors

Errors use OpenAI’s shape, with a message written for you to read:

{
"error": {
"message": "Your balance is too low for this request. Available: 0.42 credits — top up to continue.",
"type": "insufficient_quota",
"code": "402"
}
}

Branch on the HTTP status, and show message to people. On the inference endpoints (/chat/completions, /embeddings, /images/* and POST /videos), code is the HTTP status as a string, such as "402". GET /v1/models, the video read endpoints, unknown paths and the per-address rate limit use the named codes in the table instead.

StatusNamed codeWhat happenedWhat to do
400A parameter is wrong, the model doesn’t take that content or option, or the model rejected the requestRead the message: it names what to change. If the model itself rejected the request, the message says only that
401invalid_api_keyThe key is missing, wrong or deletedCheck the key, or create a new one
401key_disabledThe key is switched offSwitch it back on in API keys
402Your available balance can’t cover the requestTop up, or lower max_tokens
403A limit set on your account was reachedContact us on Discord
404not_foundNo such model, video or endpointCheck the id against GET /v1/models, or the video id
409video_not_readyThe video isn’t finishedPoll its status until it’s completed
410video_expiredThe video is past the time it’s kept forMake it again, and download it sooner
413The request body is over 25 MB. The answer is an HTML page, not JSONSend a link, compress, or split the file
422The model made no image, for example because it declined the promptChange the prompt, or try another image model
429rate_limitedToo many requests from your address. Too many from one key also returns 429, without this codeSlow down and retry with backoff
502, 503The model’s hosts couldn’t answer, billing was briefly unavailable, or a generated image couldn’t be fetchedRetry shortly

Retrying

Retry 429, 502 and 503 with exponential backoff. The OpenAI SDKs do this for you. Don’t retry 400 to 404 without changing something: they will fail the same way.

A refused request is never charged. A request that fails partway is charged for what the model already did.

Hosts

When a model’s host fails, HyperFlow HI retries on another host for the same model where there is one, before returning an error. A host’s own error is never passed on as is.