Developer quickstart

Learn how to make your first ElevenLabs API request.

The ElevenLabs API provides a simple interface to state-of-the-art audio models and features. Follow this guide to learn how to create lifelike speech, generate and modify voices, produce immersive sound effects, isolate background noise from audio, and seamlessly dub audio/videos.

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';

Make your first request

You can either use the REST API directly with the HTTP client of your choice, or use one of our official SDKs as shown below. This guide will use the official SDKs to make requests.

$pip install elevenlabs

To play the audio through your speakers, you may be prompted to install MPV and/or ffmpeg.

The environment variables are loaded automatically when using the SDK, but we need to install the python-dotenv package to load them.

Install python-dotenv
$pip install python-dotenv

With the ElevenLabs SDK installed, create a file called example.py and copy one of the following examples into it:

Convert text into life-like audio
1from dotenv import load_dotenv
2from elevenlabs.client import ElevenLabs
3from elevenlabs import play
4
5load_dotenv()
6
7client = ElevenLabs()
8
9audio = client.text_to_speech.convert(
10 text="The first move is what sets everything in motion.",
11 voice_id="JBFqnCBsd6RMkjVDRZzb",
12 model_id="eleven_multilingual_v2",
13 output_format="mp3_44100_128",
14)
15
16play(audio)

Execute the code with python example.py. Within a few seconds you should hear the audio play through your speaker.

Run the script
$python example.py

To play the audio through your speakers, you may be prompted to install MPV and/or ffmpeg.

Next steps

Now that you’ve made your first ElevenLabs API request, you can explore the following resources:

Built with