API error codes
Every error the API returns, with its HTTP status and code and what to do about it. Errors use the OpenAI format.
Errors
Errors use the OpenAI format: {"error": {"message", "type", "code"}}.
| HTTP | code | |
|---|---|---|
| 400 | invalid_request | The body is not valid JSON, or a field is missing or wrong. The message says which. |
| 400 | wrong_endpoint | The model is of another kind: chat models use /chat/completions, image models /images/generations, video models /videos. |
| 400 | size_not_available / format_not_available / too_many_images | The image model does not make this size or file format, or was sent more input images than it takes. The message gives what it accepts. |
| 400 | resolution_not_available | The video model is not sold at this resolution. |
| 400 | video_not_ready | The video is not completed yet; keep polling GET /videos/{id}. |
| 400 | not_a_draft / draft_not_ready / draft_wrong_model / draft_expired | draft_id must be a completed draft of the same model, made within 7 days. |
| 400 | user_required | Relay accounts only: every chat request must carry a user field. |
| 401 | invalid_api_key | Missing, wrong or revoked API key. |
| 402 | insufficient_balance / key_spend_cap | Top up your balance, or raise the key’s daily cap. |
| 403 | account_inactive | The account is suspended. |
| 403 | ip_not_allowed | The key has an IP whitelist and the request came from another address. |
| 404 | model_not_found | Unknown model id. See GET /models. |
| 404 | video_not_found / draft_not_found | No such video or draft on your account. |
| 404 | video_expired / last_frame_expired / image_expired / no_last_frame | The file is no longer kept, or no last frame was asked for. Image links last 1 hour. Video links last a week; a video we could not copy to our storage is served from the model provider for 24 hours only. |
| 404 | not_found | No such path. See Endpoints. |
| 405 | method_not_allowed | Wrong HTTP method for this path, for example GET on /chat/completions. |
| 413 | request_too_large | The request body is too large. |
| 429 | rate_limit_exceeded / concurrency_limit / model_at_capacity | Slow down and retry after the Retry-After header. |
| 429 | model_rate_limit_exceeded / model_concurrency_limit | Your account reached its limit for this one model. Other models still work; retry after the Retry-After header. |
| 429 | upstream_rate_limited | The model itself is at its rate limit. Retry in a few seconds; you were not charged. |
| 429 | too_many_failed_requests | The key sent too many failing requests in a row and is paused for the time in Retry-After. Fix the error you were getting, then retry. |
| 500 | internal_error | Something failed on our side. Retry, and quote the request_id to support if it repeats. |
| 502 | upstream_error | The model provider failed. Safe to retry; you were not charged. |
| 503 | upstream_unavailable / billing_unavailable / config_unavailable / model_not_priced / gateway_draining | Temporary. Retry with backoff. |
| 504 | upstream_error | The model did not answer in time. Safe to retry; you were not charged. |
