Error Codes
Error Codes
OpenAI-compatible paths return a unified JSON error shape. Anthropic- and Gemini-compatible paths preserve their protocol behavior where practical, while sharing the same authentication, balance, and limit checks.
config.json
json
{ "error": { "message": "Human-readable description", "type": "invalid_request_error", "code": "validation_error" } }
| HTTP | Common code | Meaning | Recommended action |
|---|---|---|---|
| 400 | bad_request / validation_error | Invalid body or parameter | Check required fields such as model and messages |
| 401 | invalid_api_key | Missing, malformed, or unknown key | Use a valid ck- key |
| 402 | insufficient_balance | Balance cannot cover the estimated request | Top up and retry |
| 403 | model_not_allowed / ip_not_allowed / daily_limit_exceeded | Key policy, IP, or daily cap blocked the request | Check API key settings |
| 404 | model_not_found / generation_not_found | Model or generation was not found | Check /v1/models or the gen- ID |
| 429 | rate_limit_exceeded | Request rate exceeded limits | Retry with exponential backoff |
| 500 | internal_error | Gateway internal error | Contact support with X-Request-Id if persistent |
| 502 | provider_error | Upstream returned an error | Retry later |
| 503 | provider_unavailable | Upstream temporarily unavailable | Retry later or choose another model |
| 504 | provider_timeout | Upstream timed out | Shorten input/output and retry |
Retry-After may appear on some paths or upstream responses, but it is not the current stable public contract. Use exponential backoff in clients.