Skip to main content

Errors

Most API failures return an error object:
Not every authentication failure includes type and code. Always branch on the HTTP status first, then use error.code when present.

Stable policy codes

  • trial_model_denied
  • trial_scope_denied
  • scope_denied
  • model_not_in_key_scope
  • model_disabled_for_org
  • insufficient_credits
  • reservation_failed
  • budget_cap_exceeded

Retry guidance

Retry only idempotent reads and requests that your application can safely deduplicate. Use exponential backoff with jitter for 429 and transient 5xx responses. Do not automatically retry 401, 402, or 403. Log the request ID and error code, but never log the API key, request authorization header, or signed media URLs. อ่านภาษาไทย