Skip to main content

Telnyx Voice: TTS — Full Documentation

Complete page content for TTS (Voice section) of the Telnyx developer docs (https://developers.telnyx.com). Root index: https://developers.telnyx.com/llms.txt · Lightweight index for this subsection: https://developers.telnyx.com/development/llms/voice-tts-llms-txt.md

Overview

Source: https://developers.telnyx.com/docs/voice/tts/overview.md

1. Choose your interface

Real-time streaming. Send text, receive audio chunks as they’re synthesized. HTTP POST. Get audio back as binary, base64, or async URL. OpenAI SDK compatible. TTS during live calls via Call Control speak or TeXML “.

2. Choose a pre-built voice

Natural, NaturalHD, Ultra, Kokoro, Qwen3TTS, xAI Grok. AWS Polly, Azure, ElevenLabs, Minimax, MurfAI, Rime, Resemble, Inworld, Fish Audio.

3. Or create your own

Clone and design custom voices. Available on select providers: Qwen3TTS, Minimax, ElevenLabs, Resemble.

WebSocket Streaming

Lifecycle

Source: https://developers.telnyx.com/docs/voice/tts/websocket-streaming.md
Real-time text-to-speech over a persistent WebSocket connection. Send text, receive audio.

Endpoint

Connection Lifecycle

1. Handshake

There are two ways to establish a connection:

Direct WebSocket connection

You can connect directly to the WebSocket endpoint by passing all configuration as query parameters in the wss:// URL:
Most WebSocket clients and libraries support this natively — simply open a WebSocket connection to the URL and begin the message flow. No separate HTTP request is needed.

HTTP upgrade

Alternatively, initiate the connection as an HTTP GET request that upgrades to a WebSocket via the standard 101 Switching Protocols handshake. This is what happens under the hood when a WebSocket client connects, and may be relevant if you need fine-grained control over the upgrade (e.g., setting custom headers in environments where the WebSocket library doesn’t expose them directly).

Initialization frame

Regardless of how the connection is established, send an initialization frame before any text:
The initialization frame may include voice_settings to configure provider-specific parameters:
All configuration — query parameters and voice settings — is locked before synthesis begins. See Configuration for both surfaces and the full parameter reference.

2. Streaming

Once initialized, text and audio flow concurrently — no request/response pairing. Text is buffered and synthesized at sentence boundaries. Client → Server Server → Client See Messages for the complete wire protocol reference.
Text buffering: Text accumulates until the server detects a sentence boundary (period, question mark, exclamation). Short fragments without punctuation wait for more text. Send "flush": true to force synthesis of buffered partials. Text preprocessing: Markdown formatting is automatically stripped before synthesis (headers, bold, italics, code blocks, links, lists, emoji). Useful when synthesizing LLM output. Pronunciation dictionary replacements are applied if pronunciation_dict_id is set. Streamed vs. concatenated delivery: Most providers (Telnyx Natural/NaturalHD/Qwen3TTS, Rime, Minimax, Resemble, Inworld) stream audio in separate frames where text is null. AWS Polly and Azure return audio in the text-bearing chunk instead. See Messages for details.

3. Teardown

Send {"text": ""} (empty string) to flush remaining buffered text and close gracefully. The server finishes synthesis, sends any remaining audio and a final frame, then closes the WebSocket.
Dropping the connection without the empty-text frame works but may lose buffered text. The connection also closes on server error or inactivity timeout. See Examples for complete code samples.

Configuration

Source: https://developers.telnyx.com/docs/voice/tts/websocket-streaming/configuration.md

Two Configuration Surfaces

Both are one-shot. After the init frame, no configuration can change for the session. To change settings, open a new connection.

Query Parameters

Set on the URL at connect time. Immutable for the session.

Voice Selection

The voice_id segment (third part of the voice string) refers to different things depending on the provider and model: The Voices API (GET /v2/ai/tts/voices) returns all voices available to your account — pre-built and cloned — with each voice’s compound id ready to use as the voice parameter.

Connection Options

| disable_cache | boolean | false | Bypass the audio cache and always synthesize fresh. |

Example

Voice Settings

Provider-specific tuning (speed, pitch, format, emotion, etc.) is not set via query parameters. It is passed once in the voice_settings object on the initialization frame:
Voice settings are applied when the synthesis worker starts and cannot be changed mid-session. There are no common voice_settings fields. Every field is provider-specific — the available fields, defaults, and accepted values are completely different per provider. Unrecognized fields are silently ignored. See your selected provider’s page under Providers for the exact fields.

Messages

Source: https://developers.telnyx.com/docs/voice/tts/websocket-streaming/messages.md

Client → Server

All client messages are JSON text frames.

Text Frame

Text to synthesize. " " (single space) for handshake. "" (empty string) for end-of-sequence. Provider-specific voice configuration. Only used in the handshake frame ({"text": " "}). See Voice Settings. When true, immediately synthesizes all buffered text without waiting for a sentence boundary. Default: false. When true, stops the current synthesis worker and starts a new one. The original handshake is replayed automatically. Use for barge-in/interruption.

Message Sequence

1. Handshake (required first message):
With optional voice settings:
2. Text (one or more):
3. Flush (optional — force synthesis of buffered partial sentences):
4. Interrupt (optional — restart synthesis):
5. End of sequence:

Server → Client

All server messages are JSON text frames.

Audio Chunk

Returned when synthesis produces audio for a complete sentence.
Base64-encoded audio data. null when the provider uses streamed delivery — audio arrives in separate streamed chunk frames instead. See note below. The text segment this audio corresponds to. null for streamed audio chunks. false for audio chunks. true if audio was served from cache. Time in milliseconds from speech request to first audio frame. Only present on the first chunk of each synthesis.

Streamed Audio Chunk

For providers that stream audio incrementally (Telnyx Natural, NaturalHD, Qwen3TTS, Rime, Minimax, Resemble, Inworld), audio arrives in separate frames:
These contain raw audio data (text is always null). The concatenated audio chunk for these providers has audio: null — only the streamed chunks carry audio bytes. For AWS Polly and Azure, audio is returned in the audio field of the regular audio chunk frame. For all other providers, ignore the audio field on the text-bearing chunk and collect audio from the streamed frames.

Final Frame

Signals that synthesis is complete for the current text input:
The connection remains open after a final frame — send more text or close.

Error Frame

The connection closes shortly after an error frame.

Errors

Source: https://developers.telnyx.com/docs/voice/tts/websocket-streaming/errors.md

HTTP Errors (Handshake)

These occur during the WebSocket upgrade request, before the connection is established.

WebSocket Errors (Runtime)

After the connection is established, errors arrive as JSON frames:
The connection closes shortly after an error frame.

Error Messages

Troubleshooting


Examples

Source: https://developers.telnyx.com/docs/voice/tts/websocket-streaming/examples.md

Basic Streaming

Python
JavaScript

Conversational (Barge-In)

Send multiple text segments and interrupt mid-synthesis:

LLM Token Streaming

Stream tokens from an LLM directly to TTS. The server buffers text and synthesizes at sentence boundaries:
Markdown in LLM output is automatically stripped before synthesis — headers, bold, italics, code blocks, and links are converted to plain text.

REST API

Overview

Source: https://developers.telnyx.com/docs/voice/tts/rest-api.md

How It Works

You send text in, audio streams back over the same HTTP connection. No polling, no callbacks. The response uses HTTP chunked transfer encoding — audio chunks arrive as they’re synthesized. Your client can begin playback immediately without waiting for the full file. The connection stays open until synthesis completes or 30 seconds pass with no new chunks. This makes REST suitable for real-time playback, not just batch file generation. For multi-turn conversational use cases where you’re continuously feeding text, use WebSocket Streaming instead.

Text Preprocessing

Before synthesis, text passes through two stages:
  1. Markdown stripping — headers, bold, italics, code blocks, links, lists, emoji are converted to plain text.
  2. Pronunciation dictionary — if pronunciation_dict_id is set, custom word replacements are applied.

API Reference

The full OpenAPI spec for these endpoints is available in the auto-generated API Reference. Note: the OAS is currently being cleaned up — some fields and provider-specific schemas may be incomplete.

Request

Source: https://developers.telnyx.com/docs/voice/tts/rest-api/request.md

Endpoint

Example

Request Body


Response

Source: https://developers.telnyx.com/docs/voice/tts/rest-api/response.md
The output_type request field controls what comes back.

Streaming Audio (default)

With output_type: "binary_output" (or omitted), the response is raw audio over HTTP chunked transfer encoding:
Start reading the body immediately — don’t buffer the full response.

Base64

With output_type: "base64_output", the full audio is returned as a JSON payload after synthesis completes:
No streaming — the entire file must synthesize before the response is sent.

Async (audio_id)

With output_type: "audio_id", synthesis runs in the background. You get a URL back immediately:
Retrieve the audio later with GET /v2/text-to-speech/speech/:audio_id. If the audio is still synthesizing, the GET response itself streams chunks as they become available.

Examples

Source: https://developers.telnyx.com/docs/voice/tts/rest-api/examples.md

OpenAI SDK Compatibility

The REST endpoint is a drop-in replacement for the OpenAI Audio API:

API Reference

Source: https://developers.telnyx.com/docs/voice/tts/rest-api/api-reference.md
See the full API reference: Generate Speech from Text.

Providers

Overview

Source: https://developers.telnyx.com/docs/voice/tts/providers/telnyx.md

Selecting Telnyx

Telnyx is the default provider. If you don’t specify a provider, you get Telnyx. WebSocket:
REST:

Models

Ultra is REST-only, not available over public WebSocket. Grok is available for Voice AI Assistants and direct REST TTS calls.
Browse all available voices via the Voices API or the Voice Design.

Natural

Source: https://developers.telnyx.com/docs/voice/tts/providers/telnyx/natural.md
Voice format: Telnyx.Natural. Pre-built English voices backed by Rime Mist.

Voice Samples


WebSocket

Query Parameters

Voice Settings

Send in the init frame ({"text": " "}):

REST API

Fields

Response

Default (binary_output): chunked audio bytes with Content-Type: audio/mpeg (or audio/wav, audio/pcm). With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

NaturalHD

Source: https://developers.telnyx.com/docs/voice/tts/providers/telnyx/naturalhd.md
Voice format: Telnyx.NaturalHD. Pre-built voices backed by Rime Arcana. 9 languages: en, fr, de, es, ar, hi, ja, he, pt.

Voice Samples


WebSocket

Query Parameters

Voice Settings

Send in the init frame ({"text": " "}):

REST API

Fields

Response

Default (binary_output): chunked audio bytes with Content-Type: audio/mpeg (or audio/wav, audio/pcm). With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

KokoroTTS

Source: https://developers.telnyx.com/docs/voice/tts/providers/telnyx/kokoro.md
Voice format: Telnyx.KokoroTTS. Lightweight, lowest-latency model. 5 languages: en, es, fr, it, pt.

Voice Samples


WebSocket

Query Parameters

Voice Settings

None. All synthesis parameters are fixed. The init frame only needs {"text": " "}.

REST API

Fields

No model-specific fields. Audio format is always MP3.

Response

Default (binary_output): chunked audio bytes with Content-Type: audio/mpeg. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

Qwen3TTS

Source: https://developers.telnyx.com/docs/voice/tts/providers/telnyx/qwen3.md
Voice format: Telnyx.Qwen3TTS. Voice cloning model. 11 languages: en, zh, fr, de, it, ja, ko, pt, ru, es, ar. The voice_id is the name of a clone you created in the Voice Design. Clones are scoped to your organization.

Voice Samples


WebSocket

Query Parameters

Voice Settings

Send in the init frame ({"text": " "}):

REST API

Fields

Response

Default (binary_output): chunked PCM audio bytes. Always 24kHz signed 16-bit LE mono. With output_type: "base64_output": JSON with base64-encoded PCM. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

Ultra

Source: https://developers.telnyx.com/docs/voice/tts/providers/telnyx/ultra.md
Voice format: Telnyx.Ultra. Sub-100ms latency. 36 languages. REST only — Ultra is not available over public WebSocket.

Voice Samples


SSML Emotions

Ultra supports inline SSML emotion tags. Place the tag before the text:
Primary emotions: angry, excited, content, sad, scared. Additional: happy, enthusiastic, curious, calm, grateful, affectionate, sarcastic, surprised, confident, hesitant, apologetic, determined, frustrated, disappointed. Omitting the tag = neutral delivery. Use sparingly — Ultra interprets emotional subtext from the text itself.

Nonverbal Cues

Insert [laughter] inline for natural laughing:

Language Support

Set language_boost to improve pronunciation for the target language: Arabic, Bengali, Bulgarian, Chinese, Czech, Danish, Dutch, English, Finnish, French, German, Gujarati, Hebrew, Hindi, Indonesian, Italian, Japanese, Korean, Malay, Marathi, Māori, Norwegian, Polish, Portuguese, Punjabi, Romanian, Russian, Slovak, Spanish, Swedish, Tamil, Telugu, Thai, Turkish, Ukrainian, Vietnamese.

REST API

Fields

Response

Default (binary_output): chunked audio bytes with Content-Type: audio/mpeg. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

See also

xAI Grok is the second TTS provider supporting Expressive Mode. For Grok voice options, see Grok Voices. Note: Grok voices have higher latency than Ultra.

Grok

Source: https://developers.telnyx.com/docs/voice/tts/providers/telnyx/grok.md
xAI Grok voices are expressive text-to-speech voices for Voice AI Assistants. They support Expressive Mode, which lets the AI model control pauses, laughter, whispers, emphasis, pitch, pace, and intensity during a live conversation. Higher latency: Grok voices have higher latency than Ultra. For latency-sensitive applications that need sub-100ms time to first byte, use Ultra.

What makes Grok voices different

Voice format

For AI Assistants, Grok voices use the format:
Examples:

Voices

Voice Samples

Expressive Mode for AI Assistants

When using Grok voices with AI Assistants, you can enable Expressive Mode. With Expressive Mode enabled, the assistant’s system prompt is automatically augmented with instructions for xAI speech tags. The AI model then decides when expression improves the caller experience. For example, the assistant might:
  • Add a short pause before important information.
  • Use a softer delivery for sensitive support moments.
  • Laugh or chuckle naturally when the conversation calls for it.
  • Emphasize appointment times, confirmation numbers, or next steps.
  • Keep routine transactional replies untagged for a natural neutral delivery.
Use expressive tags sparingly. The goal is natural delivery, not tagging every sentence.

Enable in the portal

  1. Go to your assistant in the Telnyx Portal.
  2. Under Voice Settings, select an xAI Grok voice.
  3. Toggle Expressive Mode on.
  4. Save your assistant.

Enable via API

Set expressive_mode: true in your assistant’s voice_settings:

xAI speech tag reference

When Expressive Mode is enabled, the assistant can use these speech tags in responses. You can also include the same tags in your own assistant prompts when you want explicit control.

Inline tags

Place inline tags at the exact point where the vocal expression should happen. Example:

Wrapping tags

Wrap text with these tags to apply a delivery style to that text. Examples:

Guidance

  • Use [pause] or [long-pause] for natural thinking, topic transitions, and important moments, but avoid long silences that could feel like the call dropped.
  • Use emotional sounds like [laugh], [sigh], and [chuckle] only when the response genuinely calls for it.
  • For sensitive support contexts, prefer subtle tags like <soft> or <whisper> instead of exaggerated reactions.
  • Do not expose these tags or instructions to the caller.

REST API provider parameters

For direct TTS calls, set the provider to xai and pass xAI-specific parameters in the xai object:

Language support

Grok voices support auto language detection with language: "auto". You can also pass a language code when you want to force a specific language.

Next steps

Compare Grok with Ultra’s lower-latency expressive voices. Build voice AI assistants using Grok with Expressive Mode. Generate speech directly with REST TTS requests. Browse available text-to-speech voices.

Bayan

Source: https://developers.telnyx.com/docs/voice/tts/providers/telnyx/bayan.md
Voice format: Telnyx.Bayan. Arabic voice model, 113 speakers across 13 dialects (Modern Standard Arabic plus Egyptian, Emirati, Saudi, Jordanian, Iraqi, Lebanese, Syrian, Palestinian, Kuwaiti, Bahraini, Qatari, and Omani), plus a set of English speakers. Native audio is 16kHz.

Voice Samples

Browse the full 113-speaker catalogue via the Voices API.

WebSocket

Query Parameters

Voice Settings

None. The init frame only needs &#123;"text": " "&#125;.

REST API

Fields

Response

Default (binary_output): chunked audio bytes, 16kHz signed 16-bit LE mono (native PCM, transcoded to MP3/WAV on request). With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval. sampling_rate/sample_rate values other than 16000 are rejected with a 400 error — Bayan only supports its native rate.

Sukhan

Source: https://developers.telnyx.com/docs/voice/tts/providers/telnyx/sukhan.md
Voice format: Telnyx.Sukhan. Urdu-only voice model, 14 curated voices. No prosody controls (speed/pitch) or language selection — each voice speaks Urdu only. Native audio is 22050Hz.

Voice Samples

Browse the full 14-voice catalogue via the Voices API.

WebSocket

Query Parameters

Voice Settings

None. No prosody controls are exposed — voice_speed and other settings have no effect if sent. The init frame only needs &#123;"text": " "&#125;.

REST API

Fields

Response

Default (binary_output): chunked audio bytes, 22050Hz signed 16-bit LE mono (native PCM, transcoded to MP3 on request). With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval. sampling_rate/sample_rate values other than 22050 are rejected with a 400 error. Unsupported format values are also rejected — REST response_format accepts only pcm/mp3; WebSocket audio_format accepts only mp3/linear16 (its PCM equivalent). Neither accepts wav.

Rime

Source: https://developers.telnyx.com/docs/voice/tts/providers/rime.md

Models

Voice Format

Coda is Rime’s recommended model for new integrations. It surpasses ArcanaV3 in naturalness, prosody, and artifact-free output.

Voice Samples


WebSocket

Query Parameters

Voice Settings

REST API

Fields

Response

Default (binary_output): chunked audio bytes. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

Minimax

Source: https://developers.telnyx.com/docs/voice/tts/providers/minimax.md
Voice format: minimax.. voice_id can be a system voice (pre-built) or a cloned voice from the Voice Design (organization-scoped).

Voice Samples


WebSocket

Query Parameters

Voice Settings

REST API

Fields

Response

Default (binary_output): chunked audio bytes. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

Resemble

Source: https://developers.telnyx.com/docs/voice/tts/providers/resemble.md
Voice format: resemble.Turbo. Default model: Turbo. voice_id is a voice from your own Resemble account.

Voice Samples


WebSocket

Query Parameters

Voice Settings

REST API

Fields

Response

Default (binary_output): chunked audio bytes. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

Inworld

Source: https://developers.telnyx.com/docs/voice/tts/providers/inworld.md
Voice format: inworld.. Models:
  • inworld-tts-1.5-mini (alias Mini) — faster, lower latency.
  • inworld-tts-1.5-max (alias Max) — higher quality.
  • inworld-tts-2 (alias TTS2) — latest generation; supports the delivery_mode parameter.
Defaults to inworld-tts-1.5-mini if model omitted.

Voice Samples


WebSocket

Query Parameters

Voice Settings

REST API

Fields

Response

Default (binary_output): chunked audio bytes. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

xAI

Source: https://developers.telnyx.com/docs/voice/tts/providers/xai.md
Voice format: xAI. xAI Grok voices are expressive, multilingual text-to-speech voices. They support inline speech tags for pauses, vocal sounds, emphasis, pitch, pace, and intensity. xAI Grok voices are higher-latency than Telnyx Ultra. For latency-sensitive applications that need sub-100ms time to first byte, use Ultra.

Voices

Voice Samples


WebSocket

xAI Grok voices are not available on the public TTS WebSocket API. Use the REST API for direct text-to-speech generation, or use xAI Grok voices with AI Assistants.

REST API

Fields

Response

Default (binary_output): chunked audio bytes. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

Expressive speech tags

Use speech tags inline in text when you want more expressive delivery.
Use expressive tags sparingly. The goal is natural delivery, not tagging every sentence.

AI Assistants

For AI Assistants, choose an xAI Grok voice such as xAI.eve and enable Expressive Mode to let the assistant decide when speech tags improve the caller experience. Build voice AI assistants using xAI Grok voices with Expressive Mode. Generate speech directly with REST TTS requests.

Fish Audio

Source: https://developers.telnyx.com/docs/voice/tts/providers/fishaudio.md
Voice format: FishAudio.. Fish Audio is a Telnyx-hosted external TTS provider. Telnyx exposes a hand-vetted shortlist of Fish Audio voices from their public Voice Library. Fish Audio is cross-lingual — any voice can speak any language from the input text. The language field in the voice listing is the voice’s native accent only, not a synthesis constraint.

Models

All curated voices are available under all three models.

Curated Voices

Only curated catalog voices are accepted for synthesis. Arbitrary Fish Voice-Library reference_ids cannot be used under the Telnyx API key.

Emotion Tags

Fish Audio S2 models (s2.1-pro, s2-pro) support inline emotion, tone, and audio-effect markers placed directly in the input text. S1 uses parentheses — (happy) — instead of brackets. The markers are processed by the upstream Fish Audio API and do not add latency or count toward token limits.
The same syntax works on both the REST endpoint and the WebSocket text field. Markers can be combined for layered effects — [excited][laughing] We won! Ha ha! — and accept intensity modifiers like [slightly sad], [very excited], [extremely angry]. For the full list of supported emotions, tone markers, audio effects, and S1 syntax, see Fish Audio’s Emotion Control guide.

WebSocket

Query Parameters

Voice Settings

Fish Audio does not expose speed or pitch controls. voice_settings are limited to format and sample rate overrides. Emotion and tone are controlled inline in the text via bracket markers — see Emotion Tags below.

REST API

Fields

Response

Default (binary_output): chunked audio bytes. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

Audio Formats & Sample Rates

Each format has a fixed set of accepted sample rates: On WebSocket, the audio_format query parameter and voice_settings.format are independent parameters with different vocabularies. The audio_format query param accepts mp3, wav, and linear16 (which maps to pcm). The voice_settings.format field accepts mp3, wav, pcm, and opus directly. If both are set, voice_settings.format takes precedence.

In-Call Playback

Fish Audio is available for in-call TTS via Call Control speak and TeXML “. For telephony playback, the gateway automatically delivers MP3 at 44.1 kHz to ensure correct resampling by the call-control audio pipeline. See In-Call Playback for details.

Provider Docs


AWS Polly

Source: https://developers.telnyx.com/docs/voice/tts/providers/aws.md
Voice format: aws.Polly.. Example: aws.Polly.Generative.Lucia The engine can also be parsed from a hyphenated suffix on the voice ID — e.g., Lucia-longform resolves to engine long-form.

Voice Samples


WebSocket

Query Parameters

Voice Settings

REST API

Fields

Response

Default (binary_output): chunked audio bytes. Format depends on output_format. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

SSML Tags

Source: https://developers.telnyx.com/docs/voice/tts/providers/aws/ssml-tags.md
In this tutorial, you’ll learn about SSML tags that can help customize your audio response in your text-to-speech application. This tutorial assumes you’ve already set up your developer account and environment and you know how to send commands and receive webhooks using the Telnyx Voice API.

What are SSML tags?

Speech Synthesis Markup Language (SSML) is an XML-based markup language that is used to generate synthetic speech for appliations. SSML tags are used to change the tone of speech in the application by adjusting pitching, volume, duration of speech, and more.

SSML tag examples

Adding a pause

SSML Tag: There are 2 ways for defining the length of the pause by using the following attributes:
  1. Time: Defines the number of s or ms
  2. Strength: Chooses the strength using the following values:
  • None: no pause
  • Pause: the same duration as after a period
  • x-weak: the same as none.
  • weak: sets a pause of the same duration as the pause after a comma
  • medium: has the same strength as weak
  • strong: sets a pause of the same duration as the pause after a sentence
  • x-strong: sets a pause of the same duration as the pause after a paragraph.
Example:

Emphasizing words

SSML Tag:
The emphasising affects the speed and loudness of reading words and can be defined by using a ‘level’ attribute with one of the following values:
  1. Strong - increases the volume and slows the speaking rate
  2. Moderate - increases the volume and slows the speaking rate, but less than Strong
  3. Reduced - decreases the volume and speeds up the speaking rate
Example:

Set a different language

SSML Tag:
The xml:lang tag defines the language for a specific word or sentence. __Example: __

Adding a pause between paragraphs

SSML Tag:
This tag adds a pause between paragraphs that is longer than a regular pause at a comma or at the end of the sentence. Example:

Using phonetic pronunciation

SSML Tag:
The phonetic pronunciation requires 2 attributes:
  1. Alphabet, with the following options:
  • ipa, meaning the International Phonetic Alphabet (IPA) will be used
  • x-sampa, which indicates that the Extended Speech Assessment Methods Phonetic Alphabet (X-SAMPA) will be used.
  1. ph, specifies how the text should be pronounced.
Example:

Controlling volume, speaking rate, and pitch

SSML Tag::
The following attributes can be used with the Prosody tag:
  1. Volume:
  • default: resets the volume to default value
  • silent, x-soft, soft, medium, loud, x-loud: sets the volume to predefined value
  • +ndB, -ndB: changes the volume relative to the current level
  1. Rate:
  • x-slow, slow, medium, fast,x-fast: sets the pitch to a predefined value
  • n%: a percentage change in speaking pace.
Exmaple:

Adding a pause between sentences

SSML Tag:
This tag adds a pause between lines with the same effect as (.) Example:

Controlling how special words are spoken

SSML Tags:
The say-as tag uses one attribute,‘interpret-as’, which uses a number of possible available values:
  • characters or spell-out
  • cardinal or number
  • digits
  • fraction
  • unit
  • date
  • time
  • address
  • telephone.
Example:

Pronouncing acronyms and abbreviations

SSML Tag:
This tag should be used with the alias attribute to substitute a different word for selected text such as an acronym or abbreviation. Example:

Azure

Source: https://developers.telnyx.com/docs/voice/tts/providers/azure.md
Voice format: azure. Example: azure.en-US-AvaMultilingualNeural No model ID segment — Azure voices are flat identifiers. Default voice: en-US-AvaMultilingualNeural.

Voice Samples


WebSocket

Query Parameters

Voice Settings

REST API

Fields

Response

Default (binary_output): chunked audio bytes. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

ElevenLabs

Source: https://developers.telnyx.com/docs/voice/tts/providers/elevenlabs.md
ElevenLabs requires your own API key configured in your Telnyx account. Telnyx relays requests to the ElevenLabs API — voice settings are passed through directly. Voice format: elevenlabs.. Example: elevenlabs.v3.Adam voice_id is a voice from your own ElevenLabs account — pre-built, cloned, or designed. Preview voices at elevenlabs.io/voice-library.

WebSocket

Query Parameters

Voice Settings

Relayed directly to the ElevenLabs API. Any field ElevenLabs accepts can be passed here.

REST API

Fields

Response

Default (binary_output): chunked audio bytes. Format determined by ElevenLabs. With output_type: "base64_output": JSON with base64-encoded audio. With output_type: "audio_id": JSON with an audio_url for deferred retrieval.

Other

Pronunciation Dictionaries

Source: https://developers.telnyx.com/docs/voice/tts/pronunciation-dictionaries.md
Pronunciation dictionaries let you control how specific words and phrases are spoken during text-to-speech synthesis. Dictionaries are applied automatically before speech generation — no changes to your text input required.

Item Types

Each dictionary contains up to 100 items. Two types are supported:

Alias (text replacement)

Replaces matched text with alternative text before synthesis:

Phoneme (IPA notation)

Specifies exact pronunciation using the International Phonetic Alphabet:

Using a Dictionary

Pass the dictionary ID when synthesizing speech: REST API:
WebSocket: pass pronunciation_dict_id as a query parameter on the connection URL:

Managing Dictionaries

Create a dictionary

You can also upload a PLS/XML or plain text file via multipart/form-data instead of providing items as JSON. Plain text format:

List dictionaries

Get a dictionary

Update a dictionary

Updates use optimistic locking — if the dictionary was modified concurrently, the request returns 409 Conflict. Re-fetch and retry.

Delete a dictionary

Limits

File Upload Formats

When creating a dictionary via file upload, two formats are supported: PLS/XML — standard W3C Pronunciation Lexicon Specification format:
Plain text — line-based format:
  • word=alias for alias items
  • word:/phoneme/ for IPA phonemes

In-Call Playback

Source: https://developers.telnyx.com/docs/voice/tts/in-call-playback.md
In-call TTS plays synthesized speech during live voice calls. Two integration paths:

Voice API

Use the speak command to play TTS on an active call:
See Voice API docs for the full command reference.

TeXML

Use the “ element:
See TeXML docs for the full “ reference.

AI Assistants

AI Assistants use TTS for voice output. Configure the voice model in assistant settings. See AI Assistants for voice configuration.

Voice Selection

In-call TTS uses the same voice format as WebSocket and REST:
All models (including Ultra) are available for in-call playback.

Pricing

Source: https://developers.telnyx.com/docs/voice/tts/rest-api/pricing.md
Pricing for WebSocket TTS varies by engine and model. Contact sales or check the pricing page for current rates.

API Reference (TTS)

Text To Speech Commands

  • List available voices: Retrieve a list of available voices from one or all TTS providers. When provider is specified, returns voices for that provider only. Otherwise, returns voic…