Deploy Kokoro TTS OpenAI-Compatible Speech API (API Key + Web UI)
Natural text-to-speech on CPU: OpenAI /v1/audio/speech, 70+ voices.
Just deployed
Kokoro TTS
Just deployed
Deploy and Host Kokoro TTS with Railway
Kokoro TTS turns text into natural-sounding speech with the open Kokoro-82M model. This community template runs Kokoro-FastAPI on CPU behind a small gateway: an OpenAI-compatible /v1/audio/speech API protected by an API key, and a password-protected web player for trying voices in the browser.
About Hosting Kokoro TTS
Kokoro-82M is a compact text-to-speech model (82 million parameters, Apache-2.0) with more than 70 voices across English, Spanish, French, Italian, Portuguese, Hindi, Japanese and Chinese. Kokoro-FastAPI wraps it in an API that speaks the OpenAI speech format, plus ElevenLabs- and Cartesia-style routes, streaming and a web player.
On Railway the model runs on CPU in a private service with the weights baked into the image, so nothing is downloaded at boot. A Caddy gateway is the only public entry: API clients send the key in a header, browsers sign in with a user name and password. Thread pools are sized from the service's CPU quota, not the host's core count, so synthesis stays fast on shared hosts.
Common Use Cases
- Drop-in replacement for OpenAI's
tts-1in apps, bots and automations (n8n, Open WebUI, AnythingLLM) - Narration for articles, newsletters, videos and e-learning
- Voice output for AI agents and phone or chat assistants
- Batch audio generation in MP3, WAV, Opus, FLAC or PCM
- Trying and mixing voices in the built-in web player
Dependencies for Kokoro TTS Hosting
- None beyond this template: the model, voices and phonemizer (espeak-ng) ship in the image
- About 1.2 GB RAM for the model service (Hobby plan or higher)
Deployment Dependencies
- Kokoro-FastAPI: https://github.com/remsky/Kokoro-FastAPI
- Kokoro-82M model card: https://huggingface.co/hexgrad/Kokoro-82M
- OpenAI speech API format: https://platform.openai.com/docs/api-reference/audio/createSpeech
- Template source: https://github.com/baranberkay96/kokoro-tts-railway
Implementation Details
| Service | What it runs | Public | Volume |
|---|---|---|---|
| Kokoro TTS | Caddy 2.11 gateway: API key pass-through, basic auth for browsers | yes, port 8080 |