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.
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! NowKokoros
can inference E2E without anyother dependencies! Kudos to @tstm;2025.01.13
: Espeak-ng tokenizer and phonemizer supported! Kudos to @mindreframer ;2025.01.12
: ReleasedKokoros
;
- Initialize voice data:
python scripts/fetch_voices.py
This step fetches the required voices.json
data file, which is necessary for voice synthesis.
- Build the project:
cargo build --release
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
- Start the server:
cargo run -- --oai
- 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
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 reserved by Lucas Jin under Apache License.