Errors

All endpoints return a consistent error envelope.

Error Shape

{
  "error": {
    "message": "Human-readable description",
    "type": "error_type",
    "code": "optional_code"
  }
}

Status Codes

HTTPtypeDescriptionAction
400invalid_request_errorInvalid parametersCheck request body
400content_moderationContent blocked by safety systemAdjust prompt
400input_too_largeInput exceeds model limitReduce input
401auth_errorInvalid API keyCheck API key
402insufficient_creditsNot enough creditsTop up
404model_not_foundModel not foundCheck model ID
429rate_limit_errorToo many requests or no route availableRetry with backoff
502provider_errorUpstream provider errorRetry later
504timeout_errorRequest timed outSimplify or retry