It supports multiple languages and voices, making it ideal for real-time conversational agents, narrated content, accessibility tools, and voice-enabled applications. The ElevenLabs plugin for the Stream Python AI SDK allows you to add TTS functionality to your project.
Installation
Install the Stream ElevenLabs plugin withExample
Check out our Elevenlabs example to see a practical implementation of the plugin and get inspiration for your own projects, or read on for some key details.Initialisation
The ElevenLabs plugin for Stream exists in the form of theTTS
class:
To initialise without passing in the API key, make sure the
ELEVENLABS_API_KEY
is available as an environment variable.
You can do this either by defining it in a .env
file or exporting it directly in your terminal.Parameters
These are the parameters available in the ElevenLabsTTS plugin for you to customise:Name | Type | Default | Description |
---|---|---|---|
api_key | str or None | None | Your ElevenLabs API key. If not provided, the plugin will look for the ELEVENLABS_API_KEY environment variable. |
voice_id | str | "VR6AewLTigWG4xSOukaG" | The ID of the voice to use for TTS. You can use any voice from your ElevenLabs account. |
model_id | str | "eleven_multilingual_v2" | The ID of the ElevenLabs TTS model to use. Controls the language and tone model for synthesis. |
Functionality
Send text to convert to speech
Thesend()
method sends the text passed in for the service to synthesize.
The resulting audio is then played through the configured output track.