Favicon of Kokoro-FastAPI

Kokoro-FastAPI

A self-hosted text-to-speech API runs Kokoro-82M on CPU or GPU, with OpenAI-compatible requests, multiple speakers and caption timestamps.

Alternative to:

Kokoro-FastAPI generates speech on your own machine or server using Kokoro-82M. It's for developers adding narration to reading apps, audiobooks or voice assistants through an OpenAI-compatible speech API.

  • Dialogue and voice mixing: Generate passages with multiple speakers, blend voices in weighted proportions and save the blends for reuse.
  • Speech control: Adjust pauses and speaking pace within a passage, and specify English pronunciations for individual words.
  • Streaming and read-along: Play speech while generation continues, with an optional browser interface for reading along with long passages.
  • Captions and exports: Generate word or chunk timestamps for captions and export audio as MP3, WAV, Opus, FLAC, AAC or PCM.
  • Languages: Generate speech in US and British English, Spanish, French, Hindi, Italian, Japanese, Brazilian Portuguese and Mandarin Chinese.

The project is open source under Apache 2.0. Linux Docker images support CPU and NVIDIA GPU execution on x86-64 and ARM64. Apple Silicon GPU acceleration requires running directly on macOS rather than in Docker. Smaller streaming chunks can introduce intonation artifacts.

Community integrations include Home Assistant through wyoming_openai and openai_tts. Reading tools such as openreader, epub_to_audiobook and Zotero-TTS also use it as a speech backend.

Similar to Kokoro-FastAPI