---
title: "Deploy Supertonic 2 TTS | (Just Updated) OpenAI-Compatible Text-to-Speech API, No GPU, API Key Pre-Set"
description: "Supertonic 2 TTS API: OpenAI-compatible text-to-speech on CPU, no GPU"
category: "AI/ML"
url: https://railway.com/deploy/supertonic-2-tts-or-just-updated-openai-
---

# Deploy Supertonic 2 TTS | (Just Updated) OpenAI-Compatible Text-to-Speech API, No GPU, API Key Pre-Set

Supertonic 2 TTS API: OpenAI-compatible text-to-speech on CPU, no GPU

**[Deploy Supertonic 2 TTS | (Just Updated) OpenAI-Compatible Text-to-Speech API, No GPU, API Key Pre-Set on Railway](https://railway.com/template/supertonic-2-tts-or-just-updated-openai-)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/supertonic-2-tts-or-just-updated-openai-/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** AI/ML

## Template content

### supertonic

- **Image:** ghcr.io/bon5co/supertonic-railway:1.0.0@sha256:662d692fb76ff23337e01502c0bc9740e528969eed0c40eb693b5e5309d0877d
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Supertonic 2 (Text-to-Speech API) on Railway

A text-to-speech API turns written text into spoken audio over plain HTTP. This template serves Supertonic 2, a 66-million-parameter speech model from Supertone, on CPU with ONNX Runtime, 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 Supertonic 2

Supertonic 2 is Supertone's on-device speech model: four small ONNX networks (a duration predictor, a text encoder, a flow-matching vector estimator and a vocoder) that together turn text into 44.1 kHz audio in a handful of denoising steps. It speaks English, Korean, Spanish, Portuguese and French in ten built-in voices, five female (F1 to F5) and five male (M1 to M5). This template runs Supertone's own inference code, copied unchanged from its repository, behind a small FastAPI server.

`POST /v1/audio/speech` takes JSON in the shape of the OpenAI speech endpoint: `input` (the text), `voice` (`F1` to `F5`, `M1` to `M5`, or an OpenAI voice name such as `alloy` or `nova`, mapped to a fixed Supertonic voice), `model` (`supertonic-2`; `tts-1` and `tts-1-hd` are accepted as aliases), `response_format` (`wav` by default, or `mp3`, `flac`, `pcm`), `speed` (0.5 to 2.0, default 1.05) and `language` (`en`, `ko`, `es`, `pt`, `fr`; default `en`). Two extras: `steps` (1 to 20, default 8) trades speed for smoothness, and `seed` makes a request repeatable. `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`, `X-Language` and `X-Steps` report what was done.

The weights are in the image, so nothing downloads at boot. `/health` answers 503 while the model loads, then 200 (the model loaded in under one second on Railway). One synthesis runs at a time and up to 3 requests may wait; a fourth answers `429` with `Retry-After: 30`. Long input is split at sentence boundaries and joined with a short pause, and 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 with the default 8 steps (2026-11-24):

| Request | Seconds of compute | Audio produced |
|---|---|---|
| one 114-character sentence, 5 requests in a row | 0.31 to 0.40 | 8.4 seconds |
| the same sentence with `steps` set to 2 | 0.20 | 8.4 seconds |
| 2,879 characters (10 pieces) in one request | 6.5 | 190 seconds |

That is about 25 seconds of speech for every second of compute on a single sentence, and 29 on a long text. Memory was 453 MB after boot and warm-up and peaked at 610 MB after the requests above, so a small plan is enough; the speed figures need the 8 vCPU the service gets by default, because the entrypoint sizes the ONNX thread pool from the container's CPU quota. English, French and Korean requests returned valid audio of the expected length; how natural each voice sounds is for you to judge.

**Limits.** No voice cloning, no streaming, no SSML, no word timestamps, and no languages other than the five above. Text outside the symbols the model knows (emoji and most other scripts) is dropped silently rather than rejected.

**Licence and permitted use.** The wrapper is Apache-2.0 and Supertone's inference code is MIT. The weights `Supertone/supertonic-2` declare `license: openrail` and are not gated (read 2026-11-24); the licence is the BigScience Open RAIL-M License, whose text ships in the image at `/licenses/BigScience-OpenRAIL-M-LICENSE`. It grants "a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license", so commercial use is allowed, but paragraph 5 says that "You shall require all of Your users who use the Model or a Derivative of the Model to comply with the terms of this paragraph", so anyone you let call this API is bound too. Attachment A says "You agree not to use the Model or Derivatives of the Model": (a) in any way that violates any applicable law or regulation; (b) for the purpose of exploiting, harming or attempting to exploit or harm minors in any way; (c) to generate or disseminate verifiably false information and/or content with the purpose of harming others; (d) to generate or disseminate personal identifiable information that can be used to harm an individual; (e) to generate or disseminate information and/or content (e.g. images, code, posts, articles), and place the information and/or content in any context (e.g. bot generating tweets) "without expressly and intelligibly disclaiming that the information and/or content is machine generated"; (f) to defame, disparage or otherwise harass others; (g) to impersonate or attempt to impersonate (e.g. deepfakes) others without their consent; (h) for fully automated decision making that adversely impacts an individual's legal rights or otherwise creates or modifies a binding, enforceable obligation; (i) for any use intended to or which has the effect of discriminating against or harming individuals or groups based on online or offline social behavior or known or predicted personal or personality characteristics; (j) to exploit any of the vulnerabilities of a specific group of persons based on their age, social, physical or mental characteristics, in order to materially distort the behavior of a person pertaining to that group in a manner that causes or is likely to cause that person or another person physical or psychological harm; (k) for any use intended to or which has the effect of discriminating against individuals or groups based on legally protected characteristics or categories; (l) to provide medical advice and medical results interpretation; (m) to generate or disseminate information for the purpose to be used for administration of justice, law enforcement, immigration or asylum processes, such as predicting an individual will commit fraud/crime commitment (e.g. by text profiling, drawing causal relationships between assertions made in documents, indiscriminate and arbitrarily-targeted use). Item (e) matters most for a voice API: say so wherever listeners hear the audio. The model has no content filter and no watermark, so keep the API key private and moderate what you let others send it.

### Agent contract

- Public URL: `https://RAILWAY_PUBLIC_DOMAIN` (the generated domain of the `supertonic` service)
- Private URL: `http://supertonic.railway.internal:8080`
- Credentials: the `API_KEY` variable of the `supertonic` service
- Auth: `Authorization: Bearer $API_KEY` on every route except `GET /health`; no key or a wrong key answers `401`
- Health: `GET /health` returns 200 once the model is loaded (503 while loading, a few seconds)

```bash
# needs: RAILWAY_PUBLIC_DOMAIN, API_KEY (variables of the supertonic 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 Supertonic 2 speaking.","voice":"F1","language":"en"}' | 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: supertonic-2`, `x-voice: F1` and an `x-audio-seconds` of about 3, and `RIFF`, the start of a WAV file. For MP3 add `"response_format":"mp3"`; for another language add `"language":"fr"` (or `ko`, `es`, `pt`). An unknown voice, language, format, model or out-of-range `speed` or `steps` answers `422`.

## Why Deploy Supertonic 2 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.
- **Under half a second of compute for a sentence**, 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 well under a second.
- **Read-aloud for apps and articles**: turn posts, notifications or lessons into audio on demand and cache the files.
- **Multilingual voice prompts**: five languages from one endpoint.

## Dependencies for Supertonic 2 Hosting

- A service with 1 GB of RAM or more and 8 vCPU for the speeds above.
- No volume: the service keeps no state.

### Deployment Dependencies

- [supertone-oss-archive/supertonic](https://github.com/supertone-oss-archive/supertonic): Supertone's inference code, copied unchanged, MIT
- [Supertone/supertonic-2](https://huggingface.co/Supertone/supertonic-2): the weights and voice styles, OpenRAIL-M
- [bon5co/supertonic-railway](https://github.com/bon5co/supertonic-railway): the wrapper image this template deploys, Apache-2.0


## 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/supertonic-2-tts-or-just-updated-openai-
