Error Response Format
All error responses follow this structure:HTTP Status Codes Overview
Authentication Errors (401)
Authentication errors occur when there’s an issue with your API key.missing_api_key
Authorization header to your request:
invalid_api_key
api_key_revoked
Invalid Request Errors (400)
These errors indicate issues with the request format or parameters.missing_required_parameter
invalid_parameter_value
invalid_json_body
model_not_supported
Insufficient Quota Errors (402)
These errors indicate billing or credit issues.insufficient_credits
billing_not_active
Permission Denied Errors (403)
These errors indicate access restrictions.access_denied
model_access_denied
ip_not_allowed
Not Found Errors (404)
These errors indicate the requested resource doesn’t exist.task_not_found
model_not_found
/v1/models endpoint to list available models.
resource_not_found
Conflict Errors (409)
These errors indicate conflicts with the current resource state.resource_conflict
duplicate_resource
concurrent_update
Unprocessable Entity Errors (422)
These errors indicate the request was well-formed but cannot be processed.validation_failed
invalid_image_url
image_too_large
unsupported_image_format
Rate Limit Errors (429)
These errors indicate you’re sending requests too quickly.rate_limit_exceeded
retry_after field indicates when you can retry.
requests_quota_exceeded
Server Errors (500)
These errors indicate problems on our end.internal_error
request_id.
upstream_provider_error
Service Unavailable Errors (503)
These errors indicate temporary service issues.service_overloaded
model_overloaded
maintenance_mode
Error Handling Best Practices
Implement Retry Logic
Implement Retry Logic
Always implement retry logic with exponential backoff for transient errors (429, 500, 503):
Log Request IDs
Log Request IDs
Always log the
request_id from error responses. This helps our support team diagnose issues quickly.Handle Specific Error Codes
Handle Specific Error Codes
Handle specific error codes rather than just HTTP status codes for more precise error handling:
