Overview
Kokoro is an open-weight text-to-speech (TTS) model with 82 million parameters, paired with the `kokoro` Python inference library. Despite the small size, its authors say it produces quality comparable to larger models while running faster and at lower cost. The weights are Apache-licensed, so you can use it in both production and personal projects.
It's aimed at developers who need to turn text into speech without standing up heavy infrastructure. Because the model is small, it can run on modest hardware, including CPUs, which makes it a fit for local apps, batch jobs, and experiments where a large hosted TTS service would be overkill.
Within the speech and audio space, Kokoro covers the core text-to-speech task across several languages, including American and British English, Spanish, French, Hindi, Italian, Japanese, Brazilian Portuguese, and Mandarin Chinese. Under the hood it uses the `misaki` grapheme-to-phoneme library and `espeak-ng` for some fallbacks and non-English languages.
What it does
- Compact 82M-parameter model that runs on modest hardware, including CPUs
- Apache-licensed open weights, usable in production or personal projects
- Simple Python API through the `KPipeline` class
- Multilingual via per-language `lang_code` values (American/British English, Spanish, French, Hindi, Italian, Japanese, Brazilian Portuguese, Mandarin Chinese)
- Selectable voices (for example `af_heart`) plus adjustable speed and text-splitting
- Outputs 24 kHz audio you can save directly with soundfile
Getting started
Install the kokoro package and espeak-ng, then create a pipeline and generate audio from text. The example below mirrors the README's basic quickstart.
Install kokoro and espeak-ng
Install the kokoro library and soundfile from pip, plus the espeak-ng system package (used for English out-of-distribution fallback and some non-English languages). On Linux you can install espeak-ng with apt; on Windows download the installer from the espeak-ng releases page.
pip install kokoro>=0.9.4 soundfile
apt-get -y install espeak-ngGenerate and save audio
Create a KPipeline with a language code (here 'a' for American English), pick a voice, and write each chunk to a WAV file at 24 kHz.
from kokoro import KPipeline
import soundfile as sf
pipeline = KPipeline(lang_code='a')
text = 'Kokoro is an open-weight TTS model with 82 million parameters.'
generator = pipeline(text, voice='af_heart')
for i, (gs, ps, audio) in enumerate(generator):
print(i, gs, ps)
sf.write(f'{i}.wav', audio, 24000)Match voice to language
Make sure lang_code matches your chosen voice. Other codes include 'b' (British English), 'e' (Spanish), 'f' (French), 'h' (Hindi), 'i' (Italian), 'j' (Japanese), 'p' (Brazilian Portuguese), and 'z' (Mandarin Chinese). Japanese and Mandarin need extra misaki extras (pip install misaki[ja] or misaki[zh]).
Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Add local text-to-speech to an app without depending on a hosted TTS API
- Generate voiceovers or audio versions of articles and documents in batch
- Run speech synthesis on CPU-only or low-resource machines
- Prototype multilingual voice features across English, Spanish, French, Hindi, and more
How Kokoro compares
Kokoro alongside other open-source audio, music & voice tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Whisper | ★ 109k | OpenAI's speech recognition model that transcribes and translates audio across many languages. |
| GPT-SoVITS | ★ 61.7k | An open-source WebUI that clones a voice from a short audio sample and turns text into speech, with zero-shot and few-shot fine-tuning. |
| VibeVoice | ★ 54.1k | Microsoft's text-to-speech model for generating long, expressive multi-speaker audio like podcasts. |
| Coqui TTS | ★ 46k | A library of text-to-speech models including the multilingual XTTS voice-cloning model. |
| ChatTTS | ★ 39.8k | ChatTTS is an open-source text-to-speech model tuned for dialogue, with multi-speaker support and fine-grained control over laughter, pauses, and prosody. |
| OpenVoice | ★ 37.5k | OpenVoice clones a voice from a short reference clip and speaks in multiple languages, with control over emotion, accent, rhythm, and intonation. |
| MockingBird | ★ 36.9k | An open-source PyTorch toolbox that clones a voice from a short sample and generates Mandarin Chinese speech, with a web app, desktop toolbox, and command line. |
| Kokoro | ★ 8.8k | An 82M-parameter open-weight text-to-speech model that runs fast on modest hardware |
