Skip to main content

Music 2.5+: Instrumental Unlocked

Music 2.5+ unlocks instrumental music and masters every genre — with faster generation, complete song structures, expressive melodies, and hi-fi audio quality.

Music Generation Example

Let’s walk through how to create a soulful blues track from scratch in two simple steps: first, use the Lyrics Generation API to write lyrics based on a theme; then, feed those lyrics into the Music Generation API to compose and produce a complete song.
1

Call the Lyrics Generation API to generate lyrics from a theme (optional)

Simply tell the model what you’re looking for — for example, “a soulful blues song about a rainy night” — and the Lyrics Generation API will automatically write complete lyrics with proper song structure (Verse, Chorus, Bridge, etc.). If you already have your own lyrics, feel free to skip this step. Additionally, even without lyrics you can go straight to the second step: call the music generation API to compose and generate a full song.
import requests
import os

url = "https://api.minimax.io/v1/lyrics_generation"
api_key = os.environ.get("MINIMAX_API_KEY")

payload = {
    "mode": "write_full_song",
    "prompt": "A soulful blues song about a rainy night"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {api_key}"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
2

Call the Music Generation API to compose and produce the full song

Once you have your lyrics, set the music style via the prompt parameter (e.g., “Blues, Soulful, Rainy Night, Electric Guitar”), pass the lyrics into the lyrics parameter, and the Music Generation API will arrange, perform, and output a complete song. If you don’t have lyrics, you can set the lyrics_optimizer parameter to true to generate a song directly. In addition, Music 2.5+ supports instrumental-only generation; see the is_instrumental parameter.
import requests
import json
import os

url = "https://api.minimax.io/v1/music_generation"
api_key = os.environ.get("MINIMAX_API_KEY")

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {api_key}"
}

payload = {
    "model": "music-2.5+",
    "prompt": "Soulful Blues, Rainy Night, Melancholy, Male Vocals, Slow Tempo",
    "lyrics": "[Intro]\n(Ooh, yeah)\n(Listen to that rain)\nOh, Lord...\nIt's fallin' down so hard tonight...\n\n[Verse 1]\nThe sky is cryin', Lord, I can hear it on the roof\n(Hear it on the roof)\nEach drop a memory, ain't that the mournful truth?\nThis old guitar is my only friend in this lonely room\nSingin' the midnight rain blues, lost in the gloom\nStreetlights paintin' shadows, dancin' on the wall\nWishin' I could wash away this feelin' with it all\n(Wash it all away)\n\n[Chorus]\nMidnight rain, fallin' down on me\n(Fallin' on me)\nLike tears I can't cry, for all the world to see\nThis ain't just water, baby, it's a soulful sound\nWashin' over my heart, nowhere to be found\n(Nowhere to be found)\nJust the rhythm of the rain, and the blues in my soul\nTryna make me feel whole, but it's takin' its toll\n\n[Verse 2]\nRemember when we danced in the summer shower?\n(Summer shower)\nLaughin' like fools, in that golden hour\nNow the cold, hard rain, it chills me to the bone\nReminds me that I'm standin' here, all alone\nEvery rumble of thunder, shakes me deep inside\nGot nowhere to run, baby, nowhere left to hide\n(Nowhere to hide)\n\n[Pre-Chorus]\nThis lonely melody, it keeps playin' on\n(On and on)\nEver since you been gone\n(You been gone)\nOh, this rainy night, it just won't let me be\n\n[Chorus]\nMidnight rain, fallin' down on me\n(Fallin' on me)\nLike tears I can't cry, for all the world to see\nThis ain't just water, baby, it's a soulful sound\nWashin' over my heart, nowhere to be found\n(Nowhere to be found)\nJust the rhythm of the rain, and the blues in my soul\nTryna make me feel whole, but it's takin' its toll\n\n[Bridge]\n(Oh, the rain...)\nIs it washin' away the good times?\nOr just remindin' me of all the past crimes?\nThis emptiness inside, it cuts me like a knife\nJust me and this rain, livin' this lonely life\n(Lonely life)\nI need a little sunshine, Lord, to dry these tears\nChase away these lonely, rainy night fears\n\n[Solo]\n(Guitar solo - slow, mournful, bluesy)\n(Yeah... play it, boy)\n(Feel that rain)\n(Mmm-hmm)\n\n[Chorus]\nMidnight rain, fallin' down on me\n(Fallin' on me)\nLike tears I can't cry, for all the world to see\nThis ain't just water, baby, it's a soulful sound\nWashin' over my heart, nowhere to be found\n(Nowhere to be found)\nJust the rhythm of the rain, and the blues in my soul\nTryna make me feel whole, but it's takin' its toll\n\n[Outro]\n(Midnight rain...)\nOh, the rain...\n(Fallin' down)\nJust keep fallin'...\n(Wash me clean)\nLord, wash me clean...\n(Yeah...)\n(Blues...\nFade out...)",
    "audio_setting": {
        "sample_rate": 44100,
        "bitrate": 256000,
        "format": "mp3"
    },
    "output_format": "url"
}

response = requests.post(url, headers=headers, json=payload)
result = response.json()

print(json.dumps(result, ensure_ascii=False, indent=2))
3

Listen to the result

After completing the steps above, you’ll have a complete song:

Music Generation API

Use this API to generate a song from lyrics and a prompt.

Lyrics Generation API

Use this API to generate or edit lyrics from a song description.

Pricing

Detailed information on model pricing and API packages.

Rate Limits

Rate limits are restrictions that our API imposes on the number of times a user or client can access our services within a specified period of time.