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 API —
POST /v1/audio/speechandGET /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
.ptvoice 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
These preferences are set automatically by default in recent Zotero versions. If Read Aloud isn't working, open Edit → Preferences → Advanced → Config Editor and verify (or manually set) the following:
| 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 |
If you're running the server on a different port (e.g. --port 9000), update baseURL to match — e.g. http://127.0.0.1:9000.
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
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 zotero_kokoro_server-0.1.1.tar.gz.
File metadata
- Download URL: zotero_kokoro_server-0.1.1.tar.gz
- Upload date:
- Size: 110.3 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a7fec4da33660ba743d56f759b9c495fc1988ba8e39de76c938e86215151540
|
|
| MD5 |
25aa006493a46359088a2ced8486fda7
|
|
| BLAKE2b-256 |
985601ee246025f96ee7fa16820b01b19fd306301b2c5dd08457a04496e02eaf
|
File details
Details for the file zotero_kokoro_server-0.1.1-py3-none-any.whl.
File metadata
- Download URL: zotero_kokoro_server-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.8 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5bd6974ffd9cbae16524537593d87e91cab8b0e4e9469e26f472d22dae63850
|
|
| MD5 |
059b668bf03688574771ee02c1b16a9b
|
|
| BLAKE2b-256 |
e9a8424c43a032e2f0e9f83ebb02844357fa4467a9add21b2a1ad25a692648ce
|