Skip to main content

🗣️ Speech Server – TTS API with Chatterbox & Kokoro

This project provides a FastAPI-based HTTP server for generating speech audio using Chatterbox TTS or Kokoro ONNX.


🚀 Quick Start

1. Clone the Repo

git clone https://github.com/Ladvien/speech_server.git
cd speech_server

2. Install Dependencies

We use Poetry for managing dependencies.

poetry install

3. Run the Server

poetry run speech-server

Or:

poetry run uvicorn speech_server.server.app:app --host 0.0.0.0 --port 8000

Access:

  • API: http://localhost:8000
  • Docs: http://localhost:8000/docs

🧪 Example Usage

Generate Audio from Text

curl -X POST http://localhost:8000/tts \
     -H "Content-Type: application/json" \
     -d '{"text": "Hello, world!", "voice": "default"}' \
     --output hello.wav

List Voices

curl http://localhost:8000/voices

⚙️ Configuration

Use config.yaml, environment variables, or Python config classes like TTSServerConfig.

tts_service: chatterbox  # or 'kokoro'
voice: default
log_level: info
sample_rate: 24000

🧠 Features

  • ✅ Chatterbox TTS (PyTorch)
  • ✅ Kokoro ONNX (lightweight, GPU-ready)
  • ✅ Voice cloning support
  • ✅ Streaming endpoint
  • ✅ /voices API
  • ✅ YAML config support
  • ✅ Ready for Docker or cloud deployment

🧩 Extend It

To add a new TTS engine, subclass:

speech_server.common.base_tts_service.TTSService

Then register it via your config loader.


🛠 Dev Tools

Lint, Format, Test

poetry run black .
poetry run isort .
poetry run pytest

Type Check

poetry run mypy src/

📚 Documentation

Build local docs:

cd docs
make html

Docs live in /docs/source/ and are rendered via ReadTheDocs.


📄 License

MIT © C. Thomas Brittain

Metadata

Release files for speech-server 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speech-server 0.1.1
File Size Uploaded
speech_server-0.1.1.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for speech-server 0.1.1
File Interpreter ABI Platform
speech_server-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.6 kB

Release files / speech_server-0.1.1.tar.gz

Download URL speech_server-0.1.1.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
772232d17f6c2336662dfe3365b2dec2e630dd8d46ff22168fba0e83028700e6
BLAKE2b-256 checksum
How to use checksums
5559c11b6c9bc0ade421e29e8381665551d6a6d3085203e8ae0106ea4b77e309
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.10 Darwin/24.5.0

Release files / speech_server-0.1.1-py3-none-any.whl

Download URL speech_server-0.1.1-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03add7def24a43155f0fc3055d9576a8fc211c4719b0e04bc31ee594a758c15a
BLAKE2b-256 checksum
How to use checksums
748525cb31a952ae8303873f9d76ee220f2f857f2d9816349b3e5f7712e29d8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.10 Darwin/24.5.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page