Skip to main content

Music 2.6: Cover Reborn. Bass Redefined.

Cover Reborn. Bass Redefined.

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.6 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.6",
    "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:

Cover Generation

Music Cover generates a new rendition of an existing song with a different style. There are two modes:
  • One-Step Cover: Pass the reference audio directly — lyrics are auto-extracted via ASR.
  • Two-Step Cover: Preprocess the audio first to extract and modify lyrics, then generate the cover.

One-Step Cover (Quick Mode)

Pass the reference audio URL and a style prompt to the Music Generation API. Lyrics are automatically extracted from the audio.
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-cover",
    "audio_url": "https://example.com/original-song.mp3",
    "prompt": "Jazz, smooth, late night lounge, saxophone",
    "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))

Two-Step Cover (Advanced Mode — with Lyrics Modification)

For more control, use the two-step workflow: first preprocess the audio to extract features and lyrics, then modify the lyrics and generate the cover.
1

Preprocess the reference audio

Call the Music Cover Preprocess API to extract audio features and structured lyrics. This step is free (no charge).The response includes:
  • cover_feature_id: A unique identifier for the audio features (valid for 24 hours)
  • formatted_lyrics: Structured lyrics with section tags ([Verse], [Chorus], etc.) that you can modify
  • structure_result: JSON string with segment types and timestamps
  • audio_duration: Duration of the reference audio in seconds
import requests
import json
import os

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

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

payload = {
    "model": "music-cover",
    "audio_url": "https://example.com/original-song.mp3"
}

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

# Save the cover_feature_id and review the lyrics
cover_feature_id = result["cover_feature_id"]
formatted_lyrics = result["formatted_lyrics"]

print(f"Feature ID: {cover_feature_id}")
print(f"Extracted Lyrics:\n{formatted_lyrics}")
2

Modify lyrics and generate the cover

Review and edit the formatted_lyrics from the previous step, then pass the cover_feature_id and modified lyrics to the Music Generation API.
When using cover_feature_id, do not pass audio_url or audio_base64 — they are mutually exclusive. The lyrics parameter is required (10–1000 characters).
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}"
}

# Use the cover_feature_id from the previous step
# Modify the extracted lyrics as needed
modified_lyrics = "[Verse 1]\nYour modified first verse here\nWith new words that tell your story\n\n[Chorus]\nA brand new chorus for the cover\nSinging with a different feel"

payload = {
    "model": "music-cover",
    "cover_feature_id": cover_feature_id,
    "lyrics": modified_lyrics,
    "prompt": "Jazz, smooth, late night lounge, saxophone",
    "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))

Music Generation API

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

Music Cover Preprocess API

Preprocess reference audio to extract features and lyrics for two-step cover generation.

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.