documentation
errors and request IDs
Handle failures consistently and trace every production call.handle HTTP status first
{
"error": {
"type": "invalid_request_error",
"code": "invalid_api_key",
"message": "The API key is invalid or revoked."
}
}- 400
invalid requestFix the request; do not retry unchanged - 401
authenticationMissing, invalid, or revoked API key - 403
access deniedAccount or capability is not approved - 409
conflictKey limit or state conflict - 429
rate limitedRetry with exponential backoff and jitter - 5xx
temporary failureRetry boundedly; preserve the request ID
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.