API Platform

Error Codes

Synchronous errors use the error.message/type/param/code structure; asynchronous failures use an internal standard error structure that requires separate handling.

Synchronous error structure

JSON
{
  "error": {
    "message": "billing error",
    "type": "billing_error",
    "param": null,
    "code": "insufficient_credits"
  }
}
HTTPtypeDescription
400invalid_request_errorInvalid request parameters
401authentication_errorAuthentication failed; framework-supported
402billing_errorBilling or balance issue
403permission_errorNo permission, security interception; common landing point for current AGW API Key failures
404not_found_errorResource does not exist
409conflict_errorResource conflict
429rate_limit_errorRate limit or concurrency limit exceeded
500/502/503/504internal / upstream / service / timeoutSystem, downstream, or service unavailable or timeout

Common codes

codeDescription
missing_required_fieldMissing required field
invalid_field_valueInvalid field value
unsupported_response_formatUnsupported output format
invalid_url / url_not_allowedInvalid URL format or access not allowed
insufficient_creditsInsufficient balance
rate_limit_exceeded / concurrency_limit_exceededRequest frequency or concurrency limit exceeded
file_not_found / voice_not_found / task_not_foundResource does not exist
safety_guardrail_blockedBlocked by safety detection

Asynchronous failure structure

When an asynchronous task fails, status is FAILED and error is an internal standard error structure, which differs from the synchronous error structure.

JSON
{
  "id": "task-xxx",
  "object": "audio.speech",
  "status": "FAILED",
  "error": {
    "error_code": 16001,
    "error_msg": "billing error",
    "internal_error_code": 109111005,
    "internal_error_msg": "insufficient credits"
  }
}