Check out our upcoming events and meetups! View events →
REST TTS code examples — OpenAI SDK compatibility, streaming playback, async retrieval.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_TELNYX_API_KEY",
base_url="https://api.telnyx.com/v2"
)
response = client.audio.speech.create(
model="tts-1-hd",
voice="astra",
input="Hello from Telnyx."
)
response.stream_to_file("output.mp3")
Was this page helpful?