Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/KittenML/KittenTTS/llms.txt

Use this file to discover all available pages before exploring further.

The KittenTTS class is the primary interface for loading a model and synthesizing speech. It wraps an ONNX model downloaded from Hugging Face and exposes a simple API for generating audio.

Constructor

from kittentts import KittenTTS

tts = KittenTTS(
    model_name="KittenML/kitten-tts-nano-0.8",
    cache_dir=None,
)
model_name
str
default:"\"KittenML/kitten-tts-nano-0.8\""
Hugging Face repository ID for the model to load. Can be a full repo ID like KittenML/kitten-tts-mini-0.8 or just the model name.Available models:
ModelParametersSize
KittenML/kitten-tts-mini-0.880M80 MB
KittenML/kitten-tts-micro-0.840M41 MB
KittenML/kitten-tts-nano-0.815M56 MB
KittenML/kitten-tts-nano-0.8-int815M25 MB
cache_dir
str | None
default:"None"
Local directory path for caching downloaded model files. If None, uses the default Hugging Face cache directory (~/.cache/huggingface/hub).

Properties

available_voices

Returns the list of voice names supported by the loaded model.
tts = KittenTTS()
print(tts.available_voices)
# ['Bella', 'Jasper', 'Luna', 'Bruno', 'Rosie', 'Hugo', 'Kiki', 'Leo']
available_voices
list[str]
List of available voice names for the loaded model. Pass any of these strings as the voice argument to generate() or generate_to_file().

Methods

MethodDescription
generate()Synthesize speech and return a numpy array.
generate_to_file()Synthesize speech and save it directly to a file.

Legacy function

get_model() is a legacy wrapper kept for backward compatibility. Use KittenTTS() directly in new code.
from kittentts import get_model

tts = get_model(repo_id="KittenML/kitten-tts-nano-0.1", cache_dir=None)
get_model() defaults to KittenML/kitten-tts-nano-0.1. Pass repo_id explicitly or switch to KittenTTS() to use a current model.

Usage example

import soundfile as sf
from kittentts import KittenTTS

# Load the default nano model
tts = KittenTTS()

# List available voices
print(tts.available_voices)
# ['Bella', 'Jasper', 'Luna', 'Bruno', 'Rosie', 'Hugo', 'Kiki', 'Leo']

# Generate audio
audio = tts.generate("Hello, world!", voice="Luna")

# Save to file
tts.generate_to_file("Hello, world!", "hello.wav", voice="Luna")