---
title: "Deploy Kokoro TTS API (CPU)"
description: "OpenAI-compatible Kokoro text-to-speech API on CPU, model baked in"
category: "AI/ML"
url: https://railway.com/deploy/kokoro-tts-api-cpu
---

# Deploy Kokoro TTS API (CPU)

OpenAI-compatible Kokoro text-to-speech API on CPU, model baked in

**[Deploy Kokoro TTS API (CPU) on Railway](https://railway.com/template/kokoro-tts-api-cpu)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/kokoro-tts-api-cpu/manifest.json

- **Creator:** Protemplate
- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### Kokoro TTS https://avatars.githubusercontent.com/u/25017870?v=4

- **Image:** ghcr.io/remsky/kokoro-fastapi-cpu:v0.9.0
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Kokoro TTS on Railway

Kokoro TTS is an OpenAI-compatible text-to-speech API built on the open Kokoro-82M model, served by the Kokoro-FastAPI project. It speaks English, Spanish, French, Hindi, Italian, Japanese, Portuguese and Mandarin, supports voice mixing, inline multi-speaker tags and SSML, streams mp3, wav, opus, flac, aac or pcm, and ships a web player for trying voices in the browser.

## About Hosting Kokoro TTS

Hosting Kokoro TTS is a single stateless container. This template uses the official CPU image `ghcr.io/remsky/kokoro-fastapi-cpu:v0.9.0` with the model weights and voice packs baked in, so there is no volume, no database, and no external API key. `PORT` is pinned to 8880 (the image entrypoint passes it to uvicorn) so Railway's healthcheck hits `/health` on the right port, `HOST` is `::` so other Railway services can reach it over IPv6 private networking, and the healthcheck window is 600 seconds because the model loads and warms up before the port opens. Inference runs on CPU and needs roughly 2 to 4 GB of RAM, so use the Hobby plan or higher.

## Common Use Cases

- **Drop-in OpenAI TTS replacement**: point any OpenAI SDK at `/v1` with model `kokoro`
- **Voice for chat UIs and agents**: Open WebUI, LibreChat, SillyTavern, voice assistants
- **Narration and audiobooks**: long-form text with automatic chunking, captions and read-along timings
- **Multi-speaker dialogue**: inline `[voice:...]` tags or `POST /dev/dialogue`
- **Private TTS for other Railway services**: `http://kokoro-tts.railway.internal:8880/v1`

## Dependencies for Kokoro TTS Hosting

- **None**: no database, no volume, no GPU, no external API keys
- **Memory**: about 2 to 4 GB RAM (Hobby plan or higher)

### Deployment Dependencies

- [Kokoro-FastAPI GitHub repository](https://github.com/remsky/Kokoro-FastAPI)
- [Configuration reference](https://github.com/remsky/Kokoro-FastAPI/blob/v0.9.0/docs/configuration.md)
- [Kokoro-82M model card](https://huggingface.co/hexgrad/Kokoro-82M)

### Implementation Details

The image CMD runs the upstream entrypoint, which starts `uvicorn --host "$HOST" --port "$PORT"`, so no custom start command is needed. Key variables:

```env
PORT=8880
HOST=0.0.0.0
USE_GPU=false
API_LOG_LEVEL=INFO
DEFAULT_VOICE=af_heart
WEB_CONCURRENCY=1
```

**First steps after deploy**

1. Wait for `/health` to return `{"status":"healthy"}`. First boot takes a few minutes while the model loads.
2. Open `/web/` on your Railway domain and generate a sample.
3. Call `POST /v1/audio/speech` with `{"model":"kokoro","input":"...","voice":"af_heart","response_format":"mp3"}` from your app.
4. Decide on access: the upstream server has no authentication, so anyone with the URL can generate audio. Put it behind a gateway such as LiteLLM or Bifrost, use Cloudflare Access, or remove the public domain and call it privately.

Keep one worker: inference is synchronous and each extra worker loads its own copy of the model. Avoid the `latest` tag when upgrading; pick a release tag.

## Why Deploy Kokoro TTS on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Kokoro TTS on Railway, you get a pinned, health-checked, OpenAI-compatible speech endpoint with managed SSL and private networking to the rest of your Railway project, with no GPU bill and no per-character API pricing.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/kokoro-tts-api-cpu
