Deploy Kitten TTS 2 | (Just Updated) OpenAI-Compatible Text-to-Speech API on CPU, API Key Generated

Kitten-TTS 2 speech API, OpenAI-compatible, CPU, generated API key

Deploy Kitten TTS 2 | (Just Updated) OpenAI-Compatible Text-to-Speech API on CPU, API Key Generated

Just deployed

/data

Deploy and Host Kitten TTS 2 on Railway

Kitten-TTS 2 text-to-speech as an OpenAI-compatible API, running on CPU with no GPU. Deploy, copy the generated API_KEY, and call POST /v1/audio/speech. The model weights download on first boot onto a Railway volume, so redeploys do not download them again.

Powered by KittenML.

About Hosting Kitten TTS 2

The service is KittenTTS Kitten-TTS 2 (1.7B parameters, 100+ built-in voices, 24 kHz) served by a small FastAPI wrapper over the CPU runtime kitten_tts_cpp. The API key is generated for you and enforced on every /v1/* route. /health answers immediately and reports loading while the first-boot download and model load finish (a few minutes), then ready.

Speed, measured on an 8 vCPU Railway container: generation runs about 10 to 14 times slower than real time (2.7 s of audio took 38 s, 8.9 s took 90 s). Memory use is about 2.5 GB. Input is capped at 300 characters per request so a request always finishes inside Railway's edge timeout of about 5 minutes; split longer text into several requests. This template is for batch and offline speech, not live conversation. Plan on Hobby or above.

Licence: the weights are under the Stellon Labs Community License. Commercial use requires registering with Stellon Labs and is capped at US$1,000,000 annual revenue and funding. The weights are downloaded from Hugging Face at first boot, never bundled in the image. You are the licensee when you deploy this.

Agent contract

  • Public URL: https:// (also KITTENTTS_URL)
  • Private URL: http://kittentts.railway.internal:8080 (also KITTENTTS_PRIVATE_URL)
  • Credentials: API_KEY
  • Auth: header Authorization: Bearer $API_KEY on every /v1/* route
  • Health: GET /health returns 200 with {"status":"ready"} once the model is loaded (loading before that, error with a message if the download failed)
U="$KITTENTTS_URL"; H="Authorization: Bearer $API_KEY"
until curl -fs "$U/health" | grep -q '"ready"'; do sleep 10; done          # first boot downloads ~1 GB
curl -s -H "$H" "$U/v1/audio/voices"                                         # list voices
curl -s -H "$H" -H "Content-Type: application/json" \
  -d '{"input":"Hello from Kitten TTS.","voice":"Bruno","response_format":"wav"}' \
  "$U/v1/audio/speech" -o out.wav && head -c 4 out.wav                       # RIFF

response_format is mp3 (default), wav, opus, aac, flac or pcm. "stream": true with wav or pcm returns audio chunk by chunk. The OpenAI SDK works with base_url="$KITTENTTS_URL/v1" and api_key=$API_KEY.

Why Deploy Kitten TTS 2 on Railway

Railway gives the API a public HTTPS URL, a persistent volume for the 1 GB of weights and one-click redeploys, with nothing to configure: the API key is generated, the port and healthcheck are set, and the model downloads itself. You get a private speech endpoint your own agents and apps call with the standard OpenAI speech request.

Common Use Cases

  • Batch narration, voice-overs and audiobook clips from text, generated offline.
  • Giving an AI agent a private text-to-speech endpoint it can call with an API key.
  • Replacing a paid speech API with a self-hosted, OpenAI-compatible one for non-real-time jobs.

Dependencies for Kitten TTS 2

  • Kitten-TTS 2 weights KittenML/kitten-tts-2 (pinned revision), runtime kitten_tts_cpp 0.2.0.

Deployment Dependencies

  • Outbound internet on first boot to download about 1 GB from Hugging Face. No database or other service.

Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
117
View Template
NEW
Möbius v0.1 Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

bento
1
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
7