Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generates speech from text via Telnyx and third-party TTS providers, returning base64 audio or a binary stream, and lists voices.
21% 92%+71 ptsof test cases passed
Passed 22 of 24 test cases with the skill, and 5 of 24 without it.
Show the standard Python code to import and instantiate the Telnyx client object reading the API key from the TELNYX_API_KEY environment variable.
Imports Telnyx from telnyx.
3 of 3 safety checks passed
pip install telnyx
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.
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}")
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.