Error Response Format
When an error occurs, the API returns a JSON object with anerror field:
Error Codes
| HTTP Code | Type | Description |
|---|---|---|
400 | invalid_request_error | The request body is malformed or missing required fields |
401 | authentication_error | Invalid or missing API key |
402 | insufficient_balance | Both subscription and lifetime credit balances are zero |
404 | not_found | The requested resource doesn’t exist |
429 | rate_limit_error | You’ve exceeded your plan’s rate limit |
500 | internal_error | An unexpected error occurred on our end |
Common Errors
400 — Invalid Model
Returned when you specify a model that isn’t supported:400 — Missing Model Field
model field in your request body.
401 — Invalid API Key
sk_. Generate a new key from your dashboard if needed.
402 — Insufficient Balance
- Wait for your next subscription credit refill (scheduled every 5 hours)
- Purchase lifetime credits from your dashboard
- Upgrade your plan for higher credit limits
429 — Rate Limit Exceeded
| Plan | Rate Limit |
|---|---|
| Starter | 15 RPM |
| Pro | 40 RPM |
| Max | 60 RPM |
500 — Internal Server Error
Error Handling Best Practices
Implement retry logic with exponential backoff
Implement retry logic with exponential backoff
For
429 and 500 errors, retry with increasing delays:Handle insufficient balance gracefully
Handle insufficient balance gracefully
Check for
402 errors and notify users to add credits:Validate models before sending requests
Validate models before sending requests
Use the
/v1/models endpoint to check if a model is supported before making a chat completion request.