documentation

errors and request IDs

Handle failures consistently and trace every production call.
error shape

handle HTTP status first

{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_api_key",
    "message": "The API key is invalid or revoked."
  }
}
  • 400invalid requestFix the request; do not retry unchanged
  • 401authenticationMissing, invalid, or revoked API key
  • 403access deniedAccount or capability is not approved
  • 409conflictKey limit or state conflict
  • 429rate limitedRetry with exponential backoff and jitter
  • 5xxtemporary failureRetry boundedly; preserve the request ID
request attribution

log x-brok-request-id

Every generated request ID is safe to place in application logs and support reports. It links the response to route, customer, API key, model, status, latency, and token counts in Usage. Do not log the API key itself.