Offline-first Kokoro text-to-speech CLI and localhost service
Project description
Kokoro CLI
Offline text-to-speech for people and AI agents. Kokoro CLI runs Kokoro-82M locally, creates WAV, MP3, Opus, or M4A recordings, plays them on the host, and exposes an optional localhost API.
Audio generation is supported on Windows, macOS, and Linux with Python 3.11–3.13.
Windows playback through ffplay is experimental because automated CI cannot
prove audible output.
Quick start
Install the CLI from PyPI:
uv tool install kokoro-cli
kokoro setup
kokoro speak "Hello from Kokoro." --play --json
kokoro setup downloads and verifies the default model and voices, about 121 MB. Synthesis is offline after setup.
Install uv and optional FFmpeg on macOS with:
brew install uv ffmpeg
On Linux, use your package manager for FFmpeg. WAV works without it; MP3, Opus, M4A, and speeds above 2x require it. pipx install kokoro-cli is also supported.
On Windows, install uv, then run the same uv tool install kokoro-cli
command from PowerShell. Models, recordings, and configuration default to
%LOCALAPPDATA%\kokoro. Install FFmpeg to enable compressed formats, speeds
above 2x, and experimental --play support through ffplay.
Common commands
# Create and play a recording
kokoro speak "The build is finished." --play
# Pipe agent-friendly input and return a JSON receipt
printf '%s' "Here is your summary." | kokoro speak --format mp3 --json
# Choose a voice, speed, format, and output path
kokoro speak "A slower reading." --voice bf_emma --speed 0.85 -o recording.opus
# Discover voices and manage persistent defaults
kokoro voices
kokoro config --json
kokoro config --voice bf_emma --speed 1.15
kokoro config --reset
# Verify the installation
kokoro doctor --json
The default is af_heart at 1.0x; supported speeds are 0.5–4.0. Run kokoro <command> --help for all options.
Recordings and models use the platform user-data directory. Override it with KOKORO_HOME, KOKORO_MODEL_DIR, or KOKORO_RECORDING_DIR.
Agent skill
Install the standalone read-aloud skill globally for Codex:
npx skills add yoav0gal/kokoro-cli --skill read-aloud --global --agent codex --yes
The skill is installed separately from this repository. It invokes the global kokoro command and installs kokoro-cli from PyPI when needed.
Local API
Start the localhost service:
kokoro serve
Then request speech through the OpenAI-shaped endpoint:
curl -sS http://127.0.0.1:8765/v1/audio/speech \
-H 'Content-Type: application/json' \
-d '{"input":"Your agent has finished the task.","voice":"af_heart","response_format":"mp3"}' \
-o agent-message.mp3
The service only accepts localhost connections. speak uses a healthy service automatically and falls back to embedded inference; use --service required or --service off for strict behavior.
Development
git clone https://github.com/yoav0gal/kokoro-cli.git
cd kokoro-cli
./kokoro setup
./kokoro doctor --json
uv run --frozen pytest -q
The checkout wrapper keeps its environment, models, and recordings inside the repository.
On Windows, use uv run --frozen kokoro setup and
uv run --frozen kokoro doctor --json from the checkout.
More
Kokoro-82M weights are Apache 2.0, kokoro-onnx is MIT, and model assets come from the model-files-v1.0 release of thewh1teagle/kokoro-onnx. See third-party notices.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kokoro_cli-0.4.0.tar.gz.
File metadata
- Download URL: kokoro_cli-0.4.0.tar.gz
- Upload date:
- Size: 534.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15ae4205585db253ab3bc1d70443fa552d3c8cf422771b5535f2cbc5c0b1e020
|
|
| MD5 |
f85dbd4cd534f4cb54745e009a3220c2
|
|
| BLAKE2b-256 |
e3f8aa6a38ca75fd6176cf1ba4c27ab34063499f10f015416305af0dfa13a1f2
|
Provenance
The following attestation bundles were made for kokoro_cli-0.4.0.tar.gz:
Publisher:
publish.yml on yoav0gal/kokoro-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kokoro_cli-0.4.0.tar.gz -
Subject digest:
15ae4205585db253ab3bc1d70443fa552d3c8cf422771b5535f2cbc5c0b1e020 - Sigstore transparency entry: 2235075796
- Sigstore integration time:
-
Permalink:
yoav0gal/kokoro-cli@b0c0bdf9eeacfbb94be1616b693d5c10a12e6845 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/yoav0gal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b0c0bdf9eeacfbb94be1616b693d5c10a12e6845 -
Trigger Event:
release
-
Statement type:
File details
Details for the file kokoro_cli-0.4.0-py3-none-any.whl.
File metadata
- Download URL: kokoro_cli-0.4.0-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b208fdda9f215b1d3eb72b9ca0a9d8ec1db41398c0a30c9318f3c70b3b3959c
|
|
| MD5 |
78be65cf8f3814c4fb74d96a4add9a34
|
|
| BLAKE2b-256 |
5f6ee4486c43934223e2ff7e947cd4e8408af78f4976b38b13235a2e37bd54af
|
Provenance
The following attestation bundles were made for kokoro_cli-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on yoav0gal/kokoro-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kokoro_cli-0.4.0-py3-none-any.whl -
Subject digest:
3b208fdda9f215b1d3eb72b9ca0a9d8ec1db41398c0a30c9318f3c70b3b3959c - Sigstore transparency entry: 2235076221
- Sigstore integration time:
-
Permalink:
yoav0gal/kokoro-cli@b0c0bdf9eeacfbb94be1616b693d5c10a12e6845 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/yoav0gal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b0c0bdf9eeacfbb94be1616b693d5c10a12e6845 -
Trigger Event:
release
-
Statement type: