Skip to main content

FastAPI wrapper for Chatterbox TTS

Project description

🗣️ 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:


🧪 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

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

speech_server-0.1.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

speech_server-0.1.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file speech_server-0.1.1.tar.gz.

File metadata

  • Download URL: speech_server-0.1.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.10 Darwin/24.5.0

File hashes

Hashes for speech_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 772232d17f6c2336662dfe3365b2dec2e630dd8d46ff22168fba0e83028700e6
MD5 554326341487c40e265f45e5848a939f
BLAKE2b-256 5559c11b6c9bc0ade421e29e8381665551d6a6d3085203e8ae0106ea4b77e309

See more details on using hashes here.

File details

Details for the file speech_server-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: speech_server-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.10 Darwin/24.5.0

File hashes

Hashes for speech_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 03add7def24a43155f0fc3055d9576a8fc211c4719b0e04bc31ee594a758c15a
MD5 ae5f2e860b5fe933a58d2840c7c72f71
BLAKE2b-256 748525cb31a952ae8303873f9d76ee220f2f857f2d9816349b3e5f7712e29d8f

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