Errors
Every error has the same JSON shape:
{ "error": { "type": "invalid_request_error", "code": "input_too_long", "message": "input exceeds 5000 characters", "param": "input", "request_id": "req_9f8e7d6c5b4a3f2e1d0c" }}typegroups errors by kind.codeis the specific error; branch on it in your code.paramnames the request field that caused the error, when there is one.request_idmatches thex-request-idresponse header.
Error codes
Section titled “Error codes”| HTTP | type |
codes |
|---|---|---|
| 400 | invalid_request_error |
invalid_json, missing_param, invalid_param, input_too_long, invalid_audio |
| 401 | authentication_error |
missing_api_key, invalid_api_key, revoked_api_key, expired_api_key |
| 404 | not_found_error |
route_not_found, not_found |
| 413 | invalid_request_error |
file_too_large |
| 422 | invalid_request_error |
unsupported_media_type, audio_too_long |
| 429 | rate_limit_error |
rate_limit_exceeded, with a Retry-After header |
| 500 | api_error |
internal_error |
| 503 | service_unavailable_error |
inference_unavailable, server_busy, both with a Retry-After header |
Retrying
Section titled “Retrying”Retry 429 and 503 responses after the number of seconds in the Retry-After header. Don’t retry 4xx errors without changing the request.

