Kokoro FastAPI wraps the Kokoro-82M speech model in a FastAPI server with OpenAI-style speech endpoints, Docker images, and optional web UI.
Overview
The project packages Kokoro-82M for self-hosted text-to-speech behind HTTP and WebSocket APIs. Prebuilt images bundle models for CPU, NVIDIA CUDA, experimental AMD ROCm, and related variants, with pinned Hugging Face downloads and hash checks.
Speech routes follow OpenAI-compatible request shapes, while additional endpoints cover realtime TTS, ElevenLabs- and Cartesia-style agent websockets, phoneme utilities, captions with timestamps, SSML, and multi-speaker dialogue tags.
Voice features include weighted voice mixing, short aliases, optional reference-clip tuning, and multiple audio formats such as MP3, WAV, OPUS, FLAC, AAC, and PCM. Streaming responses target low latency on GPU hosts.
Operators can launch via docker run, Docker Compose with UI, or a local uv workflow on Apple Silicon using MPS. Community notes document integrations with assistants, readers, and home automation setups.
Key features
- OpenAI-compatible speech API
- Realtime and websocket TTS routes
- Multi-language Kokoro voices
- Docker and compose deployments
- Multi-speaker dialogue tags
- Caption and timestamp output
- Optional read-along web UI
Use cases
- Self-hosted narration for apps
- Voice agent backends
- Audiobook or reader pipelines
- Local GPU speech generation