This page documents a private deployment and is not listed in the site
navigation. Keep the link handy.
Differences from the hosted API
Prerequisites
- The WebSocket URL of your deployment (provided by Baseten / Gradium),
of the form
wss-host.example.com/websocket. - A Baseten API key with access to the deployment.
- Python 3.10+ with the Gradium SDK, version 0.6.1 or later
(
pip install "gradium>=0.6.1"). Earlier versions cannot override the TTS route and will not reach a self-hosted deployment.
Quickstart
The SDK repository ships a ready-made client for self-hosted deployments:examples/self_hosted/example_tts.py.
It connects to the deployment, synthesizes the given text, and writes
the audio to a file:
--api-key takes your Baseten API key — the example client sends
it in Baseten’s Authorization: Api-Key ... header, not in the hosted
API’s x-api-key header.Minimal client
The example boils down to two adjustments to the standardGradiumClient, both worth copying into your own code:
tts_route=""— on the hosted API the client appendsspeech/ttsto the base URL; on Baseten the TTS WebSocket is served at the deployment URL directly.- Auth header override — Baseten authenticates with
Authorization: Api-Key <key>.
tts_realtime
for concurrent send/receive, tts_stream for an async iterator of
audio chunks, and tts for buffered one-shot synthesis.
Setup parameters
voice_id: The id of the voice to use, from Available voices below. Omit it to use the deployment’s default voice.output_format:"wav"or"pcm". PCM output is 48kHz, 16-bit signed integer, mono.json_config: Advanced voice settings such as temperature and speed. See Voice Settings.rewrites: Inline text rewrite rules, as a list of[original, rewrite, case_sensitive]entries. See Text Rewriting.
Direct WebSocket
From a non-Python runtime, talk to the WebSocket directly. The message flow is the same as the TTS WebSocket reference: sendsetup, wait for ready, send text and end_of_stream,
receive audio / text messages until end_of_stream.
pronunciation_id is
not available — use inline rewrites instead.
Troubleshooting
Available voices
The deployment image ships with 346 voices plus a built-in default voice (used whenvoice_id is omitted). All 66
flagship voices are included — the
tables below list them per language; the full id list follows. Pass
the id as the voice_id setup field — click an id to copy it. You can
also listen to and test the voices in the official
Gradium Studio.
- English (18)
- French (13)
- German (13)
- Spanish (14)
- Portuguese (8)
Full voice id list (346)
Full voice id list (346)
Every id below is baked into the deployment image and usable as the
voice_id setup field, including the flagship voices listed above.