ElevenLabs

ElevenLabs is a leading voice AI platform that offers advanced Text-to-Speech (TTS) capabilities with highly realistic and expressive voices.
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 the TTS functionality to your project.

Initialisation

The ElevenLabs plugin for Stream exists in the form of the ElevenLabsTTS class:

tts = ElevenLabsTTS()
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:

NameTypeDefaultDescription
api_keystr or NoneNoneYour ElevenLabs API key. If not provided, the plugin will look for the ELEVENLABS_API_KEY environment variable.
voice_idstr"VR6AewLTigWG4xSOukaG"The ID of the voice to use for TTS. You can use any voice from your ElevenLabs account.
model_idstr"eleven_multilingual_v2"The ID of the ElevenLabs TTS model to use. Controls the language and tone model for synthesis.

Functionality

Set output track

The set_output_track() method sets the audio output track for the synthesized speech.

tts.set_output_track(track)

Send text to convert to speech

The send() method sends the text passed in for the service to synthesize. The resulting audio is then played through the configured output track.

tts.send("Demo text you want AI voice to say")

Example

Check out our Elevenlabs example to see a practical implementation of the plugin and get inspiration for your own projects.

© Getstream.io, Inc. All Rights Reserved.