The official Python SDK for KugelAudio provides a simple, Pythonic interface for text-to-speech generation with both synchronous and asynchronous support.
Installation
Or with uv (recommended):
Quick Start
Local turn detection with dialogue history
The optional kugelaudio[turn-detection] runtime accepts prior dialogue separately
from the current user transcript. History requires a bundle trained and evaluated
for multiple context messages; existing single-message bundles reject nonempty
history. With a session created from a compatible detector:
Supply only prior messages already known at scoring time and assistant text
actually spoken. update_history() replaces the supplied history; reset_turn()
retains it, and reset_conversation() clears it. The SDK keeps the newest context
within the bundle’s message and token limits and never adds speculative endpoints
to history. Confirmed interruption feedback remains separate from dialogue text.
Pre-connecting for Low Latency
For latency-sensitive applications, pre-establish the WebSocket connection at startup to keep the handshake out of your first TTS request — see Latency.
Async Applications (Recommended)
Sync Applications
For synchronous code that needs connection reuse, keep a streaming session
open across sends:
The synchronous generate() and stream() wrappers create and close a
connection on their own event-loop thread, so client.connect() does not
pre-connect those calls. Use the async API or streaming_session_sync() when
connection reuse matters. See Latency for measurement guidance.
Complete Example
Next steps
- Configuration — client options, lifecycle, region selection
- Generate Speech — one-shot generation, parameters, word timestamps
- Streaming — streaming sessions, barge-in, multi-context sessions
- Text Normalization — languages and spell tags
- Voices — list, create, and manage voices
- Dictionaries — per-project pronunciation lists
- Types & Errors — exceptions, data models, enums
Last modified on September 8, 2026