
Deploy Pocket TTS | (Just Updated) OpenAI-Compatible TTS Server, No GPU, API Key Pre-Set
Pocket TTS server: OpenAI-compatible text-to-speech API on CPU, no GPU
pocket-tts
Just deployed
Deploy and Host Pocket TTS (Text-to-Speech API) on Railway
A text-to-speech API turns written text into spoken audio over plain HTTP. This template serves Pocket TTS, a 100-million-parameter speech model from Kyutai, on CPU behind one authenticated, OpenAI-compatible HTTP API. The weights are inside the image, an API key is generated at deploy, and no GPU is needed.
About Hosting Pocket TTS
Pocket TTS is Kyutai's small English speech model: a causal transformer that generates audio in a continuous latent space and decodes it to 24 kHz speech. The model was built to run faster than real time on a laptop CPU. This template runs the upstream pocket-tts 4.0.1 package unchanged behind a small FastAPI server, with 19 built-in voices (preloaded at boot) in the image.
POST /v1/audio/speech takes JSON in the shape of the OpenAI speech endpoint: input (the text), voice (one of the 19 voice ids such as alba, marius or javert, or an OpenAI voice name such as alloy or nova, mapped to a fixed Pocket TTS voice), model (pocket-tts; tts-1 and tts-1-hd are accepted as aliases) and response_format (wav by default, or mp3, flac, pcm). speed is not supported by the model and answers 422 unless it is 1.0. GET /v1/models lists the model and the limits in force, and GET /v1/audio/voices lists the voices. Reply headers X-Processing-Seconds, X-Audio-Seconds, X-Realtime-Factor, X-Voice and X-Attribution report what was done.
The weights are in the image, so nothing downloads at boot. /health answers 503 while the model loads, then 200 (about three seconds on Railway). One synthesis runs at a time and up to 3 requests may wait; a fourth answers 429 with Retry-After: 30. A request that cannot finish within 240 seconds answers 504 before Railway's edge cuts the connection at about five minutes. Input over 5,000 characters answers 413. Text and audio are never logged or written to disk.
Measured on Railway, 8 vCPU, read from the reply headers over the public URL (2026-11-25), a 311-character paragraph synthesised three times in a row with the alba voice:
| Request | Seconds of compute | Audio produced |
|---|---|---|
| run 1 | 5.92 | 17.5 seconds |
| run 2 | 5.74 | 17.8 seconds |
| run 3 | 5.40 | 16.8 seconds |
That is about 3 seconds of speech for every second of compute, or 54 to 59 characters of input per second. The model runs fastest on one CPU thread (measured here: 0.46 compute seconds per audio second on one thread, 0.96 on two, 1.04 on four), so the image pins one thread and extra vCPU do not make a single request faster; they only let other work share the container. Memory was 835 MB after boot and warm-up and peaked at 1,030 MB, so a plan with 2 GB of RAM is enough.
Limits. English only. No voice cloning: the weights that contain the cloning encoder are gated, and this image carries the ungated Kyutai build pocket-tts-without-voice-cloning, so a request cannot supply a voice sample. No streaming response, no SSML, no word timestamps, no speed control. Two of the upstream voices, cosette and jean, are licensed for non-commercial use only and are left out of the image.
Licence and permitted use. The wrapper is Apache-2.0 and the pocket-tts package is MIT. The weights kyutai/pocket-tts-without-voice-cloning declare license: cc-by-4.0 and are not gated (read 2026-11-25). Creative Commons Attribution 4.0 says "the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights", so commercial use is allowed, on the condition that You "retain the following if it is supplied by the Licensor" (attribution to the creators) and "indicate if You modified the Licensed Material". This image does not modify the weights. Attribution: Pocket TTS by Kyutai, CC BY 4.0, unmodified; each reply carries it in the X-Attribution header, and the full legal text ships in the image at /licenses/CC-BY-4.0-LICENSE. The voice recordings behind the presets are CC BY 4.0 (the Alba MacKenna and CSTR VCTK voices) or CC0 (the voice donation and Voice-Zero voices); the image NOTICE lists each. Kyutai's model card adds this prohibited-use paragraph: "Use of our model must comply with all applicable laws and regulations and must not result in, involve, or facilitate any illegal, harmful, deceptive, fraudulent, or unauthorized activity. Prohibited uses include, without limitation, voice impersonation or cloning without explicit and lawful consent; misinformation, disinformation, or deception (including fake news, fraudulent calls, or presenting generated content as genuine recordings of real people or events); and the generation of unlawful, harmful, libelous, abusive, harassing, discriminatory, hateful, or privacy-invasive content. We disclaim all liability for any non-compliant use." The model has no content filter and no watermark, so keep the API key private, moderate what you let others send it, and say wherever listeners hear the audio that it is synthetic.
Agent contract
- Public URL:
https://RAILWAY_PUBLIC_DOMAIN(the generated domain of thepocket-ttsservice) - Private URL:
http://pocket-tts.railway.internal:8080 - Credentials: the
API_KEYvariable of thepocket-ttsservice - Auth:
Authorization: Bearer $API_KEYon every route exceptGET /health; no key or a wrong key answers401 - Health:
GET /healthreturns 200 once the model is loaded (503 while loading, a few seconds)
# needs: RAILWAY_PUBLIC_DOMAIN, API_KEY (variables of the pocket-tts service), curl
# signup: none - the API has no user accounts, only the API_KEY bearer
R="https://$RAILWAY_PUBLIC_DOMAIN"
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/health")" = 200 ]; do n=$((n+1)); [ "$n" -le 60 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/health"
curl -s -o /dev/null -w "write without key: %{http_code}\n" -X POST "$R/v1/audio/speech" -H "Content-Type: application/json" -d '{"input":"Hello from Railway."}'
curl -s -o /dev/null -w "write wrong key: %{http_code}\n" -X POST "$R/v1/audio/speech" -H "Authorization: Bearer not-the-key" -H "Content-Type: application/json" -d '{"input":"Hello from Railway."}'
curl -s -D - -o /tmp/hello.wav -X POST "$R/v1/audio/speech" -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{"input":"Hello from Railway. This is Pocket TTS speaking.","voice":"alba"}' | grep -iE "^(HTTP|x-model|x-voice|x-audio-seconds)"
head -c 4 /tmp/hello.wav; echo
A fresh deploy prints health: 200, write without key: 401, write wrong key: 401, 200 with x-model: pocket-tts, x-voice: alba and an x-audio-seconds of about 4, and RIFF, the start of a WAV file. For MP3 add "response_format":"mp3". An unknown voice, format or model, a speed other than 1.0, or empty input answers 422.
Why Deploy Pocket TTS on Railway?
Railway hosts your infrastructure so you do not have to deal with configuration, and lets you scale it vertically and horizontally. Host your servers, databases, AI agents and more on Railway.
- Your text stays in your container; no GPU bill, no per-character fee.
- About 3 seconds of speech per second of compute, measured on Railway at 8 vCPU.
- Drops into OpenAI client code: change the base URL and key.
- Nothing to configure: weights in the image, key generated at deploy.
Common Use Cases
- Voice for AI agents: an agent sends text over plain HTTP and gets a WAV or MP3 back in seconds.
- Read-aloud for apps and articles: turn posts, notifications or lessons into audio on demand and cache the files.
- Home Assistant and SillyTavern voices: both accept an OpenAI-compatible speech endpoint.
Dependencies for Pocket TTS Hosting
- A service with 2 GB of RAM or more; speed does not rise past one CPU thread per request.
- No volume: the service keeps no state.
Deployment Dependencies
- kyutai-labs/pocket-tts: the inference package, installed unchanged, MIT
- kyutai/pocket-tts-without-voice-cloning: the weights and voice embeddings, CC BY 4.0
- bon5co/pocket-tts-railway: the wrapper image this template deploys, Apache-2.0
Template Content
pocket-tts
ghcr.io/bon5co/pocket-tts-railway:1.0.0
