REST speech generation with Python SDK
Convert text to speech with the Soniox Python SDK
Soniox Python SDK supports asynchronous Text-to-Speech generation with AsyncSonioxClient.
You can generate speech directly to audio bytes or write output to a file.
Quickstart
The SDK provides a convenient generate_to_file method for writing audio output directly to disk.
Generate to bytes
Use generate when you want audio bytes in memory (for custom storage, streaming, or post-processing).
Generate to file
Use generate_to_file when you want the SDK to write output for you.
Use typed config (CreateTtsConfig)
You can pass generation options through CreateTtsConfig.
Error handling
Handle SonioxAPIError to inspect API-level failures.
For raw HTTP integration details, see TTS REST API error handling.