Creative APIDocs
Общее API

Общее API

Коды ошибок

Тексты ошибок — английские, одна фраза. В фигурных скобках — значения, которые мы подставляем: имя поля, лимит, сумма. Значения из вашего запроса в текст не попадают.

Синхронные ответы /api/v1/*

HTTP-статус — 200 при любой ошибке, код — в поле code тела: {code, msg, data: null}. Исключение — неизвестный путь: HTTP 404. На code 429 есть заголовок Retry-After.

codemsg
401Authentication required: pass the API key as "Authorization: Bearer <key>".
401Invalid or revoked API key.
401API key has expired.
402Insufficient balance: {price} required, {available} available.
403Account is blocked. Contact support.
403Account is temporarily blocked until {until}.
403Requests from IP {ip} are not allowed for this API key.
403Model {model} is not allowed for this API key.
404Not found.
422Request body must be a JSON object.
422Field "model" is required.
422Model is not supported: {model}.
422Field "input" is required and must be an object.
422Invalid input: {path} {rule}.
422Invalid input: unknown field {path}.
422Invalid callBackUrl: must be a public http(s) URL up to 2048 characters.
422Cannot read input file {path}: it must be a public URL to a supported file.
422Invalid maxPrice: must be a positive number.
422Price {price} exceeds maxPrice {maxPrice}.
422Invalid Idempotency-Key: 1 to 255 characters.
422Idempotency-Key reused with a different request.
422Query parameter "taskId" is required.
422recordInfo is null
422Field "url" is required.
422File not found or expired.
422File is too large: maximum {max} MB for {type}.
422Unsupported file type.
422Field "{field}" is required.
422Invalid base64 data.
422Invalid fileUrl: must be a public http(s) URL.
422Cannot download the file from fileUrl.
429Rate limit exceeded: 20 requests per 10 seconds.
429Rate limit exceeded.
429Too many active tasks: limit {limit}.
429Spending limit for the last 24 hours reached.
429Spending limit of this API key reached.
455Service is under maintenance. Try again later.
500Internal error. Try again later.
505Model is no longer available: {model}.

Языковые модели /creative/v1/*

Формат OpenAI с настоящим HTTP-статусом: {error: {type, code, message}}.

HTTPtypecodemessage
400invalid_request_errorinvalid_requestRequest body must be a JSON object.
400invalid_request_errormissing_required_parameterMissing required parameter: "model".
400invalid_request_errorinvalid_requestThe request was rejected by the model: invalid parameters.
400invalid_request_errorcontent_policy_violationThe request was flagged by content moderation.
401authentication_errorinvalid_api_keyIncorrect API key provided.
401authentication_errorapi_key_expiredAPI key has expired.
402insufficient_quotainsufficient_balanceInsufficient balance: {price} required for this request, {available} available.
403permission_erroraccount_blockedAccount is blocked. Contact support.
403permission_erroraccount_blockedAccount is temporarily blocked until {until}.
403permission_errorip_not_allowedRequests from IP {ip} are not allowed for this API key.
403permission_errormodel_not_allowedThe model "{model}" is not allowed for this API key.
404invalid_request_errormodel_not_foundThe model "{model}" does not exist.
404invalid_request_errormodel_not_foundThe model "{model}" is no longer available.
429insufficient_quotaspend_limit_reachedSpending limit for the last 24 hours reached.
429insufficient_quotakey_spend_limit_reachedSpending limit of this API key reached.
429rate_limit_errorrate_limit_exceededRate limit exceeded: 20 requests per 10 seconds.
429rate_limit_errorrate_limit_exceededThe service is busy. Retry shortly.
500server_errorinternal_errorInternal error. Try again later.
502server_errorupstream_errorUpstream model error. Try again later.
503server_errorservice_unavailableService is under maintenance. Try again later.
503server_errormodel_unavailableThe model is temporarily unavailable.
503server_errorservice_unavailableService is temporarily unavailable.

Ошибки задачи: failCode и failMsg

Приходят в recordInfo и callback при state: fail. Резерв задачи с ошибкой возвращается полностью.

failCodefailMsg
400The input or output was flagged by content moderation. Adjust the request and try again.
408The task did not finish in time.
422The input was rejected by the model. Check the parameters against the model schema.
422The prompt is too long for this model.
422An input image could not be read: the file may be corrupted, too large or in an unsupported format.
422The voice audio is not usable: it needs clear speech and a length the model accepts.
422An input file could not be downloaded. Use a public URL that stays available.
455The service was unavailable and the task was not started. Try again later.
500Internal error: the task could not be completed.
500Internal error: the result could not be retrieved.
501Generation failed. Try again.