Guides

Errors

Errors use standard HTTP status codes and one JSON shape. Branch on the code field: it is stable. The message is for people and may change.

#Error format

Error body
{
  "error": {
    "message": "direction must be cyr2lat, lat2cyr, or auto",
    "type": "invalid_request_error",
    "code": "invalid_request"
  }
}
Error fields
FieldTypeDescription
error.codestringMachine-readable code from the table below.
error.typestringError class, derived from the HTTP status (OpenAI style).
error.messagestringHuman-readable explanation. Never contains your input.
HTTP statustype
400, 405, 413invalid_request_error
401authentication_error
403permission_error
404not_found_error
429rate_limit_error
500, 502, 503, 504server_error

#Error codes

StatusCodeWhen
400invalid_requestThe body or a field is invalid: missing text or file, unknown direction, voice or format, wrong content type. Fix the request; do not retry.
400invalid_audioThe audio could not be decoded. Check the file and its format.
400key_in_queryThe key was sent in the URL. Send it in the Authorization header.
401invalid_api_keyNo key, or the key is malformed, unknown, revoked or expired. Check the header; create a new key if needed.
403account_suspendedThe account is suspended. Contact support.
403scope_not_allowedThe key lacks the scope for this endpoint.
403voice_not_allowedThe key may not use this voice.
404not_foundNo such endpoint. Check the path and the /v1 prefix.
405method_not_allowedWrong HTTP method, for example GET on a POST endpoint.
413payload_too_largeText, file or body over the limit. Split the input.
413audio_too_longAudio over 5 minutes. Cut it into parts.
429rate_limitedPer-minute limit reached. Retry after Retry-After.
429concurrent_requestToo many requests in flight for the account. Retry after 1 s and lower your parallelism.
429quota_exceededDaily or monthly quota used up. Wait for the reset (Retry-After) or upgrade the plan.
429global_capacityFree plan: the shared daily capacity is used up. Retry after midnight UTC.
500server_errorUnexpected error on our side. Retry after Retry-After or a few seconds; report it if it persists.
502upstream_errorThe speech server failed on this request. Retry once or twice.
503service_busyThe GPU machine is busy with other requests. Retry after Retry-After.
503service_unavailableThe API is shedding load, or the GPU machine is offline. Retry after Retry-After.
503not_availableThe endpoint is not offered yet. See GET /v1/status.
504timeoutThe model did not finish within 90 seconds. Retry with shorter input.

Rejected requests do not use quota. Speech requests that fail on the server (502, 503, 504) are not charged.

#Handling errors

  • 4xx except 429: the request is wrong. Fix it; retrying the same request gets the same answer.
  • 429 and 5xx: retry after Retry-After, with jitter and a cap on attempts. See retrying for code.
  • Log X-Request-Id from every failed response and include it when you contact support.

Non-JSON responses

The API sits behind Cloudflare. A network failure between you and the API can return an HTML page or no body at all. Treat any response you cannot parse as JSON like a 5xx and retry later.