Errors
All endpoints return a consistent error envelope.
Error Shape
{
"error": {
"message": "Human-readable description",
"type": "error_type",
"code": "optional_code"
}
}Status Codes
| HTTP | type | Description | Action |
|---|---|---|---|
| 400 | invalid_request_error | Invalid parameters | Check request body |
| 400 | content_moderation | Content blocked by safety system | Adjust prompt |
| 400 | input_too_large | Input exceeds model limit | Reduce input |
| 401 | auth_error | Invalid API key | Check API key |
| 402 | insufficient_credits | Not enough credits | Top up |
| 404 | model_not_found | Model not found | Check model ID |
| 429 | rate_limit_error | Too many requests or no route available | Retry with backoff |
| 502 | provider_error | Upstream provider error | Retry later |
| 504 | timeout_error | Request timed out | Simplify or retry |