Skip to main content

Cache and downloads

On native targets, first initialization downloads model and phonemizer assets into Application Support. Web resolves URLs and relies on browser HTTP caching.

Inspect​

final cache = await KittenTTS.cacheInfo(
const KittenTTSConfig(model: 'nano-int8'),
);

print(cache.isCached);

Predownload​

await KittenTTS.predownload(
const KittenTTSConfig(model: 'nano-int8'),
onProgress: (progress, info) => updateUI(progress, info),
);

Validate local assets​

await KittenTTS.validateAssets(config);

This is especially useful during tests for local modelFiles setups.

Redownload or clear​

await KittenTTS.redownloadModel(config, onProgress: setProgress);
await KittenTTS.clearModelCache(config);

Downloads write temporary .download files first. An interrupted transfer does not become a valid model. Avoid clearing cache during routine startup because it creates unnecessary network and startup work.