eleven_music

circle-info

This documentation is valid for the following list of our models:

  • elevenlabs/eleven_music

An advanced audio generation model designed to create high-quality audio tracks from textual prompts.

How to Make a Call

chevron-rightStep-by-Step Instructionshashtag

1️ Setup You Can’t Skip

▪️ Create an Accountarrow-up-right: Visit the AI/ML API website and create an account (if you don’t have one yet). ▪️ Generate an API Keyarrow-up-right: After logging in, navigate to your account dashboard and generate your API key. Ensure that key is enabled on UI.

2️ Copy the code example

At the bottom of this page, you'll find a code example that shows how to structure the request. Choose the code snippet in your preferred programming language and copy it into your development environment.

circle-check

3️ Modify the code example

▪️ Replace <YOUR_AIMLAPI_KEY> with your actual AI/ML API key from your account. ▪️ Provide your instructions via the prompt parameter. The model will use them to generate a musical composition.

4️ (Optional) Adjust other optional parameters if needed

Only prompt is a required parameter for this model (and we’ve already filled it in for you in the example), but you can include optional parameters if needed to adjust the model’s behavior. Below, you can find the corresponding API schema ("Generate a music sample"), which lists all available parameters along with notes on how to use them.

5️ Run your modified code

Run your modified code in your development environment. Response time depends on various factors, but for simple prompts it rarely exceeds 30 seconds.

circle-check

API Schemas

Generate a music sample

This endpoint creates and sends a music generation task to the server — and returns a generation ID and the task status.

post
Body
modelstring · enumRequiredPossible values:
promptstring · max: 2000Required

A text description that can define the genre, mood, instruments, vocals, tempo, structure, and even lyrics of the track. It can be high-level (“peaceful meditation with voiceover”) or detailed (“solo piano in C minor, 90 BPM, raw and emotional”). Use keywords to control genre, emotional tone, vocals (e.g., a cappella, two singers harmonizing), structure (e.g., “lyrics begin at 15 seconds”), or provide custom lyrics directly in the prompt.

music_length_msinteger · milliseconds · min: 10000 · max: 300000Optional

The length of the song to generate in milliseconds. This parameter may not always be respected by the model, and the actual audio length can differ.

Default: 10000
Responses
chevron-right
200Success
application/json
post
/v2/generate/audio
200Success

Retrieve the generated music sample from the server

After sending a request for music generation, this task is added to the queue. This endpoint lets you check the status of a audio generation task using its id, obtained from the endpoint described above. If the video generation task status is complete, the response will include the final result — with the generated audio URL and additional metadata.

get
Authorizations
AuthorizationstringRequired

Bearer key

Query parameters
generation_idstringRequiredExample: <REPLACE_WITH_YOUR_GENERATION_ID>
Responses
chevron-right
200Success
application/json
get
/v2/generate/audio
200Success

Full Example: Generating and Retrieving the Audio From the Server

The code below creates a audio generation task, then automatically polls the server every 10 seconds until it finally receives the audio URL.

chevron-rightResponsehashtag

Listen to the track we generated:

"lo-fi pop hip-hop ambient music, slow intro: 10 s, then faster and with loud bass: 10 s"

Last updated

Was this helpful?