Коды ошибок
Тексты ошибок — английские, одна фраза. В фигурных скобках — значения, которые мы подставляем: имя поля, лимит, сумма. Значения из вашего запроса в текст не попадают.
Синхронные ответы /api/v1/*
HTTP-статус — 200 при любой ошибке, код — в поле code тела: {code, msg, data: null}. Исключение — неизвестный путь: HTTP 404. На code 429 есть заголовок Retry-After.
| code | msg |
|---|---|
| 401 | Authentication required: pass the API key as "Authorization: Bearer <key>". |
| 401 | Invalid or revoked API key. |
| 401 | API key has expired. |
| 402 | Insufficient balance: {price} required, {available} available. |
| 403 | Account is blocked. Contact support. |
| 403 | Account is temporarily blocked until {until}. |
| 403 | Requests from IP {ip} are not allowed for this API key. |
| 403 | Model {model} is not allowed for this API key. |
| 404 | Not found. |
| 422 | Request body must be a JSON object. |
| 422 | Field "model" is required. |
| 422 | Model is not supported: {model}. |
| 422 | Field "input" is required and must be an object. |
| 422 | Invalid input: {path} {rule}. |
| 422 | Invalid input: unknown field {path}. |
| 422 | Invalid callBackUrl: must be a public http(s) URL up to 2048 characters. |
| 422 | Cannot read input file {path}: it must be a public URL to a supported file. |
| 422 | Invalid maxPrice: must be a positive number. |
| 422 | Price {price} exceeds maxPrice {maxPrice}. |
| 422 | Invalid Idempotency-Key: 1 to 255 characters. |
| 422 | Idempotency-Key reused with a different request. |
| 422 | Query parameter "taskId" is required. |
| 422 | recordInfo is null |
| 422 | Field "url" is required. |
| 422 | File not found or expired. |
| 422 | File is too large: maximum {max} MB for {type}. |
| 422 | Unsupported file type. |
| 422 | Field "{field}" is required. |
| 422 | Invalid base64 data. |
| 422 | Invalid fileUrl: must be a public http(s) URL. |
| 422 | Cannot download the file from fileUrl. |
| 429 | Rate limit exceeded: 20 requests per 10 seconds. |
| 429 | Rate limit exceeded. |
| 429 | Too many active tasks: limit {limit}. |
| 429 | Spending limit for the last 24 hours reached. |
| 429 | Spending limit of this API key reached. |
| 455 | Service is under maintenance. Try again later. |
| 500 | Internal error. Try again later. |
| 505 | Model is no longer available: {model}. |
Языковые модели /creative/v1/*
Формат OpenAI с настоящим HTTP-статусом: {error: {type, code, message}}.
| HTTP | type | code | message |
|---|---|---|---|
| 400 | invalid_request_error | invalid_request | Request body must be a JSON object. |
| 400 | invalid_request_error | missing_required_parameter | Missing required parameter: "model". |
| 400 | invalid_request_error | invalid_request | The request was rejected by the model: invalid parameters. |
| 400 | invalid_request_error | content_policy_violation | The request was flagged by content moderation. |
| 401 | authentication_error | invalid_api_key | Incorrect API key provided. |
| 401 | authentication_error | api_key_expired | API key has expired. |
| 402 | insufficient_quota | insufficient_balance | Insufficient balance: {price} required for this request, {available} available. |
| 403 | permission_error | account_blocked | Account is blocked. Contact support. |
| 403 | permission_error | account_blocked | Account is temporarily blocked until {until}. |
| 403 | permission_error | ip_not_allowed | Requests from IP {ip} are not allowed for this API key. |
| 403 | permission_error | model_not_allowed | The model "{model}" is not allowed for this API key. |
| 404 | invalid_request_error | model_not_found | The model "{model}" does not exist. |
| 404 | invalid_request_error | model_not_found | The model "{model}" is no longer available. |
| 429 | insufficient_quota | spend_limit_reached | Spending limit for the last 24 hours reached. |
| 429 | insufficient_quota | key_spend_limit_reached | Spending limit of this API key reached. |
| 429 | rate_limit_error | rate_limit_exceeded | Rate limit exceeded: 20 requests per 10 seconds. |
| 429 | rate_limit_error | rate_limit_exceeded | The service is busy. Retry shortly. |
| 500 | server_error | internal_error | Internal error. Try again later. |
| 502 | server_error | upstream_error | Upstream model error. Try again later. |
| 503 | server_error | service_unavailable | Service is under maintenance. Try again later. |
| 503 | server_error | model_unavailable | The model is temporarily unavailable. |
| 503 | server_error | service_unavailable | Service is temporarily unavailable. |
Ошибки задачи: failCode и failMsg
Приходят в recordInfo и callback при state: fail. Резерв задачи с ошибкой возвращается полностью.
| failCode | failMsg |
|---|---|
| 400 | The input or output was flagged by content moderation. Adjust the request and try again. |
| 408 | The task did not finish in time. |
| 422 | The input was rejected by the model. Check the parameters against the model schema. |
| 422 | The prompt is too long for this model. |
| 422 | An input image could not be read: the file may be corrupted, too large or in an unsupported format. |
| 422 | The voice audio is not usable: it needs clear speech and a length the model accepts. |
| 422 | An input file could not be downloaded. Use a public URL that stays available. |
| 455 | The service was unavailable and the task was not started. Try again later. |
| 500 | Internal error: the task could not be completed. |
| 500 | Internal error: the result could not be retrieved. |
| 501 | Generation failed. Try again. |