Skip to main content

Error Handling

All exceptions inherit from KugelAudioError:

Data Models

All models are importable from kugelaudio (e.g. from kugelaudio import AudioChunk, StreamConfig).

AudioChunk

Represents a single audio chunk from streaming:

AudioResponse

Complete audio response from generation:
The conversion and WAV helpers assume PCM16 output. When requesting ulaw_8000 or alaw_8000, consume audio as raw G.711 bytes instead.

WordTimestamp

Word-level time alignment for a generated audio chunk:

SessionUsage

Per-conversation usage for billing your own customers. Available on StreamingSession.last_usage (per session), MultiContextSession.usage_for(...) (per context), and AudioResponse.usage (per generate() request).
cost_cents is None (and cost_available is False) when the charge cannot be determined at session end — e.g. a transient billing error or an internal session. It is never a misleading 0. audio_seconds is always reported, so you can still reconcile from the audio you received.

Model

TTS model information (returned by client.models.list()):

StreamConfig

Configuration object for streaming sessions. The session factories accept the common generation fields directly. Use StreamConfig with session.update_config() before the first send when setting advanced fields such as output_format, max_buffer_length, chunk_length_schedule, or auto_mode.

Dictionary, DictionaryEntry & results

Enums

category, sex, and age on voice models are string enums defined in kugelaudio.models:
These are the SDK’s legacy response enums, not the API’s current create/update validation set. In particular, the API returns middle_age and may return newer categories not declared by VoiceCategory; an unrecognized category deserializes as CLONED. Use the Voice API reference for accepted write values.

VoiceListResponse

Paginated response from voices.list():

Voice

Voice information (items in voices.list().voices):

VoiceDetail

Extended voice information returned by get, create, update, and publish:

VoiceReference

Voice reference audio metadata:

Next steps

  • Quickstart — install and first generation
  • Streaming — where StreamConfig and SessionUsage are used