Skip to content

πŸ”₯πŸ”₯ Kokoro in Rust. https://huggingface.co/hexgrad/Kokoro-82M Insanely fast, realtime TTS with high quality you ever have.

Notifications You must be signed in to change notification settings

lucasjinreal/Kokoros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

47 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Kokoro Rust

img

video-1737110239209.webm

Kokoro is a trending top 2 TTS model on huggingface. This repo provides insanely fast Kokoro infer in Rust, you can now have your built TTS engine powered by Kokoro and infer fast by only a command of koko.

kokoros is a rust crate that provides easy to use TTS ability. One can directly call koko in terminal to synthesize audio.

kokoros uses a relative small model 87M params, while results in extremly good quality voices results.

Languge support:

  • English;
  • Chinese (partly);
  • Japanese (partly);
  • German (partly);

πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯ Kokoros Rust version just got a lot attention now. If you also interested in insanely fast inference, embeded build, wasm support etc, please star this repo! We are keep updating it.

Currently help wanted! Implement OpenAI compatible API in Rust, anyone interested? Send me PR!

New Discord community: https://discord.gg/nN4tCXC6, Please join us if you interested in Rust Kokoro.

Updates

  • 2025.01.17: πŸ”₯πŸ”₯πŸ”₯ Style mixing supported! Now, listen the output AMSR effect by simply specific style: af_sky.4+af_nicole.5;
  • 2025.01.15: OpenAI compatible server supported, openai format still under polish!
  • 2025.01.15: Phonemizer supported! Now Kokoros can inference E2E without anyother dependencies! Kudos to @tstm;
  • 2025.01.13: Espeak-ng tokenizer and phonemizer supported! Kudos to @mindreframer ;
  • 2025.01.12: Released Kokoros;

Installation

  1. Initialize voice data:
python scripts/fetch_voices.py

This step fetches the required voices.json data file, which is necessary for voice synthesis.

  1. Build the project:
cargo build --release

Usage

Test the installation:

cargo run

For production use:

./target/release/koko -h        # View available options
./target/release/koko -t "Hello, this is a TTS test"

The generated audio will be saved to:

tmp/output.wav

OpenAI-Compatible Server

  1. Start the server:
cargo run -- --oai
  1. Make API requests using either curl or Python:

Using curl:

curl -X POST http://localhost:3000/v1/audio/speech \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "Hello, this is a test of the Kokoro TTS system!",
    "voice": "af_sky"
  }'

Using Python:

python scripts/run_openai.py

Roadmap

Due to Kokoro actually not finalizing it's ability, this repo will keep tracking the status of Kokoro, and helpfully we can have language support incuding: English, Mandarin, Japanese, German, French etc.

Copyright

Copyright reserved by Lucas Jin under Apache License.

About

πŸ”₯πŸ”₯ Kokoro in Rust. https://huggingface.co/hexgrad/Kokoro-82M Insanely fast, realtime TTS with high quality you ever have.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published