TheaimartAIx DOCS
Home Get API key

Errors

Every error uses the OpenAI envelope, so existing client error handling works unchanged.

{
  "error": {
    "message": "insufficient credits",
    "type": "insufficient_quota",
    "code": null,
    "param": null
  }
}
FieldTypeRequiredDescription
error.message string optional Human-readable description.
error.type string optional Stable machine code (see table below).
error.code string | null optional Finer-grained code where applicable.
error.param string | null optional Offending request field, if any.

Status codes

HTTPerror.typeMeaning
400invalid_request_errorMalformed body, unknown/unsupported model, bad params.
401/403authentication_error / permission_errorMissing, invalid or disallowed key.
402insufficient_quotaNot enough prepaid credits. Top up in billing.
429rate_limit_errorRPM or TPM limit hit. Back off and retry.
500server_errorUnexpected server error.
503service_unavailableNo healthy execution route is available. Retry.

Handling

  • Retry 429, 500, 503 with exponential backoff + jitter; SDKs do this by default.
  • Don’t retry 400, 401, 402, 403 — fix the request, key or balance first.
  • Inspect the HTTP status and error.type, not the prose in error.message, for branching.

POST /v1/messages uses the Messages-style { "type": "error", "error": { ... } } envelope documented on the Messages reference.

See also Rate limits, caps & scopes.

Last updated July 18, 2026

Was this page helpful?