Chat error codes
Failed requests return a non-2xx HTTP status with an error object:
json
{"error":{"code":"invalid_request","message":"message should not be empty","request_id":"req_..."}}Use code for program logic and message for diagnostic context.
| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_request | Invalid message or conversation parameters |
| 401 | invalid_api_key | Invalid, expired, or disabled key |
| 402 | insufficient_balance | Not enough credits |
| 403 | forbidden | Account or IP access is restricted |
| 404 | not_found | Conversation not found |
| 429 | rate_limited | Requests-per-minute limit exceeded |
| 500 | internal_error | Server error |
| 503 | upstream_unavailable | Chat or voice service is unavailable |
Check your request and credentials before retrying. For transient errors, wait before retrying; repeated message submissions may produce another reply.