Skip to main content
LiveKit’s agent framework lets you build real-time, programmable voice agents. Telnyx integrates with LiveKit through the OpenAI plugin for LLM inference and through a Telnyx plugin for native STT and TTS.

Voice assistant example

This example is based on LiveKit’s agents examples repo, modified to use Telnyx for LLM inference.

Set up and activate a virtual env

Install requirements

Download files

This downloads model weights for voice-activity detection:

Agent code

The following code uses Telnyx for LLM inference via openai.LLM.with_telnyx(), with Telnyx STT and TTS.

Set environment variables

Run the agent worker

Test with a LiveKit frontend

Use the LiveKit Agents Playground to test your agent without building a frontend.

Telnyx STT and TTS plugins

Two Telnyx plugins provide native STT and TTS for LiveKit agents. Both install the livekit.plugins.telnyx module and provide telnyx.STT and telnyx.TTS, so install only one. Install the Telnyx-maintained plugin:
Or install the official plugin:

STT

Use telnyx.STT() for real-time speech-to-text via Telnyx’s WebSocket streaming API:

TTS

Use telnyx.TTS() for real-time text-to-speech over Telnyx’s WebSocket streaming API. Pass a voice parameter to select a specific voice:
See TTS available voices for the full list of voice options.