---
title: "Deploy Speaches"
description: "Self-hosted OpenAI-compatible speech-to-text and text-to-speech API"
category: "AI/ML"
url: https://railway.com/deploy/speaches-1
---

# Deploy Speaches

Self-hosted OpenAI-compatible speech-to-text and text-to-speech API

**[Deploy Speaches on Railway](https://railway.com/template/speaches-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/speaches-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### Speaches https://raw.githubusercontent.com/speaches-ai/speaches/v0.9.0-rc.3/realtime-console/dist/peach.svg

- **Source:** https://github.com/aalfath/speaches-railway-template
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Speaches on Railway

Speaches is an open-source (MIT) server that speaks the OpenAI audio API. It transcribes and translates speech with faster-whisper, turns text into speech with Kokoro or Piper, and adds voice activity detection and an OpenAI-style Realtime API. Any OpenAI SDK can use it by changing the base URL.

## About Hosting Speaches

This template runs one Speaches service on CPU, built from a small public GitHub repo that pins the official `ghcr.io/speaches-ai/speaches:0.9.0-rc.3-cpu` image by digest. Models live on a Railway volume, so they download once (about 400 MB for the two defaults) and later deploys start in seconds. `API_KEY` is generated at deploy and protects every `/v1` route; the server refuses to start without it. `/health` stays public for Railway's health check. After deploy, copy `API_KEY` from the service's Variables tab, open the public URL for the playground, or point your OpenAI client at `https://YOUR-DOMAIN/v1`. Plan for about 1 GB of RAM with the defaults, more for larger Whisper models.

## Common Use Cases

* Self-hosted replacement for OpenAI's `/v1/audio/transcriptions`, `/v1/audio/translations` and `/v1/audio/speech` endpoints
* Speech to text and text to speech for Open WebUI, n8n, Home Assistant or your own app, without sending audio to a third party
* Voice agents and live captions through the OpenAI-compatible Realtime API over WebSocket

## Dependencies for Speaches Hosting

* A Railway volume for the Hugging Face model cache (included)
* Outbound access to huggingface.co to download models on first boot

### Deployment Dependencies

* Speaches source and docs: https://github.com/speaches-ai/speaches and https://speaches.ai
* Release used: https://github.com/speaches-ai/speaches/releases/tag/v0.9.0-rc.3
* Template repo (Dockerfile, start script, changelog): https://github.com/aalfath/speaches-railway-template

### Implementation Details

What the template sets up:

* Service `Speaches` on port 8000 with a Railway domain: the Gradio playground at `/`, the API at `/v1`, API docs at `/docs`, health check at `/health`.
* Volume at `/home/ubuntu/.cache/huggingface/hub`, handed to the image's unprivileged `ubuntu` user at startup, so the server never runs as root.
* `PRELOAD_MODELS` downloads `Systran/faster-whisper-small` and `speaches-ai/Kokoro-82M-v1.0-ONNX` at startup. Speaches never downloads a model on demand, so add any other model to this list (for example `Systran/faster-whisper-large-v3`) or call `POST /v1/models/MODEL-ID` with your key. The OpenAI names `whisper-1`, `tts-1` and `tts-1-hd` map to the preloaded models.
* The playground page is public but does nothing until you paste `API_KEY` into its API Key box.

Try it:

```sh
curl https://YOUR-DOMAIN/v1/audio/speech -H "Authorization: Bearer YOUR-API-KEY" -H "Content-Type: application/json" -d '{"model":"tts-1","voice":"af_heart","input":"Hello from Railway"}' -o hello.mp3
curl https://YOUR-DOMAIN/v1/audio/transcriptions -H "Authorization: Bearer YOUR-API-KEY" -F file=@hello.mp3 -F model=whisper-1
```

Optional settings (add them as variables only if you need them): `ALLOW_ORIGINS` (a JSON list, for browser apps calling the API directly), `CHAT_COMPLETION_BASE_URL` and `CHAT_COMPLETION_API_KEY` (an OpenAI-compatible LLM for the voice-chat tab and Realtime responses), `STT_MODEL_TTL` and `TTS_MODEL_TTL` (seconds before an idle model is unloaded from memory, default 300), and `HF_TOKEN` (only for gated models).

Updates: the template builds from the GitHub repo above. When a new Speaches version is pinned there, Railway shows an "update available" notice on your service. Read the repo's CHANGELOG first, then apply it. Your models stay on the volume.

## Why Deploy Speaches 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 Speaches 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.



## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/speaches-1
