errors

Classification of the errors Soniox reports in-stream.

pipecat.services.soniox.errors.classify_error_code(error_code: Any) → ErrorCategory | None[source]

Classify the error_code of a Soniox error message.

Soniox’s STT and TTS websockets report an error as a message carrying an HTTP status code: 402 when the account is out of credit, 401 for a rejected key, and so on. Returns None when the code is missing or not a number, which the error frame reports as unknown.

Parameters:

error_code – The error_code field of the message.

Returns:

The matching category, or None when there is nothing to classify.