Error Handling
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 fromkugelaudio (e.g. from kugelaudio import AudioChunk, StreamConfig).
AudioChunk
Represents a single audio chunk from streaming:AudioResponse
Complete audio response from generation: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 onStreamingSession.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 byclient.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 fromvoices.list():
Voice
Voice information (items invoices.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 byget, 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 byclient.asr.transcribe():
Next steps
- Quickstart: install and first generation
- Streaming: where
StreamConfigandSessionUsageare used