Errors
What a failed text-to-speech request returns, how to tell failures apart, and which ones to retry.
This page covers errors from POST /v1/text-to-speech,
POST /v1/text-to-speech/stream and the WebSocket.
The official Python and JavaScript SDKs turn every error below into a typed exception and retry the retryable ones for you.
Every error tells you four things
The body also keeps older keys (detail, and error on a 402 or 429) so
existing integrations keep working. New code should read error_code and
message.
Error codes
The list only grows: a code is never renamed, removed or given a new meaning. Treat a code you don’t recognise by its HTTP status.
Retrying
- Retry only when
retryableistrue. Every 4xx except 429 needs the request changed first. - Honour
Retry-Afterwhen present. Otherwise back off exponentially from about 0.5 s and give up after a few attempts. - Never retry a stream after you have received audio. It was charged, and the retry would play the start again. A request that fails before any audio is not charged.
Examples
A request with bad fields (422) lists every problem at once:
Insufficient credits (402):
Too many concurrent requests (429, with Retry-After: 1):
A stream that fails after audio has started can’t change its status any more, so the failure is the stream’s last event:
A stream that ends with neither a done nor an error event did not complete.
Errors from the API gateway
A few requests are refused before they reach the speech service. Their body has
only message and the gateway’s own request_id:

