Skip to main content

Offline-first Kokoro text-to-speech CLI and localhost service

Project description

Kokoro CLI

skills.sh

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.54.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kokoro_cli-0.4.0.tar.gz (534.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kokoro_cli-0.4.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

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

Hashes for kokoro_cli-0.4.0.tar.gz
Algorithm Hash digest
SHA256 15ae4205585db253ab3bc1d70443fa552d3c8cf422771b5535f2cbc5c0b1e020
MD5 f85dbd4cd534f4cb54745e009a3220c2
BLAKE2b-256 e3f8aa6a38ca75fd6176cf1ba4c27ab34063499f10f015416305af0dfa13a1f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for kokoro_cli-0.4.0.tar.gz:

Publisher: publish.yml on yoav0gal/kokoro-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for kokoro_cli-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b208fdda9f215b1d3eb72b9ca0a9d8ec1db41398c0a30c9318f3c70b3b3959c
MD5 78be65cf8f3814c4fb74d96a4add9a34
BLAKE2b-256 5f6ee4486c43934223e2ff7e947cd4e8408af78f4976b38b13235a2e37bd54af

See more details on using hashes here.

Provenance

The following attestation bundles were made for kokoro_cli-0.4.0-py3-none-any.whl:

Publisher: publish.yml on yoav0gal/kokoro-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page