POST
/v1/music/stream
ElevenLabs APIStream Composed Music
- Base URL
- https://api.elevenlabs.io
- Auth
- xi-api-key: <ELEVENLABS_API_KEY>
- Last verified
- 2026-09-03 · upstream hash matched
Actions
Agents: curl -H "Accept: text/markdown" this URL
→ 214 tokens · Vary: Accept
→ 214 tokens · Vary: Accept
Critical gotchas
Authentication uses the non-standard xi-api-key header, not Authorization: Bearer. Sending a Bearer token returns HTTP 401.
Text-to-speech responses are raw binary audio, not JSON. Write the body to a file (--output speech.mp3) rather than parsing it.
cURL
curl -X POST 'https://api.elevenlabs.io/v1/music/stream?output_format=auto' \ -H "xi-api-key: $ELEVENLABS_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "string", "generation_mode": "track", "music_prompt": { "negative_global_styles": [ "metal", "hip-hop", "country" ], "positive_global_styles": [ "pop", "rock", "jazz" ], "sections": [ { "duration_ms": 10000, "lines": [ "Verse 1 lyrics" ], "negative_local_styles": [ "metal", "hip-hop", "country" ], "positive_local_styles": [ "pop", "rock", "jazz" ], "section_name": "Verse 1" } ] }, "lyrics_text": "string", "composition_plan": { "negative_global_styles": [ "metal", "hip-hop", "country" ], "positive_global_styles": [ "pop", "rock", "jazz" ], "sections": [ { "duration_ms": 10000, "lines": [ "Verse 1 lyrics" ], "negative_local_styles": [ "metal", "hip-hop", "country" ], "positive_local_styles": [ "pop", "rock", "jazz" ], "section_name": "Verse 1" } ] }, "music_length_ms": 0, "model_id": "music_v1", "seed": 0, "force_instrumental": false, "finetune_id": "string", "finetune_strength": 1, "use_phonetic_names": false, "store_for_inpainting": false}'Get a free ElevenLabs API key → sponsored
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| output_format | query | string | No | Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. |
| prompt | body | string | No | A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. |
| generation_mode | body | string | No | Optional generation mode hint for prompt-based music generation. Can only be used with `prompt`. |
| music_prompt | body | object | No | A music prompt. Deprecated. Use `composition_plan` instead. |
| lyrics_text | body | string | No | The lyrics text to use for the generation. |
| composition_plan | body | object | No | A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. |
| music_length_ms | body | integer | No | The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. |
| model_id | body | string | No | Request body field model_id. |
| seed | body | integer | No | Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. |
| force_instrumental | body | boolean | No | If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. |
| finetune_id | body | string | No | The ID of the finetune to use for the generation |
| finetune_strength | body | number | No | How strongly the finetune influences the generation. Defaults to 1.0 (full strength). Lower values soften the influence of the finetune, leaving more room for prompt-level steering. Only meaningful when `finetune_id` is also provided. |
| use_phonetic_names | body | boolean | No | If true, proper names in the prompt will be phonetically spelled in the lyrics for better pronunciation by the music model. The original names will be restored in word timestamps. |
| store_for_inpainting | body | boolean | No | Whether to store the generated song for inpainting. |
Response 200 OK
"binary"