Error Handling
KugelAudioError:
Every error carries
statusCode, errorCode (compare with the exported
ErrorCodes map; it can be undefined, for example on network failures),
requestId (quote it to support), and retryAfter (seconds) when known. The
package also exports WsCloseCodes for matching WebSocket close codes.
When the SDK can replay a turn transparently after a rolling deploy, it calls
the onServerRestart callback instead of failing; see the callback
interfaces below.
KugelAudioOptions
GenerateOptions
Using
normalize: true without language may cause incorrect normalizations. Always specify language when you know it.AudioChunk
WordTimestamp
AudioResponse
AudioResponse has no usage. Per-request usage is
available from stream() as GenerationStats.usage.
GenerationStats
SessionUsage
Per-conversation usage for billing your own customers. Available onStreamingSession.lastUsage (per session), MultiContextSession.usageFor(...)
and the onContextClosed callback (per context), and GenerationStats.usage
(per one-shot stream() request).
costCents is null (and costAvailable 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. audioSeconds is always reported.StreamCallbacks
Used with the one-shotclient.tts.stream() endpoint:
StreamConfig
Configuration forclient.tts.streamingSession() (LLM integration endpoint):
StreamingSessionCallbacks
Model
VoiceListResponse
Paginated response fromvoices.list():
Voice
The listing does not sendsampleText, isPublic, or verified, so they
always hold their defaults on Voice.
VoiceDetail
Extended voice information returned bycreate, update, get, and
publish. get receives the listing shape, so generativeVoiceDescription,
isPublic, verified, pendingVerification, and sampleText hold defaults
there; create, update, and publish populate them.
VoiceReference
CreateVoiceOptions
UpdateVoiceOptions
The SDK serializes
isPublic from UpdateVoiceOptions, but the current API
ignores that field on voice updates. Use voices.publish() to make a voice
public. The API’s generative_voice_description write field is not exposed
by CreateVoiceOptions or UpdateVoiceOptions.TranscriptionResponse
Returned byclient.asr.transcribe(). Its fields keep the server’s snake_case
names:
Next steps
- Quickstart: install and first generation
- Streaming: where
StreamConfigandSessionUsageare used