> ## Documentation Index
> Fetch the complete documentation index at: https://visionagents.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Telnyx TTS

[Telnyx](https://telnyx.com/) provides streaming text-to-speech over WebSocket. The plugin opens a new socket per synthesis call, decodes MP3 audio to `PcmData` as it streams, and takes the output sample rate from the decoder so the voice controls the rate.

<Info>
  Vision Agents uses [Stream Video](https://getstream.io/video/) for real-time WebRTC transport by default. [External WebRTC transports](/integrations/introduction-to-integrations#edge-transport) are supported as well. Most AI providers offer free tiers to get started.
</Info>

<Info>
  Get your Telnyx API key from the [Telnyx Mission Control Portal](https://portal.telnyx.com/).
</Info>

<Tip>
  Telnyx also provides [speech-to-text](/integrations/stt/telnyx), an [LLM](/integrations/llm/telnyx), and [PSTN telephony](/integrations/telephony/telnyx). You can use all four in the same agent.
</Tip>

## Installation

```sh theme={null}
uv add "vision-agents[telnyx]"
```

## Quick start

```python theme={null}
from vision_agents.core import Agent, User
from vision_agents.plugins import getstream, smart_turn, telnyx

agent = Agent(
    edge=getstream.Edge(),
    agent_user=User(name="Assistant", id="agent"),
    instructions="You are a helpful voice assistant.",
    stt=telnyx.STT(),
    llm=telnyx.LLM(),
    tts=telnyx.TTS(voice="AWS.Polly.Danielle-Neural"),
    turn_detection=smart_turn.TurnDetection(),
)
```

<Warning>
  Set `TELNYX_API_KEY` in your environment or pass `api_key` directly.
</Warning>

## Parameters

```python theme={null}
tts = telnyx.TTS(
    voice="Telnyx.KokoroTTS.af_heart",
    idle_timeout=10.0,
    connect_timeout=10.0,
)
```

| Name              | Type    | Default                       | Description                                                   |
| ----------------- | ------- | ----------------------------- | ------------------------------------------------------------- |
| `voice`           | `str`   | `"Telnyx.KokoroTTS.af_heart"` | Voice id from `GET /v2/text-to-speech/voices`                 |
| `idle_timeout`    | `float` | `10.0`                        | Seconds of server silence before synthesis is treated as done |
| `connect_timeout` | `float` | `10.0`                        | Seconds to wait for the WebSocket handshake                   |
| `api_key`         | `str`   | `None`                        | API key (defaults to `TELNYX_API_KEY` env var)                |

## Audio format

The endpoint takes an `audio_format` parameter, but it is honoured only by some voices. `AWS.Polly.*` and `Telnyx.NaturalHD.*` serve raw PCM, while the default `Telnyx.KokoroTTS.*` returns MP3 regardless. Since the PCM sample rate is not reported on the wire and differs per voice, the plugin decodes MP3 for every voice rather than carrying a voice-to-rate table that would go stale.

## Next steps

<CardGroup cols={2}>
  <Card title="Telnyx STT" icon="microphone" href="/integrations/stt/telnyx">
    Streaming speech-to-text
  </Card>

  <Card title="Telnyx LLM" icon="brain" href="/integrations/llm/telnyx">
    OpenAI-compatible chat completions
  </Card>

  <Card title="Telnyx Telephony" icon="phone" href="/integrations/telephony/telnyx">
    PSTN calls via Call Control
  </Card>

  <Card title="Build a Voice Agent" icon="microphone-lines" href="/introduction/voice-agents">
    Get started with voice
  </Card>
</CardGroup>
