API reference
Construction
KittenTTS.create(options?, onProgress?): Promise<KittenTTS>
Progress is between 0 and 1; stage metadata identifies downloads and cached assets.
Instance methods
| Method | Result | Description |
|---|---|---|
generate(text, voice?, speed?) | Promise<KittenTTSResult> | Generate without playback |
generateStreaming(text, voice?, speed?) | AsyncIterable<KittenTTSResult> | Yield sentence-group results |
speak(text, voice?, speed?) | Promise<KittenTTSResult> | Generate and play |
play(result, options?) | Promise<void> | Play an existing result |
dispose() | Promise<void> | Release engine resources |
Result
| Field or method | Type |
|---|---|
samples | Float32Array |
sampleRate | 24000 |
duration | number seconds |
voice | KittenVoice |
effectiveSpeed | number |
inputText | string |
wordTimings | KittenWordTiming[] |
wavData() | Uint8Array |
wavBase64() | string |
Static cache methods
isModelCached, isModelDownloaded, getModelCacheInfo, predownload, redownloadModel, and clearModelCache accept optional model configuration.
Errors
Use isKittenTTSError(error) and inspect error.code.
| Code | Meaning |
|---|---|
EMPTY_INPUT | Input is blank |
DOWNLOAD_FAILED | An asset could not be downloaded |
INVALID_MODEL_DATA | Cached or bundled model data is invalid |
PHONEMIZER_FAILED | Text-to-phoneme conversion failed |
INFERENCE_FAILED | ONNX setup or inference failed |
PLAYBACK_FAILED | The configured player failed |
TypeScript declarations in the published package are the authoritative signature source.