Installation
Quick Start
Synchronous (Simple)
Asynchronous
Configuration
Global Configuration
Client-Based Configuration
Using Models
Base Model
The Base model provides fast, high-quality TTS with 54+ voices:Advanced Model
The Advanced model supports voice cloning and expressiveness controls:API Reference — Module-Level Functions
Synchronous Functions
These use the global API key set viaaudixa.set_api_key().
| Function | Description | Returns |
|---|---|---|
tts(text, voice_id, ...) | Start a TTS job (async workflow) | str (generation_id) |
status(generation_id) | Check generation status | dict |
tts_and_wait(text, voice_id, ...) | Generate and wait for completion | str (audio_url) |
tts_to_file(text, filepath, voice_id, ...) | Generate and save to file | str (filepath) |
list_voices(model, ...) | List available voices | list[dict] |
history(limit, ...) | Get generation history | list[dict] |
Asynchronous Functions
| Function | Description | Returns |
|---|---|---|
atts(text, voice_id, ...) | Start a TTS job (async) | str (generation_id) |
astatus(generation_id) | Check generation status | dict |
atts_and_wait(text, voice_id, ...) | Generate and wait | str (audio_url) |
atts_to_file(text, filepath, voice_id, ...) | Generate and save to file | str (filepath) |
alist_voices(model, ...) | List available voices | list[dict] |
ahistory(limit, ...) | Get generation history | list[dict] |
Common Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
text | str | — | Text to convert (required) |
voice_id | str | — | Voice identifier (required) |
model | str | "base" | "base" or "advanced" |
speed | float | 1.0 | Speed multiplier: 0.5–2.0 |
cfg_weight | float | None | Advanced model: guidance strength 1.0–5.0 |
exaggeration | float | None | Advanced model: expressiveness 0.0–1.0 |
audio_format | str | None | Output format: "wav" or "mp3" |
custom_endpoint_slug | str | None | Route to custom endpoint |
poll_interval | float | 1.0 | Seconds between status checks (wait functions) |
timeout | float | 120.0 | Max wait time in seconds (wait functions) |
Client API Reference
AudixaClient (Synchronous)
AsyncAudixaClient (Asynchronous)
Error Handling
The SDK provides specific exception classes for different error scenarios:Exception Hierarchy
| Exception | HTTP Code | Description |
|---|---|---|
AudixaError | — | Base exception class |
AuthenticationError | 401 | Invalid or missing API key |
InsufficientBalanceError | 402 | Account balance too low |
RateLimitError | 429 | Rate limit exceeded (has retry_after) |
ValidationError | 400/422 | Invalid parameters |
NetworkError | — | Network connectivity issue |
TimeoutError | — | Request or polling timeout |
GenerationError | — | TTS generation failed (has generation_id) |
UnsupportedFormatError | — | Invalid audio format (has supported_formats) |