compose_music
Convert a text prompt to music and save the audio file to a directory. Customize with composition plans, model choice, and instrumental-only generation.
Instructions
Convert a prompt to music and save the output audio file to a given directory. Directory is optional, if not provided, the output file will be saved to $HOME/Desktop. Saves output file to directory (default: $HOME/Desktop).
Two models are supported:
- music_v2 (default): latest model. Composition plans use a `chunks` array where each chunk is either a `GenerationChunk` (text, duration_ms, positive_styles, negative_styles, context_adherence, optional conditioning_ref + condition_strength) or an `AudioRefChunk` ({song_id, range: {start_ms, end_ms}}) for inpainting. Inpainting also requires the source song to have been stored — call this tool with store_for_inpainting=True or use upload_music_for_inpainting first to get a song_id.
- music_v1: legacy model. Composition plans use positive_global_styles, negative_global_styles, sections.
Args:
prompt: Prompt to convert to music. Must provide either prompt or composition_plan.
output_directory: Directory to save the output audio file
composition_plan: Composition plan dict. Shape depends on model_id (see above). Must provide either prompt or composition_plan.
music_length_ms: Length of the generated music in milliseconds (3000-600000). Cannot be used if composition_plan is provided.
model_id: Which music model to use. One of "music_v1" or "music_v2". Defaults to "music_v2".
force_instrumental: If True, the model will avoid generating lyrics/vocals.
store_for_inpainting: If True, the generated song is stored server-side and the returned song_id can be used in later inpainting calls (as an AudioRefChunk.song_id, or conditioning_ref).
seed: Optional integer seed for reproducible generation (music_v2 only).
⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | No | ||
| output_directory | No | ||
| composition_plan | No | ||
| music_length_ms | No | ||
| model_id | No | music_v2 | |
| force_instrumental | No | ||
| store_for_inpainting | No | ||
| seed | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |