Deploy MOSS TTS - Voice Cloning API (CPU, OpenAI-compatible)
Voice-cloning TTS with an OpenAI-compatible API. CPU-only, no GPU bill.
moss-tts-api
Just deployed
/data
Deploy and Host MOSS-TTS on Railway
MOSS-TTS is OpenMOSS's open text-to-speech model family with zero-shot voice cloning: give it a 5–15 second reference clip and it speaks any text in that voice. This template serves it behind an OpenAI-compatible API (POST /v1/audio/speech) on CPU — no GPU bill.
About Hosting MOSS-TTS
This template runs a FastAPI server wrapping the MOSS-TTS-Local-Transformer model (1.7B, bfloat16) — sized to fit Railway's 8GB / 8 vCPU tier. On first boot the server downloads ~13GB of model weights to ephemeral disk (a few minutes); warm it up with POST /v1/models/preload and watch GET /health for loaded_model. Uploaded voice reference clips persist on the attached volume at /data, so your cloned voices survive redeploys. All inference routes are protected by the API_KEY bearer token generated at deploy. Larger MOSS variants (4B, 8B) are one MODEL_ID env var away on bigger instances. Generation is CPU-bound — roughly 15s of compute per second of audio — ideal for async/batch workloads rather than realtime.
Why Deploy MOSS-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 MOSS-TTS on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
- Voice cloning without a GPU bill — clone any voice from a 10-second clip on plain CPU pricing.
- Drop-in OpenAI replacement — point any OpenAI SDK at your own domain via
base_url; no vendor lock-in, no per-character TTS fees. - Your voices stay yours — reference clips and generated audio never leave your infrastructure.
- One-click, one variable —
API_KEYis auto-generated; volume, healthcheck, and domain are preconfigured.
Common Use Cases
- Voice notifications and agents — give your AI assistant, alerting system, or home automation a consistent custom voice.
- Content pipelines — batch-narrate articles, newsletters, or video scripts in a cloned brand voice.
- App audio features — add self-hosted read-aloud, audio messages, or character voices to your product without per-request SaaS fees.
Dependencies for MOSS-TTS Hosting
- A volume mounted at
/data(included in this template) for persistent named voices. - ~8GB RAM / 8 vCPU service (Railway's standard tier) for the default 1.7B model.
Deployment Dependencies
- MOSS-TTS model family — upstream models by OpenMOSS (Apache-2.0)
- bon5co/moss-tts-api — the API server this template deploys
- MOSS-TTS on HuggingFace — model weights downloaded at first boot
Implementation Details
Clone a voice, then speak in it:
# register a named voice from a reference clip
curl -X PUT https:///v1/voices/alice \
-H "Authorization: Bearer $API_KEY" -F file=@ref.wav
# synthesize speech in that voice (OpenAI-compatible route)
curl -X POST https:///v1/audio/speech \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
-d '{"input": "Hello!", "voice": "alice", "response_format": "mp3"}' -o out.mp3
One-shot cloning without storing anything: POST /v1/audio/clone (multipart clip + text). List voices: GET /v1/voices. Plain-text usage guide for humans and LLM agents: GET /.
Template Content
moss-tts-api
ghcr.io/bon5co/moss-tts-api:latest