TheaimartAIx DOCS
Home Get API key

Errors

Errors use OpenAI’s envelope, so existing SDK error handling works unchanged.

Envelope

{
  "error": {
    "message": "Insufficient credits",
    "type": "insufficient_quota",
    "param": null,
    "code": null
  }
}

Status codes

HTTPtypeMeaning
400invalid_request_errorBad input (unsupported model, bad params).
401authentication_errorMissing / malformed key.
403permission_errorKey disabled, expired, or out of scope.
402insufficient_quotaOut of credits or spend cap reached.
404not_found_errorUnknown route / resource.
429rate_limit_errorRate limit or TPM exceeded — back off.
503service_unavailableNo healthy route is available — safe to retry.
500server_errorUnexpected; internal details are never leaked.

Retrying

  • 429 / 503 → retry with exponential backoff and jitter. For chat completions, use an Idempotency-Key to guard duplicate billing.
  • 402 → top up credits or raise the spend cap.
  • 400 / 401 / 403 → fix the request; retrying won’t help.

On any failed call, the pre-charged estimate is automatically refunded — you’re only billed for work that succeeded.

The Messages surface uses a different SDK-compatible error wrapper; see Messages errors.

Last updated July 18, 2026

Was this page helpful?