Music v2.5

This guide shows how to generate music using the Music v2.5 model via the Leonardo.AI REST API.

Sample Request

curl --request POST \
     --url https://cloud.leonardo.ai/api/rest/v2/generations \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <YOUR_API_KEY>' \
     --header 'content-type: application/json' \
     --data '
{
    "model": "elevenlabs/music-v2.5",
    "public": false,
    "parameters": {
      "prompt": "A warm lo-fi hip hop track with dusty vinyl crackle, mellow Rhodes chords, soft brushed drums and a laid-back bassline",
      "duration_minutes": 2,
      "force_instrumental": true,
      "quantity": 1
    }
}
'

API Request Endpoint, Headers, Parameters

Endpoint

https://cloud.leonardo.ai/api/rest/v2/generations

Headers

--header "accept: application/json" \
--header "authorization: Bearer <YOUR_API_KEY>" \
--header "content-type: application/json"

Body Parameters

ParameterTypeDefinition
duration_minutesnumberDuration of the generated track in whole minutes. Set to 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10. Defaults to 1.
force_instrumentalbooleanWhen true, guarantees an instrumental-only output (no vocals). Defaults to false.
modelstringSpecifies the model used for generation. Set to elevenlabs/music-v2.5.
promptstringText description of the music to generate. Maximum of 9999 characters.
publicbooleanControls whether the generated audio is public (true) or private (false).
quantitynumberThe number of outputs to generate. Set to 1, 2, 3, or 4. Defaults to 1.

Did this page help you?