Music v1

This guide shows how to generate music using the Music v1 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": "music-v1",
    "public": false,
    "parameters": {
      "prompt": "An upbeat synthwave track with a driving bassline, punchy drums and dreamy pads",
      "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 music-v1.
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?