Errors

Understand failed requests and recover deliberately.

Error format

JSON
{
  "error": {
    "message": "Invalid API key.",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}

Common status codes

StatusMeaningNext step
400Invalid request or policy rejectionRead the message and fix the request.
401Missing or invalid keyCheck the key and expiry.
403Insufficient accessCheck key scopes and account access.
404Model not foundDiscover models with GET /v1/models.
429Request or concurrency limitHonor Retry-After when returned.
502 / 503Provider unavailable or overloadedRetry with backoff when appropriate.
504Provider timeoutCheck status before retrying.

Request IDs

Keep the x-request-id response header with your own diagnostics. Do not include credentials or private prompt content in support reports.

Availability depends on your connected provider. Check service status and keep x-request-id with your diagnostics.