Skip to main content

Error Handling

All exceptions inherit from KugelAudioError: Every exception carries status_code, error_code (the server’s machine-readable code, when known), request_id (quote it to support), and retry_after (seconds, when the server or SDK suggests a wait).

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 (for example 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 of a streaming session. The session factories accept the common generation fields directly. Set the advanced fields (output_format, max_buffer_length, chunk_length_schedule, auto_mode) as keywords on session.update_config(...) before the first send; passing a whole StreamConfig there replaces every field, including ones you did not set.

Dictionary, DictionaryEntry & results

Enums

category, sex, and age on voice models are string enums defined in kugelaudio.models:
These enums describe response values. The API returns middle_age for VoiceAge. A category this SDK version does not know deserializes as CLONED and logs a warning. Use the Voice API reference for accepted write values.

VoiceListResponse

Paginated response from voices.list():

Voice

Voice information (items in voices.list().voices). The listing does not send sample_text, is_public, or verified, so they always hold their defaults here:

VoiceDetail

Extended voice information returned by get, create, update, and publish. get receives the listing shape, so generative_voice_description, is_public, verified, pending_verification, and sample_text hold their defaults there; create, update, and publish populate them.

VoiceReference

Voice reference audio metadata:

TranscriptionResponse

Returned by client.asr.transcribe():

Next steps

  • Quickstart: install and first generation
  • Streaming: where StreamConfig and SessionUsage are used
Last modified on September 23, 2026