Errors
Read and handle API errors consistently.
Check the HTTP status and error.code. Save error.request_id or the X-Request-Id header for support.
{
"error": {
"message": "Authentication failed",
"type": "authentication_error",
"code": "auth_failed",
"param": null,
"request_id": "<request-id>"
}
}| Status | Meaning | What to do |
|---|---|---|
400 | Invalid input | Correct the request before retrying. |
401 | Missing or invalid credentials | Check your API key. |
402 | Insufficient balance | Add credit. |
403 | Missing permission or generation suspended | Check error.code and account access. |
404 | Resource unavailable | Check the ID and your access. |
409 | Duplicate or conflicting request | Check operation status. |
413 | Request too large | Reduce the input or upload size. |
429 | Rate, concurrency, or capacity limit | Wait for Retry-After, then retry with backoff. |
5xx | Service failure | Check accepted operations before retrying; use bounded backoff and an idempotency key. |
Errors after audio streaming starts interrupt the response instead of returning JSON. An HTTP 200 alone does not prove completion. See Streaming audio for partial audio and billing.