Text to Dialogue quickstart

Learn how to generate immersive dialogue from text.

Eleven v3 API access is currently not publicly available, but will be soon. To request access, please contact our sales team.

This guide will show you how to generate immersive, natural-sounding dialogue from text using the Text to Dialogue API.

Using the Text to Dialogue API

1

Create an API key

Create an API key in the dashboard here, which you’ll use to securely access the API.

Store the key as a managed secret and pass it to the SDKs either as a environment variable via an .env file, or directly in your app’s configuration depending on your preference.

.env
1ELEVENLABS_API_KEY=<your_api_key_here>
2

Install the SDK

We’ll also use the dotenv library to load our API key from an environment variable.

1pip install elevenlabs
2pip install python-dotenv
3

Make the API request

Create a new file named example.py or example.mts, depending on your language of choice and add the following code:

1# example.py
2from dotenv import load_dotenv
3from elevenlabs.client import ElevenLabs
4from elevenlabs import play
5
6load_dotenv()
7
8elevenlabs = ElevenLabs(
9 api_key=os.getenv("ELEVENLABS_API_KEY"),
10)
11
12audio = elevenlabs.text_to_dialogue.convert(
13 # Text to Dialogue defaults to using the evergreen model "eleven_v3",
14 # but you can use a preview version to try out
15 # the latest features by providing the model ID
16 # model_id="eleven_v3_preview_2025_06_03"
17 inputs=[
18 {
19 "text": "[cheerfully] Hello, how are you?",
20 "voice_id": "9BWtsMINqrJLrRacOk9x",
21 },
22 {
23 "text": "[stuttering] I'm... I'm doing well, thank you",
24 "voice_id": "IKne3meq5aSn9XLyUdCD",
25 }
26 ]
27)
28
29play(audio)
4

Execute the code

1python example.py

You should hear the dialogue audio play.

Next steps

Explore the API reference for more information on the Text to Dialogue API and its options.