← All docs

Reference

Error Format & Rate Limits

OpenAI-compatible error envelope, status code table, rate limit headers.

Updated

Core inference APIs such as Chat use the OpenAI-compatible envelope below. Messages may return Anthropic-shaped errors (type: "error"); errors after a stream starts arrive in SSE data.

json
{
  "error": {
    "message": "Incorrect API key provided. ...",
    "type": "authentication_error",
    "param": null,
    "code": "invalid_api_key"
  }
}
Statustype / codeMeaning
400invalid_request_errorInvalid parameter / context length exceeded (do not retry)
401authentication_error / missing_api_key · invalid_api_keyKey missing, wrong, or expired
402insufficient_quota_error / insufficient_quota · spend_limit_exceededInsufficient credit or spend limit reached
403permission_error / model_not_allowed · insufficient_scopeRestricted by the key's allowed models or scopes
404invalid_request_error / model_not_found · job_not_foundModel or job does not exist
413invalid_request_errorRequest body too large — see body limits
429rate_limit_error / rate_limit_exceededRate limit — retry after the Retry-After header
502api_error / backend_unavailableUpstream provider failure (retryable)

Rate limits

The default rate limit is 100 req/min per key, and you can adjust it when you create or edit the key. Check your remaining quota with the X-RateLimit-Limit / X-RateLimit-Remaining / X-RateLimit-Reset response headers.

Auth endpoints (login, signup, and so on) have a separate, lower limit.

Retry decisions

  • Resolve input, authentication, credits, or access-policy issues before retrying 400, 401, 402, or 403.
  • For 429, wait the number of seconds in Retry-After. X-RateLimit-Reset is a Unix timestamp in milliseconds.
  • A 502 or 503 may be temporary. Increase the delay between retries and check whether the operation already ran.
  • 409 idempotency_in_progress means the same request is still processing. Wait rather than resubmitting with a new key.
  • 409 idempotency_key_reused means a different body was sent with the same key.
  • 409 idempotency_response_not_replayable means an accepted stream or large response cannot be replayed.

Log x-request-id, HTTP status, and error.code to help trace failures. Video POSTs do not support Idempotency-Key; resubmitting after a lost response can create duplicate jobs. See idempotency scope and video polling.