agentsclimarketplace

Telnyx tts python

Skill team-telnyx/ai/providers/cursor/plugin/skills/telnyx-tts-python

Official one-stop shop for AI Agents and developers building with Telnyx.

Install
npx -y skills add team-telnyx/ai --skill telnyx-tts-python

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

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.

SKILL.md

5.5 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it

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}")

Common error codes: 401 invalid API key, 403 insufficient permissions, 404 resource not found, 422 validation error, 429 rate limited.

Core Tasks

Generate speech from text

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

ParameterTypeRequiredDescription
textstringYesThe text to synthesize.
providerenumNoTTS provider: telnyx, aws, azure, elevenlabs, minimax, resemble, rime. Default: telnyx.
voicestringNoVoice ID to use (e.g., en-US-Standard-A for AWS).
output_typeenumNobinary_output or base64_output. Default: binary_output.
text_typeenumNotext or ssml. Default: text.
languagestringNoLanguage code (e.g., en-US).
voice_settingsobjectNoAdvanced voice settings (speed, pitch, volume).
telnyxobjectNoTelnyx-specific provider options.
awsobjectNoAWS-specific provider options.
azureobjectNoAzure-specific provider options.
elevenlabsobjectNoElevenLabs-specific provider options.
minimaxobjectNoMiniMax-specific provider options.
resembleobjectNoResemble-specific provider options.
rimeobjectNoRime-specific provider options.
disable_cachebooleanNoDisable response caching.
# 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)
  • Binary stream (when output_type is binary_output)

List available voices

Retrieve a list of available voices from one or all TTS providers.

GET /text-to-speech/voices

ParameterTypeRequiredDescription
providerenumNoFilter by provider: telnyx, aws, azure, elevenlabs, minimax, resemble, rime.
# 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_id

CLI Usage

The Telnyx Agent CLI provides composite commands for TTS:

# 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

Important Notes

  • Audio format: When output_type is base64_output, decode the base64 string to get the audio bytes. When binary_output, the response is a raw audio stream.
  • SSML: Use text_type: "ssml" to send SSML markup for fine-grained control over pronunciation, pauses, and emphasis.
  • Provider-specific options: Each provider (aws, azure, elevenlabs, etc.) has its own object for provider-specific configuration (e.g., AWS engine type, ElevenLabs stability).
  • Caching: Responses are cached by default. Use disable_cache: true to bypass.
  • xAI: The xAI provider is available via the CLI (--provider xai) and supports voice listing.

Gives 0 of the 12 instructions most containers cloud skills give in ~1.4k tokens

Counted across 607 of the 657 authors here whose files we hold, read 2026-08-07

  • run containers as a non-root userin 66 of 607, across 46 files
  • use multi-stage buildsin 53 of 607, across 44 files
  • use Promise.all for independent operationsin 47 of 607, across 13 files
  • import directly instead of barrel filesin 46 of 607, across 12 files
  • use ternary instead of AND for conditionalsin 45 of 607, across 12 files
  • use Set or Map for O(1) lookupsin 42 of 607, across 10 files
  • create a .dockerignore filein 41 of 607, across 31 files
  • Read individual rule files for detailsin 39 of 607, across 9 files
  • copy dependency files before source codein 36 of 607, across 23 files
  • authenticate server actions like API routesin 35 of 607, across 7 files
  • use next/dynamic for heavy componentsin 34 of 607, across 9 files
  • use React.cache for per-request deduplicationin 34 of 607, across 10 files

Said here and by no other author read

  • install the telnyx package
  • initialize the client with an api key
  • handle rate limit errors
  • generate speech using a supported provider
  • retrieve a list of available voices
  • filter available voices by provider

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.