v52

OpenAPI 3.1.0raw.githubusercontent.com2026-07-311,1941,9384.1 MB
Text To Speech Commands

Stream text to speech over WebSocket

Open a WebSocket connection to stream text and receive synthesized audio in real time. Authentication is provided via the standard Authorization: Bearer <API_KEY> header. Send JSON frames with text to synthesize; receive JSON frames containing base64-encoded audio chunks.

Supported providers: aws, telnyx, azure, murfai, minimax, rime, resemble, elevenlabs, xai, humain.

Connection flow:

  1. Open WebSocket with query parameters specifying provider, voice, and model.
  2. Send an initial handshake message {"text": " "} (single space) with optional voice_settings to initialize the session.
  3. Send text messages as {"text": "Hello world"}.
  4. Receive audio chunks as JSON frames with base64-encoded audio.
  5. A final frame with isFinal: true indicates the end of audio for the current text.

To interrupt and restart synthesis mid-stream, send {"force": true} — the current worker is stopped and a new one is started.

Note: The Telnyx Ultra model is not available over WebSocket. Use the HTTP POST /text-to-speech/speech endpoint instead.

get/text-to-speech/speech

Query parameters

voicestring

Voice identifier in the format provider.model_id.voice_id or provider.voice_id (e.g. telnyx.NaturalHD.Telnyx_Alloy, Telnyx.Ultra.<voice_id>, Telnyx.Bayan.Ahmed, Telnyx.Sukhan.urdu-professor, or azure.en-US-AvaMultilingualNeural). When provided, the provider, model_id, and voice_id are extracted automatically. Takes precedence over individual provider/model_id/voice_id parameters.

provider'aws' | 'telnyx' | 'azure' | 'elevenlabs' | 'minimax' | 'murfai' | 'rime' | 'resemble' | 'xai' | 'humain'

TTS provider. Defaults to telnyx if not specified. Ignored when voice is provided.

model_idstring

Model identifier for the chosen provider. Examples: Natural, NaturalHD, Ultra (Telnyx); Polly.Generative (AWS).

voice_idstring

Voice identifier for the chosen provider.

disable_cacheboolean

When true, bypass the audio cache and generate fresh audio.

audio_format'pcm' | 'wav' | 'mp3'

Audio output format override. Supported for Telnyx models. pcm and wav are available for Natural/NaturalHD models. The Ultra model outputs PCM at 24kHz s16le or MP3 at 128kbps 24kHz.

socket_idstring

Client-provided socket identifier for tracking. If not provided, one is generated server-side.

Response

WebSocket upgrade successful — this response is not returned directly. See 101 for frame documentation.