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.
SkillScore92Maintained
Automatic
◆AI Engineer pack
Last verified 8/22/2026
What it changes
Passed 22 of 24 test cases with the skill, and 5 of 24 without it.
Without skill21%
With skill92%
Checks it passed that the model alone missed
Imports Telnyx from telnyx.
Iterates over response.voices.
Catches telnyx.APIStatusError.
and 23 more in the full report
17 fixed5 passed either way2 still failing0 broke
Pass-rate lift
+71 pp
Tokens
+3%
Agent turns
0%
Response time
-67%
Model gemini-3.6-flashMeasured 8/22/2026v122 of 24 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 17 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 17
Prompt
Show the standard Python code to import and instantiate the Telnyx client object reading the API key from the TELNYX_API_KEY environment variable.
case-18 · gemini-3.6-flash · 8/22/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md157 linessingle file
Telnyx Text-to-Speech - Python
Installation
pip install telnyx
Setup
import 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.
Error Handling
All API calls can fail with network errors, rate limits (429), validation errors (422),
or authentication errors (401). Always handle errors in production code:
import 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}")