← Back to Leaderboard
Kremsky

remsky/Kokoro-FastAPI

Self-hosted Kokoro-82M speech inference over OpenAI-compatible HTTP and voice WebSockets

View on GitHub ↗
Engineering Health (Methodology)
A+ · 97/100
Maintenance Activity
● Updated 3d ago
Latest Release
v0.10.0
Commercial License Check
Apache-2.0 · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption22/25
Release Cadence20/20
License Clarity20/20
Self-HostedDockerGPUAPI
Total Stars
★ 5,756
24h Growth
+2
7d Growth
+14
Forks
960

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

remsky/Kokoro-FastAPI Star History (2024-12-29 - 2026-12-03) ALL-TIME STAR HISTORY (2024-12 – 2026-12) +5.8k in 704d · avg +8/day 6.1k 3k 0 2024-12-29: ★ 12025-02-15: ★ 1,3962025-04-05: ★ 2,1612025-05-24: ★ 2,7192025-07-12: ★ 3,1162025-08-30: ★ 3,4582025-10-18: ★ 3,7112025-12-06: ★ 3,9472026-01-24: ★ 4,2372026-03-14: ★ 4,4932026-05-02: ★ 4,7352026-06-20: ★ 5,0002026-08-08: ★ 5,2732026-09-26: ★ 5,4672026-11-08: ★ 5,6552026-12-03: ★ 5,756 ★ 5.8k 2024-12 2025-12 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

Kokoro-FastAPI serves Kokoro-82M as a self-hosted text-to-speech inference service. The Python API under api/ uses FastAPI, Uvicorn, and Pydantic around a PyTorch synthesis runtime. Dependencies include kokoro==0.9.4, inno-kokoro==0.3.0, espeakng-loader==0.2.4, and soundfile==0.13.0. Requests provide text, a voice or weighted voice mix, and output options; normalization and chunking prepare the text for synthesis, and the service can stream back encoded audio without waiting for the full passage.

The same synthesis service exposes different client contracts: /v1/audio/speech for OpenAI-style HTTP clients, /v1/realtime for OpenAI-style Realtime clients, and ElevenLabs- and Cartesia-compatible WebSockets for voice agents. OpenAI voice mappings can be customized in api/src/core/openai_mappings.json; request-scoped voice_aliases help manage longer mix names. The optional web interface at /w provides a read-along path without requiring a custom API client.

Key Capabilities & Differentiators

The service supports multilingual synthesis, voice discovery, weighted voice-pack mixing, and export of combined voice packs. The Speech API supports MP3, WAV, Opus, FLAC, AAC, and PCM. /v1/realtime emits 24 kHz PCM and accepts response.cancel; it reads supplied text as written, ignores instructions, and returns errors for audio input and conversation events. The ElevenLabs and Cartesia WebSockets support 8–48 kHz PCM, with MP3 also on the ElevenLabs route, and word timestamps where available from Kokoro, including English and eSpeak languages. Cartesia cancel stops its context; ElevenLabs close_context finishes text already submitted.

Chunk sizing directly affects both playback responsiveness and prosody. Reported first-output latency is roughly 300 ms on GPU at chunk size 400, 3.5 seconds on an older Core i7 at 200, and under a second on an M3 Pro at 200. Those are different hardware and chunk settings, not a controlled CPU–GPU comparison or a production latency guarantee. Smaller chunks can introduce intonation artifacts, so measure both time to first audio and continuity on representative scripts.

Trade-offs & Limitations

Compared with managed ElevenLabs, this service is a fit when the priority is keeping synthesis on infrastructure you control while reusing an existing TTS client. Compatibility is at the speech protocol level, not at the level of voice catalogs, output quality, or broader provider features. Compared with embedding Kokoro directly in a Python application, the service gives multiple clients a shared HTTP and WebSocket interface, at the cost of another process to operate. Its local examples use placeholder API keys; treat those as SDK configuration, not evidence of production authentication. Restrict network exposure and add access controls appropriate to the deployment.

Model eviction trades VRAM for cold-start latency. POST /dev/unload and optional idle eviction free model allocations, but the reported CUDA setup retained a 2.37 GB floor. The short and long workloads reclaimed 758 MiB and 1,656 MiB respectively, and the next request paid about 4.9–5.1 seconds to reload. The idle timer is off by default. Size capacity with concurrent streams and representative text, and keep the model resident if first-audio latency is a hard requirement unless measurements show eviction fits the budget.

Hardware & Deployment Guide

For a first deployment, run the CPU image or select the NVIDIA image that matches the host: the documented x86 defaults use CUDA 12.6, Blackwell has a -cu128 variant, and NVIDIA arm64 uses CUDA 12.9 under the regular GPU tag. AMD ROCm is experimental and x86_64-only; its container takes /dev/kfd and /dev/dri. Apple Silicon can use native MPS via ./start-gpu_mac.sh. The default service port is 8880; Docker Compose configurations include docker/gpu and docker/rocm. Direct runs use uv with Python 3.10+ and can use system eSpeak NG as a fallback.

Published images include weights and are best pinned to a release tag. The download path pins the upstream revision, verifies weights against a hardcoded SHA-256, and tries a release mirror on verification failure; if the mirror also fails validation, the server does not start. Use the bundled weights when staging deployments without network access. The v0.10.0 release added the provider-compatible WebSockets and Realtime TTS; v0.9.2 addressed normalization edge cases around decimal separators and ellipses. Set ENABLE_WEBSOCKET_TTS=false when only HTTP synthesis is needed.

HTTP integration: /v1/audio/speech supports OpenAI SDK streaming with MP3, WAV, Opus, FLAC, AAC, and PCM output.
Realtime protocols: v0.10.0 adds TTS-only /v1/realtime and ElevenLabs- and Cartesia-compatible WebSockets for voice agents.
Voice control: Mix voice packs by weight, such as af_bella(2)+af_heart(1), shorten names with request-scoped aliases, or export a mix as a .pt file.
Audio contracts: Realtime is fixed at 24 kHz PCM; the ElevenLabs and Cartesia routes support 8–48 kHz PCM, with MP3 also available on the ElevenLabs route.
Model lifecycle: POST /dev/unload releases model VRAM; MODEL_AUTO_UNLOAD_TIMEOUT_SECONDS enables idle eviction and leaves reload to the next request.
Artifact integrity: Weight downloads are checked against a hardcoded SHA-256, with a verified mirror fallback and startup blocked if verification fails.
Best For

Teams adding local streaming TTS to voice agents, smart-home assistants, readers, or audiobook pipelines that can use Kokoro voices and have time to test target hardware.

Skip If

You need a full duplex speech-to-speech API, exact parity with a managed provider’s voices and events, or a hosted service that takes infrastructure and capacity management off your plate.

Reviewed on 2026-12-02 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

Self-HostedDockerGPUAPI
docker run -p 8880:8880 ghcr.io/remsky/kokoro-fastapi-cpu:latest

Comparison vs. Top Voice, Vision & Video Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
Kokoro-FastAPI ★5.8k+14PythonApache-2.0Self-hosted Kokoro-82M speech inference over OpenAI-compatible HTTP and voice We
fish-speech34k+84Python—Self-hosted PyTorch speech inference for directed, multi-speaker audio
EmotiVoice8.5k—PythonApache-2.0Self-hosted PyTorch TTS for prompt-controlled Chinese and English speech
voicebox61.8k+437PythonMITLocal-first voice studio with multi-engine speech synthesis, dictation and MCP.

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/remsky/Kokoro-FastAPI.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

remsky/Kokoro-FastAPI Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about Kokoro-FastAPI

How do I switch an existing OpenAI TTS client to Kokoro-FastAPI?

Point the OpenAI SDK at http://localhost:8880/v1, call audio.speech with model="kokoro", and select a Kokoro voice such as af_bella. The HTTP endpoint streams audio bytes; /v1/realtime instead returns audio delta events and does not accept audio input. OpenAI SDK 2.x needs an explicit websocket_base_url="ws://localhost:8880/v1" for the local, non-TLS Realtime connection.

Do I need a GPU, and how much VRAM should I budget?

Start with CPU for functional tests or latency-tolerant workloads, then benchmark the target hardware using your actual text lengths, chunk sizes, and concurrent streams. For the reported CUDA unload tests, loaded memory was 3.11 GB for short audio and 3.98 GB for long-form audio, with a 2.37 GB floor after unload. Reload added about five seconds. Use those figures to understand the lifecycle trade-off, not as minimum GPU requirements.

Can I deploy this commercially or handle sensitive text with it?

The repository is Apache-2.0 licensed. For a commercial deployment, review the terms for the model weights, voice packs, and bundled dependencies separately, along with any obligations when redistributing an image. Self-hosting lets you choose where synthesis runs, but does not by itself settle access control, logging, retention, or consent for any voices you supply.

Can I replace ElevenLabs without rewriting my voice agent?

It can replace ElevenLabs for a narrower job: streaming TTS from a voice agent. LiveKit Agents and Pipecat integrations can point an ElevenLabs-compatible client at the local service and use Kokoro voice IDs. Test sample rates, timestamps, and context lifecycle before migrating: close_context finishes text already submitted rather than stopping generation immediately. Do not assume voice parity or coverage of other provider APIs.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining remsky/Kokoro-FastAPI? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature remsky/Kokoro-FastAPI on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare