Agent skill

music

Generate music using ElevenLabs Music API. Use when creating instrumental tracks, songs with lyrics, background music, jingles, or any AI-generated music composition. Supports prompt-based generation, composition plans for granular control, and detailed output with metadata.

Stars 153
Forks 14

Install this agent skill to your Project

npx add-skill https://github.com/elevenlabs/skills/tree/main/music

Metadata

Additional technical details for this skill

openclaw
{
    "requires": {
        "env": [
            "ELEVENLABS_API_KEY"
        ]
    },
    "primaryEnv": "ELEVENLABS_API_KEY"
}

SKILL.md

ElevenLabs Music Generation

Generate music from text prompts - supports instrumental tracks, songs with lyrics, and fine-grained control via composition plans.

Setup: See Installation Guide. For JavaScript, use @elevenlabs/* packages only.

Quick Start

Python

python
from elevenlabs import ElevenLabs

client = ElevenLabs()

audio = client.music.compose(
    prompt="A chill lo-fi hip hop beat with jazzy piano chords",
    music_length_ms=30000
)

with open("output.mp3", "wb") as f:
    for chunk in audio:
        f.write(chunk)

JavaScript

javascript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createWriteStream } from "fs";

const client = new ElevenLabsClient();
const audio = await client.music.compose({
  prompt: "A chill lo-fi hip hop beat with jazzy piano chords",
  musicLengthMs: 30000,
});
audio.pipe(createWriteStream("output.mp3"));

cURL

bash
curl -X POST "https://api.elevenlabs.io/v1/music" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
  -d '{"prompt": "A chill lo-fi beat", "music_length_ms": 30000}' --output output.mp3

Methods

Method Description
music.compose Generate audio from a prompt or composition plan
music.composition_plan.create Generate a structured plan for fine-grained control
music.compose_detailed Generate audio + composition plan + metadata
music.upload Upload an audio file for later inpainting workflows and optionally extract its composition plan

See API Reference for full parameter details.

music.upload is available to enterprise clients with access to the inpainting feature.

Composition Plans

For granular control, generate a composition plan first, modify it, then compose:

python
plan = client.music.composition_plan.create(
    prompt="An epic orchestral piece building to a climax",
    music_length_ms=60000
)

# Inspect/modify styles and sections
print(plan.positiveGlobalStyles)  # e.g. ["orchestral", "epic", "cinematic"]

audio = client.music.compose(
    composition_plan=plan,
    music_length_ms=60000
)

Content Restrictions

  • Cannot reference specific artists, bands, or copyrighted lyrics
  • bad_prompt errors include a prompt_suggestion with alternative phrasing
  • bad_composition_plan errors include a composition_plan_suggestion

Error Handling

python
try:
    audio = client.music.compose(prompt="...", music_length_ms=30000)
except Exception as e:
    print(f"API error: {e}")

Common errors: 401 (invalid key), 422 (invalid params), 429 (rate limit).

References

  • Installation Guide
  • API Reference

Expand your agent's capabilities with these related and highly-rated skills.

elevenlabs/skills

elevenlabs-transcribe

Transcribe audio to text using ElevenLabs Scribe. Supports batch transcription, realtime streaming from URLs, microphone input, and local files.

153 14
Explore
elevenlabs/skills

agents

Build voice AI agents with ElevenLabs. Use when creating voice assistants, customer service bots, interactive voice characters, or any real-time voice conversation experience.

153 14
Explore
elevenlabs/skills

sound-effects

Generate sound effects from text descriptions using ElevenLabs. Use when creating sound effects, generating audio textures, producing ambient sounds, cinematic impacts, UI sounds, or any audio that isn't speech. Supports looping, duration control, and prompt influence tuning.

153 14
Explore
elevenlabs/skills

setup-api-key

Guides users through setting up an ElevenLabs API key for ElevenLabs MCP tools. Use when the user needs to configure an ElevenLabs API key, when ElevenLabs tools fail due to missing API key, or when the user mentions needing access to ElevenLabs. First checks whether ELEVENLABS_API_KEY is already configured and valid, and only runs full setup when needed.

153 14
Explore
elevenlabs/skills

text-to-speech

Convert text to speech using ElevenLabs voice AI. Use when generating audio from text, creating voiceovers, building voice apps, or synthesizing speech in 70+ languages.

153 14
Explore
elevenlabs/skills

speech-to-text

Transcribe audio to text using ElevenLabs Scribe v2. Use when converting audio/video to text, generating subtitles, transcribing meetings, or processing spoken content.

153 14
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results