Skip to content

Error Codes

Every endpoint returns errors in the same JSON shape:

json
{
  "error": {
    "message": "Human-readable description, usually with a request ID for debugging",
    "type": "new_api_error",
    "code": "invalid_request"
  }
}

HTTP status codes

StatusMeaningCommon causes
400Bad requestMalformed body, missing required field, a parameter value the target model doesn't support
401UnauthorizedMissing Authorization header, invalid/deleted API key
403ForbiddenKey disabled, account banned, source IP not allowlisted, access policy triggered
404Not foundRequested a path or resource ID that doesn't exist
429Too many requestsQuota exhausted, rate limit triggered
500Internal server errorGateway-side fault — retry and watch the status page
503Service unavailableLoad-shedding, failed health check

Common business error codes (error.code)

codeMeaningSuggested handling
invalid_requestMalformed request/parametersCheck the request body against the endpoint's documented shape
model_not_foundThe requested model doesn't exist or isn't currently availableCall GET /v1/models to confirm the correct model name
insufficient_user_quotaAccount/key quota exhaustedTop up in the console or raise the key's quota cap
access_deniedAccess denied (IP restriction, account state, etc.)Check the key's IP allowlist and account status
sensitive_words_detectedContent blocked by safety policyAdjust the request content to comply with content policy
channel:no_available_keyNo upstream key currently available on the backing channelUsually a platform-side channel issue — retry later; report if persistent
bad_response_status_codeThe upstream provider returned an unexpected statusThe gateway does its best to translate this — treat like a 5xx and retry

More internal codes

Beyond the high-frequency codes above, the gateway defines finer-grained internal/channel error codes (provider-specific rate limits, content-policy differences, etc.) — these are typically described in the message field. If code isn't in this table, read message first, or contact the platform team for help.

Retry guidance

ScenarioRetry?
429 rate limitYes — exponential backoff
500 / 503Yes — brief wait, then retry; alert on repeated failures
401 / 403No — fix credentials/permissions first
400 (bad params)No — fix the request content first
model_not_foundNo — confirm the correct model name first

Debugging tips

  • Keep the request-identifying info from message (usually a request ID) when contacting the platform team — it speeds up investigation.
  • Reproduce with curl first to rule out SDK-wrapper issues vs. the API itself.
  • Check whether you've hit one of the "not yet supported" cases in OpenAI-Compatible API.

SDKMAX — Enterprise AI Gateway, Aggregating Global AI Resources