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.0.tar.gz (12.0 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.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: speech_server-0.1.0.tar.gz
  • Upload date:
  • Size: 12.0 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.0.tar.gz
Algorithm Hash digest
SHA256 2051ee2e3026953267a1bc626b23aa75c6085172b830cfe5f0474ca91398da10
MD5 e712646c3bbc97fac2a088145a7a007e
BLAKE2b-256 f1c6d4b36cd5f4b19e80d2d4587056d0766f2f57007fb299a8c0d60deaed4514

See more details on using hashes here.

File details

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

File metadata

  • Download URL: speech_server-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d8bb6be8ce37a08b7cd9bb0374060ca73e9f1c85da58ad4a7ae247decbde1d9
MD5 f3cd7807be29384cc4bce125f00c910e
BLAKE2b-256 bd02dc94c8e6cc86a4ff6b8aa08c74dbaeff14366849e6a094b11f978a8d8fcf

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