Skip to content
ElevenLabs logo

ElevenLabs Music v2

Music Generation • ElevenLabs

View as MarkdownAgent setup

Model ID

Use with the Workers AI binding, the AI Gateway REST API, or the Unified API.

Calling the provider directly? Use the provider's model name instead, including with provider-native endpoints or the provider's own SDK. For example, Anthropic's name for anthropic/claude-opus-4.8 is claude-opus-4-8.

  • Third-party

ElevenLabs Music v2 composes songs and instrumental tracks from a prompt or detailed composition plan.

Model Info
Terms and Licenselink ↗
More informationlink ↗
Pricing
  • output audio seconds$0.0025

Usage

const response = await env.AI.run(
  'elevenlabs/music-v2',
  {
    prompt: 'A warm cinematic ambient track with soft piano, subtle strings, and a hopeful mood',
    music_length_ms: 30000,
    force_instrumental: true,
    output_format: 'mp3_48000_192',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "elevenlabs/music-v2",
  "input": {
    "prompt": "A warm cinematic ambient track with soft piano, subtle strings, and a hopeful mood",
    "music_length_ms": 30000,
    "force_instrumental": true,
    "output_format": "mp3_48000_192"
  }
}'
{
  "state": "Completed",
  "result": {
    "audio": "https://examples.aig.cloudflare.com/elevenlabs/music-v2/cinematic-instrumental.mp3"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

Parameters

prompt
stringminLength: 1
music_length_ms
integerminimum: 3000maximum: 600000
output_format
stringenum: auto, mp3_48000_128, mp3_48000_192, mp3_48000_240, mp3_48000_320, mp3_22050_32, mp3_24000_48, mp3_44100_32, mp3_44100_64, mp3_44100_96, mp3_44100_128, mp3_44100_192, opus_48000_32, opus_48000_64, opus_48000_96, opus_48000_128, opus_48000_192
seed
integerminimum: 0maximum: 4294967295
force_instrumental
boolean
store_for_inpainting
boolean
sign_with_c2pa
boolean
audio
stringURL to the generated music file.

API Schemas (Raw)

Input
Output

Was this helpful?