Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generate speech from text using Telnyx and third-party TTS providers (AWS, Azure, ElevenLabs, MiniMax, Resemble, Rime, xAI). Returns base64-encoded audio or a binary stream. Also lists available voices per provider.
.claude/skills/team-telnyx-telnyx-tts-python/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-08 | ✗→✓ | ▲ Improved | -57% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -16% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 19% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -24% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 21% | 0% |
bashpip install telnyx
pythonimport os from telnyx import Telnyx client = Telnyx( api_key=os.environ.get("TELNYX_API_KEY"), )
All examples below assume client is already initialized as shown above.
All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:
pythonimport telnyx try: response = client.text_to_speech.generate(text="Hello world") except telnyx.APIConnectionError: print("Network error — check connectivity and retry") except telnyx.RateLimitError: import time time.sleep(1) except telnyx.APIStatusError as e: print(f"API error {e.status_code}: {e.message}")
Common error codes: 401 invalid API key, 403 insufficient permissions, 404 resource not found, 422 validation error, 429 rate limited.
Generate synthesized speech audio from text input. Returns audio as base64-encoded JSON (base64_output) or a binary audio stream (binary_output).
POST /text-to-speech/speech
| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | text | string | Yes | The text to synthesize. | | provider | enum | No | TTS provider: telnyx, aws, azure, elevenlabs, minimax, resemble, rime. Default: telnyx. | | voice | string | No | Voice ID to use (e.g., en-US-Standard-A for AWS). | | output_type | enum | No | binary_output or base64_output. Default: binary_output. | | text_type | enum | No | text or ssml. Default: text. | | language | string | No | Language code (e.g., en-US). | | voice_settings | object | No | Advanced voice settings (speed, pitch, volume). | | telnyx | object | No | Telnyx-specific provider options. | | aws | object | No | AWS-specific provider options. | | azure | object | No | Azure-specific provider options. | | elevenlabs | object | No | ElevenLabs-specific provider options. | | minimax | object | No | MiniMax-specific provider options. | | resemble | object | No | Resemble-specific provider options. | | rime | object | No | Rime-specific provider options. | | disable_cache | boolean | No | Disable response caching. |
python# Default Telnyx provider response = client.text_to_speech.generate( text="Hello from Telnyx!", ) print(response.base64_audio) # AWS provider with specific voice response = client.text_to_speech.generate( text="Hello from Telnyx!", provider="aws", voice="en-US-Standard-A", output_type="base64_output", ) print(response.base64_audio) # SSML input response = client.text_to_speech.generate( text="<speak>Hello <break time='1s'/> world</speak>", text_type="ssml", ) print(response.base64_audio) # ElevenLabs provider response = client.text_to_speech.generate( text="Hello from Telnyx!", provider="elevenlabs", voice="21m00Tcm4TlvDq8ikWAM", output_type="base64_output", ) print(response.base64_audio)
Primary response fields:
response.base64_audio — Base64-encoded audio data (when output_type is base64_output)output_type is binary_output)Retrieve a list of available voices from one or all TTS providers.
GET /text-to-speech/voices
| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | provider | enum | No | Filter by provider: telnyx, aws, azure, elevenlabs, minimax, resemble, rime. |
python# List all voices across all providers response = client.text_to_speech.list_voices() for voice in response.voices: print(f"{voice['name']} — {voice['provider']} ({voice['language']})") # List only AWS voices response = client.text_to_speech.list_voices(provider="aws") for voice in response.voices: print(f"{voice['name']} — {voice['language']}")
Primary response fields:
response.voices — Array of voice objects with name, provider, language, voice_idThe Telnyx Agent CLI provides composite commands for TTS:
bash# Generate speech telnyx-agent tts --text "Hello world" --json # Generate with specific provider and voice telnyx-agent tts --text "Hello world" --provider aws --voice en-US-Standard-A --json # List available voices telnyx-agent tts-voices --json # Filter voices by provider telnyx-agent tts-voices --provider elevenlabs --json
output_type is base64_output, decode the base64 string to get the audio bytes. When binary_output, the response is a raw audio stream.text_type: "ssml" to send SSML markup for fine-grained control over pronunciation, pauses, and emphasis.aws, azure, elevenlabs, etc.) has its own object for provider-specific configuration (e.g., AWS engine type, ElevenLabs stability).disable_cache: true to bypass.--provider xai) and supports voice listing.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-08 | fail→pass | 24,518 | 1,845 | -92% | 1 | 1 | 0% | 4,296 | 1,838 | -57% | 0 | 0 | — |
case-03 | fail→pass | 13,218 | 2,283 | -83% | 1 | 1 | 0% | 2,395 | 2,002 | -16% | 0 | 0 | — |
case-01 | fail→pass | 13,954 | 7,251 | -48% | 1 | 1 | 0% | 2,600 | 3,100 | +19% | 0 | 0 | — |
case-02 | fail→pass | 17,187 | 5,166 | -70% | 1 | 1 | 0% | 3,394 | 2,591 | -24% | 0 | 0 | — |
case-04 | fail→pass | 10,488 | 3,793 | -64% | 1 | 1 | 0% | 1,901 | 2,302 | +21% | 0 | 0 | — |
case-05 | fail→pass | 13,853 | 4,637 | -67% | 1 | 1 | 0% | 2,516 | 2,455 | -2% | 0 | 0 | — |
case-06 | fail→pass | 11,492 | 4,691 | -59% | 1 | 1 | 0% | 2,052 | 2,428 | +18% | 0 | 0 | — |
case-07 | fail→pass | 10,736 | 4,864 | -55% | 1 | 1 | 0% | 1,938 | 2,423 | +25% | 0 | 0 | — |
case-09 | fail→pass | 16,336 | 4,038 | -75% | 1 | 1 | 0% | 3,213 | 2,388 | -26% | 0 | 0 | — |
case-10 | fail→pass | 13,067 | 2,620 | -80% | 1 | 1 | 0% | 2,268 | 1,988 | -12% | 0 | 0 | — |
case-11 | fail→pass | 12,564 | 3,296 | -74% | 1 | 1 | 0% | 2,258 | 2,186 | -3% | 0 | 0 | — |
case-12 | fail→pass | 9,157 | 1,503 | -84% | 1 | 1 | 0% | 1,630 | 1,727 | +6% | 0 | 0 | — |
case-13 | fail→pass | 7,049 | 1,647 | -77% | 1 | 1 | 0% | 1,280 | 1,806 | +41% | 0 | 0 | — |
case-14 | fail→fail | 8,499 | 1,438 | -83% | 1 | 1 | 0% | 1,500 | 1,751 | +17% | 0 | 0 | — |
case-15 | pass→pass | 13,017 | 7,079 | -46% | 1 | 1 | 0% | 2,606 | 2,974 | +14% | 0 | 0 | — |
case-16 | fail→pass | 10,396 | 1,946 | -81% | 1 | 1 | 0% | 1,974 | 1,915 | -3% | 0 | 0 | — |
case-17 | pass→pass | 3,939 | 1,380 | -65% | 1 | 1 | 0% | 700 | 1,780 | +154% | 0 | 0 | — |
case-18 | fail→pass | 5,384 | 1,536 | -71% | 1 | 1 | 0% | 951 | 1,797 | +89% | 0 | 0 | — |
case-19 | fail→pass | 13,073 | 3,188 | -76% | 1 | 1 | 0% | 2,489 | 2,150 | -14% | 0 | 0 | — |
case-20 | fail→fail | 13,297 | 1,458 | -89% | 1 | 1 | 0% | 2,524 | 1,737 | -31% | 0 | 0 | — |
case-21 | fail→pass | 9,364 | 3,535 | -62% | 1 | 1 | 0% | 1,635 | 2,061 | +26% | 0 | 0 | — |
case-22 | pass→pass | 14,309 | 9,757 | -32% | 1 | 1 | 0% | 2,724 | 3,318 | +22% | 0 | 0 | — |
case-23 | pass→pass | 13,429 | 10,335 | -23% | 1 | 1 | 0% | 2,716 | 3,662 | +35% | 0 | 0 | — |
case-24 | pass→pass | 7,234 | 4,534 | -37% | 1 | 1 | 0% | 1,423 | 2,385 | +68% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +71 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.