Offline assets and storage
Preloaded bytes
const tts = await KittenTTS.create({
modelFiles: {
onnxData,
voicesData,
},
});
This is suitable for app-managed browser downloads and packaged environments.
Node paths
const tts = await KittenTTS.create({
modelFiles: {
onnxPath: './models/kitten_tts_nano_v0_8.onnx',
voicesPath: './models/voices.npz',
},
});
Path-based model files are Node-only.
Built-in storage implementations
| Implementation | Use |
|---|---|
BrowserCacheAssetStorage | Cache API in normal browser origins |
MemoryAssetStorage | Tests, ephemeral sessions, and file:// fallback |
NodeFileAssetStorage | Node filesystem cache |
defaultAssetStorage() | Select appropriate runtime default |
Custom storage
Implement AssetStorage for IndexedDB, a service worker, Electron, or an application download manager, then pass storage to KittenTTS.create().
You can also pass a custom fetch implementation and modelBaseURL for authenticated or self-hosted asset delivery.
Self-host ONNX Runtime assets
const tts = await KittenTTS.create({
ortWasmPath: '/vendor/onnxruntime-web/',
});
The directory or explicit {wasm, mjs} map must match the installed ONNX Runtime Web version. Pass false only when the application configures ort.env.wasm itself.