Repolode
hexgrad

hexgrad/kokoro

Python inference library for Kokoro-82M, an open-weight text-to-speech model with 82 million parameters.

Stars
9,474
Forks
1,054
Open issues
214
Last commit
last year

What is it?

kokoro is an inference library for Kokoro-82M, a lightweight open-weight text-to-speech model. It can be installed from PyPI with pip and exposes a KPipeline class that turns text into audio, yielding graphemes, phonemes and audio chunks for each segment of input.

The library covers several languages through language codes, including American and British English, Spanish, French, Hindi, Italian, Brazilian Portuguese, and, with optional extras, Japanese and Mandarin Chinese. Voices are selected by name, such as af_heart, or can be loaded directly from a voice tensor file. English out-of-vocabulary fallback and some other languages rely on espeak-ng, which the setup instructions cover for Linux, macOS and Windows.

On Apple Silicon Macs, setting PYTORCH_ENABLE_MPS_FALLBACK=1 enables GPU acceleration. The project also provides a conda environment file for resolving dependency issues.

Key features

  • 01Installable from PyPI with pip and driven by a KPipeline class
  • 02Outputs graphemes, phonemes and audio for each text segment
  • 03Supports multiple English, European and Asian languages via language codes
  • 04Lets you choose named voices or load a voice tensor directly
  • 05Uses espeak-ng for English fallback and some languages
  • 06Enables Apple Silicon GPU acceleration through PyTorch MPS

Use cases

  • Adding speech output to Python applications or notebooks
  • Generating narration or voiceovers from long text split into segments
  • Running a lightweight TTS model on personal hardware or in production services

Quick start

  1. 1

    Install the library from PyPI

    pip install kokoro>=0.9.4 soundfile
  2. 2

    Install espeak-ng (used for English fallback and some non-English languages)

    apt-get -qq -y install espeak-ng
  3. 3

    Create a pipeline and generate speech from text

    pipeline = KPipeline(lang_code='a')

Things to know

  • Non-English languages and some features need extra steps such as espeak-ng or misaki extras.
  • Windows users must install espeak-ng manually from its releases page.

Topics

FAQ

What is kokoro?
Python inference library for Kokoro-82M, an open-weight text-to-speech model with 82 million parameters. kokoro is an inference library for Kokoro-82M, a lightweight open-weight text-to-speech model. It can be installed from PyPI with pip and exposes a KPipeline class that turns text into audio, yielding graphemes, phonemes and audio chunks for each segment of input.
Is kokoro free to use? What license does it have?
kokoro is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is kokoro still maintained?
No commits for 6+ months. The last commit to kokoro was on Aug 6, 2025.
What can I use kokoro for?
Adding speech output to Python applications or notebooks Generating narration or voiceovers from long text split into segments Running a lightweight TTS model on personal hardware or in production services
How do I install kokoro?
Install the library from PyPI: pip install kokoro>=0.9.4 soundfile Install espeak-ng (used for English fallback and some non-English languages): apt-get -qq -y install espeak-ng Create a pipeline and generate speech from text: pipeline = KPipeline(lang_code='a')
Where can I get kokoro?
The source code and installation instructions are on GitHub: https://github.com/hexgrad/kokoro

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects