Understanding and handling API errors effectively
retry_after
field indicates seconds until you can retryType | Description | HTTP Status |
---|---|---|
invalid_request_error | Invalid request parameters | 400 |
authentication_error | Authentication failed | 401 |
insufficient_credits_error | Payment/credit issues | 402 |
permission_error | Insufficient permissions | 403 |
not_found_error | Resource not found | 404 |
rate_limit_error | Rate limit exceeded | 429 |
api_error | Server error | 500+ |
Error | Likely Cause | Solution |
---|---|---|
invalid_api_key | Wrong or revoked key | Check dashboard for valid key |
model_not_found | Invalid model name | Use /models endpoint to list available |
context_length_exceeded | Input too long | Reduce input size or use different model |
insufficient_credits | No credits remaining | Purchase credits in dashboard |
rate_limit_exceeded | Too many requests | Implement backoff and queuing |