Skip to main content

API reference

Construction

KittenTTS.create(options?, onProgress?): Promise<KittenTTS>

Instance APIs

MethodPurpose
generate(text, options?)Return one KittenTTSResult
stream(text, options?)Async generator of sentence results
speak(text, options?)Generate and play
play(result, options?)Play an existing result
createPlaybackQueue()FIFO playback queue
stopSpeaking() / stop()Stop active audio
pauseSpeaking()Pause supported player
resumeSpeaking()Resume supported player
isSpeakingCurrent playback state
dispose()Release engine and phonemizer resources

KittenTTSResult

samples, sampleRate, duration, voice, effectiveSpeed, inputText, wordTimings, wavData(), wavBase64(), mp3Data(options?), and mp3Base64(options?).

Cache APIs

cacheInfo, predownload, validateAssets, redownloadModel, and clearModelCache are static.

Public support types

The package exports model and voice helpers, progress and cache types, AssetStorage implementations, CEPhonemizer, MP3Encoder, PlaybackQueue, WAVEncoder, AudioPlayer, and AudioPlayOptions.

Errors

Use isKittenTTSError(error) and inspect KittenTTSErrorCode. The error family covers blank input, downloads, invalid assets, phonemization, inference, and playback.

The generated lib/index.d.ts from the pinned source commit is authoritative for exact signatures.