generate_music
Generate original music from a style/mood description and optional lyrics using the MiniMax music-2.6 model. The generated audio is returned inline and saved to disk.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | ✓ | — | Music style, mood, and scenario description (10–300 chars), e.g. "Pop, melancholic, perfect for a rainy night" |
lyrics | string | — | — | Song lyrics (max 3,500 chars). Use structure tags: [Intro], [Verse], [Chorus], [Bridge], [Outro], etc. Lines separated by \n. Required unless is_instrumental: true or lyrics_optimizer: true. |
model | string | — | music-2.6 | Model: music-2.6 or music-2.6-free |
is_instrumental | boolean | — | false | Generate instrumental music with no vocals |
lyrics_optimizer | boolean | — | false | Auto-generate lyrics from the prompt (only supported by music-2.6) |
format | string | — | mp3 | Output format: mp3, wav, pcm |
sample_rate | integer | — | 32000 | Sample rate (Hz): 16000, 24000, 32000, 44100 |
bitrate | integer | — | 128000 | Bitrate: 32000, 64000, 128000, 256000 |
Usage Examples
Section titled “Usage Examples”Instrumental background music:
“Create background music for a cooking video — warm, inviting, acoustic guitar.”
Which maps to:
generate_music( prompt="Warm acoustic guitar, inviting kitchen atmosphere, gentle rhythm", is_instrumental=true)Full song with AI lyrics:
“Generate an upbeat pop song about summer adventures, let MiniMax write the lyrics.”
Which maps to:
generate_music( prompt="Upbeat pop, summer vibes, energetic, beach party", lyrics_optimizer=true)Custom lyrics:
“Generate a melancholic jazz song with these lyrics: [Verse] Walking through the empty streets…”
Response
Section titled “Response”Returns an audio content part (base64-encoded in the chosen format), plus a text part with the saved file path, duration (ms), format, and sample rate.
lyricsis required unlessis_instrumental: trueorlyrics_optimizer: true.lyrics_optimizeris only supported by themusic-2.6model, notmusic-2.6-free.- Lyrics structure tags (
[Verse],[Chorus], etc.) help the model apply the correct arrangement.