ApiframeApiframe Docs
Music Generation

ElevenLabs Music

Generate studio-grade music with vocals or instrumental tracks using ElevenLabs Music.

Use in Apiframe Studio

POST /v2/music/generatemodel: "elevenlabs-music"

Generate studio-grade full songs from text prompts — with or without vocals — in any style and up to 5 minutes long using ElevenLabs Music.

See Music Generation overview for common request fields, response format, and error codes.

Model-specific parameters

ParameterTypeDefaultDescription
elevenlabsParams.music_length_msintegerDuration in milliseconds (5,000–300,000). If not provided, the model chooses a length based on the prompt
elevenlabsParams.force_instrumentalbooleanfalseIf true, removes vocal elements from the generated music
elevenlabsParams.output_formatstring"mp3_high_quality"Audio format: "mp3_standard" (128kbps), "mp3_high_quality" (192kbps), "wav_16khz", "wav_22khz", "wav_24khz", "wav_cd_quality" (44.1kHz)

Credit pricing

Credits are charged based on the requested duration:

DurationCredits
Up to 30 seconds10
Up to 2 minutes20
Up to 5 minutes30

Code examples

Text-to-music

curl -X POST https://api.apiframe.ai/v2/music/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A dreamy indie folk song about lost love, acoustic guitar and soft male vocals",
    "model": "elevenlabs-music",
    "elevenlabsParams": {
      "music_length_ms": 30000
    }
  }'
import requests

response = requests.post(
    "https://api.apiframe.ai/v2/music/generate",
    headers={
        "X-API-Key": "afk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "A dreamy indie folk song about lost love, acoustic guitar and soft male vocals",
        "model": "elevenlabs-music",
        "elevenlabsParams": {
            "music_length_ms": 30000,
        },
    },
)
print(response.json())
const response = await fetch("https://api.apiframe.ai/v2/music/generate", {
  method: "POST",
  headers: {
    "X-API-Key": "afk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    prompt: "A dreamy indie folk song about lost love, acoustic guitar and soft male vocals",
    model: "elevenlabs-music",
    elevenlabsParams: {
      music_length_ms: 30000,
    },
  }),
});
console.log(await response.json());
body := `{
  "prompt": "A dreamy indie folk song about lost love, acoustic guitar and soft male vocals",
  "model": "elevenlabs-music",
  "elevenlabsParams": {"music_length_ms": 30000}
}`
req, _ := http.NewRequest("POST", "https://api.apiframe.ai/v2/music/generate",
    strings.NewReader(body))
req.Header.Set("X-API-Key", "afk_your_api_key_here")
req.Header.Set("Content-Type", "application/json")

resp, err := http.DefaultClient.Do(req)

Instrumental mode

curl -X POST https://api.apiframe.ai/v2/music/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Relaxing ambient pads and piano for meditation",
    "model": "elevenlabs-music",
    "elevenlabsParams": {
      "music_length_ms": 120000,
      "force_instrumental": true
    }
  }'

Full-length song (CD quality)

curl -X POST https://api.apiframe.ai/v2/music/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "High-energy rock anthem with electric guitars, powerful chorus, and driving drums",
    "model": "elevenlabs-music",
    "elevenlabsParams": {
      "music_length_ms": 180000,
      "output_format": "wav_cd_quality"
    }
  }'

Try it

POST/v2/music/generateTry it

On this page