Skip to main content
When an API call fails, check the HTTP status code first, then use error.message and error.code to identify the cause. One status code can have several causes. Messages and error body formats can also vary by endpoint or upstream model provider.

Common status codes

403 with insufficient_user_quota is a common current gateway response for insufficient account balance or subscription quota. Some endpoint docs and upstream examples use 402; rely on the actual HTTP status and error returned.

Common error codes

error.code helps distinguish causes, but it is not guaranteed to be present. Errors passed through from upstream may use other codes or response formats.

Error responses and troubleshooting

OpenAI-compatible endpoints usually place errors in an error object, for example:
For troubleshooting, record the HTTP status, error.code, error.message, request time, and model name. Keep the X-Oneapi-Request-Id response header when present. Native Claude endpoints or errors passed through from upstream may use a different response format or request ID field. Do not send your full API key, prompts, or other sensitive data to support. Retry temporary errors such as 429, 500, 502, 503, and 504 only a limited number of times. For 503 with error.code set to model_not_found, check the model and group before retrying. For image, video, and other requests that may create a task or incur charges, check the task status before retrying. Fix the cause of 400, 401, access-denied, and insufficient-quota errors first.