Skip to main content

API error handling guide

This developer guide explains how to diagnose failed API requests, decide when to retry and collect safe troubleshooting details. This is a documentation page, not an API failure response.

Check authentication and request parameters

For 400 errors, check the request body, model ID and endpoint compatibility. For 401, check your API token and authorization header. For 403, check token permissions, account restrictions and model access. Correct the cause before retrying; do not repeatedly resend an unchanged request.

Retry transient failures with limits

For 429 responses, inspect the error body for rate or quota limits. Honor Retry-After when provided; otherwise use bounded exponential backoff with jitter. For 500, 502, 503 and 504, use a small retry limit. A timeout does not prove the upstream task failed: check usage or task status before repeating a potentially billable request.

Collect safe support details

Record the time and timezone, endpoint path, model, HTTP status and sanitized error message. Include a request ID if the response provides one. Never share your API token, authorization header or private prompt data. See the quickstart and model documentation to verify the interface before testing again.