Skip to main content

Local OpenAI-compatible Kokoro TTS server with browser UI, designed for Zotero Read Aloud

Project description

zotero-kokoro-server

A local Kokoro TTS server with an OpenAI-compatible API and browser UI, designed for Zotero Read Aloud.

Features

  • OpenAI-compatible APIPOST /v1/audio/speech and GET /v1/voices
  • Browser UI at http://localhost:8880 — voice playground, stats dashboard, voice upload
  • In-memory audio cache — repeated requests are served instantly
  • Voice upload — drop a .pt voice file in the UI to add new voices
  • Works fully offline after initial model download

Requirements

  • Python 3.10–3.12 (Kokoro does not yet support 3.13+)

Install

pip install zotero-kokoro-server

Run

zotero-kokoro-server

Then open http://localhost:8880 in your browser to access the UI.

Options:

--host          Bind address (default: 127.0.0.1, env: KOKORO_HOST)
--port          Port (default: 8880, env: KOKORO_PORT)
--default-voice Default voice ID (default: af_heart, env: KOKORO_DEFAULT_VOICE)
--repo-id       Hugging Face repo (default: hexgrad/Kokoro-82M, env: KOKORO_REPO_ID)
--cache-size    Max in-memory audio cache entries (default: 256)

The first run downloads model weights (~300MB) from Hugging Face. After that it runs offline. To pre-cache everything and then go fully offline:

# Run once online to cache model + SpaCy language model
zotero-kokoro-server

# Subsequent runs can use offline mode
HF_HUB_OFFLINE=1 zotero-kokoro-server

Configure Zotero

In Zotero, open Edit → Preferences → Advanced → Config Editor and set:

Preference Value
extensions.zotero.reader.readAloudLocal.enabled true
extensions.zotero.reader.readAloudLocal.baseURL http://127.0.0.1:8880
extensions.zotero.reader.readAloudLocal.protocol openai
extensions.zotero.reader.readAloudLocal.openAIPath /v1/audio/speech
extensions.zotero.reader.readAloudLocal.voicesPath /v1/voices

Then open a PDF in the Reader and use the Read Aloud toolbar button.

API

# Health check
curl http://127.0.0.1:8880/health

# List voices
curl http://127.0.0.1:8880/v1/voices

# Synthesize
curl -X POST http://127.0.0.1:8880/v1/audio/speech \
  -H 'Content-Type: application/json' \
  -d '{"voice":"af_heart","input":"Hello world","response_format":"wav"}' \
  --output out.wav

# Server stats
curl http://127.0.0.1:8880/api/stats

# Clear audio cache
curl -X POST http://127.0.0.1:8880/api/cache/clear

License

MIT

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

zotero_kokoro_server-0.1.0.tar.gz (110.2 kB view details)

Uploaded Source

Built Distribution

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

zotero_kokoro_server-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file zotero_kokoro_server-0.1.0.tar.gz.

File metadata

  • Download URL: zotero_kokoro_server-0.1.0.tar.gz
  • Upload date:
  • Size: 110.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for zotero_kokoro_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7e78a89bf0167855cfab14e21dfa0171cd49fd30155c0e04999cccfa0c5c24c
MD5 5fb8298434ba95d1b92352b5fc1f1361
BLAKE2b-256 8580c7ff5092992385baff203a581a546d57bc6fcd17cfb00a7aa4810e390b67

See more details on using hashes here.

File details

Details for the file zotero_kokoro_server-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zotero_kokoro_server-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for zotero_kokoro_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8d46bbd0d9b3d76bbb28ae0ed57697e44932ced1a8b54ee8cc57fb756854af0
MD5 bd2283b0e22cf808dae52baae33a726d
BLAKE2b-256 9f5be05d6f0da0338ccd361af799a49d86d8d1e6ca2dbce53f92b7f4dfce50bb

See more details on using hashes here.

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