Errors
Every error, warning and close code the Speech to Text (Beta) WebSocket can return.
How errors are reported
The Speech to Text WebSocket reports problems in two ways:
- An
Errormessage, sent immediately before the server closes the connection. - A WebSocket close code, which identifies the cause.
Decide what to do based on the close code, not the message text. The text is for people and may change. The exceptions are insufficient_credits, api_key_revoked, initial_timeout and idle_timeout, which are stable values.
Every Error closes the connection. There are no non-fatal errors on this endpoint.
Speech to Text and Text to Speech use different close codes. For example, an invalid API key closes a Speech to Text connection with 4001 and a Text to Speech WebSocket with 1008. For Text to Speech errors, see Errors & Warnings.
Close codes
A WebSocket request to an unknown path is rejected with HTTP 404 before the connection opens.
Low balance warning
When your balance reaches the warning threshold, the server sends one QuotaWarning message per session. This is not an error: the stream keeps running until credits run out (close 4005) or you close it.
remaining_funds is your remaining workspace balance in USD.
Recommended handling
Contacting support
Include the following in your support request:
- the
rawEvent.request_idfrom anypartialorfinalmessage on the connection - the close code and the
messagetext - the host you connected to
- the approximate time of the session
If the connection closed before any partial or final message (for example an auth failure with code 4001), there is no request_id. Include the time of the attempt, the host, how you sent the key, and the close code.