Skip to main content

Error Handling

All errors extend KugelAudioError and carry a machine-readable code. The package also exports the ErrorCodes and WsCloseCodes constant maps for matching specific codes when you need finer-grained handling than the classes above.

KugelAudioOptions

GenerateOptions

Using normalize: true without language may cause incorrect normalizations. Always specify language when you know it.

AudioChunk

WordTimestamp

AudioResponse

GenerationStats

SessionUsage

Per-conversation usage for billing your own customers. Available on StreamingSession.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 — e.g. a transient billing error or an internal session. It is never a misleading 0. audioSeconds is always reported.

StreamCallbacks

Used with the one-shot client.tts.stream() endpoint:

StreamConfig

Configuration for client.tts.streamingSession() (LLM integration endpoint):

StreamingSessionCallbacks

Model

VoiceListResponse

Paginated response from voices.list():

Voice

VoiceCategory and VoiceAge are legacy SDK declarations, not the API’s current write-value set. The API can return newer category strings and uses middle_age (not the declared middle_aged); the JavaScript mapper does not transform those values, so runtime data can fall outside these unions. Use the Voice API reference for accepted create/update values.

VoiceDetail

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

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.

Dictionary types live on the Dictionaries page; multi-context types live on the Streaming Sessions page.