This project provides a FastAPI-based HTTP server for generating speech audio using Chatterbox TTS or Kokoro ONNX.
git clone https://github.com/Ladvien/speech_server.git
cd speech_serverWe use Poetry for managing dependencies.
poetry installpoetry run speech-serverOr:
poetry run uvicorn speech_server.server.app:app --host 0.0.0.0 --port 8000Access:
- API: http://localhost:8000
- Docs: http://localhost:8000/docs
curl -X POST http://localhost:8000/tts \
-H "Content-Type: application/json" \
-d '{"text": "Hello, world!", "voice": "default"}' \
--output hello.wavcurl http://localhost:8000/voicesUse config.yaml, environment variables, or Python config classes like TTSServerConfig.
tts_service: chatterbox # or 'kokoro'
voice: default
log_level: info
sample_rate: 24000- ✅ Chatterbox TTS (PyTorch)
- ✅ Kokoro ONNX (lightweight, GPU-ready)
- ✅ Voice cloning support
- ✅ Streaming endpoint
- ✅
/voicesAPI - ✅ YAML config support
- ✅ Ready for Docker or cloud deployment
To add a new TTS engine, subclass:
speech_server.common.base_tts_service.TTSService
Then register it via your config loader.
poetry run black .
poetry run isort .
poetry run pytestpoetry run mypy src/Build local docs:
cd docs
make htmlDocs live in /docs/source/ and are rendered via ReadTheDocs.
MIT © C. Thomas Brittain