Skip to content

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.

ParameterTypeRequiredDefaultDescription
promptstringMusic style, mood, and scenario description (10–300 chars), e.g. "Pop, melancholic, perfect for a rainy night"
lyricsstringSong 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.
modelstringmusic-2.6Model: music-2.6 or music-2.6-free
is_instrumentalbooleanfalseGenerate instrumental music with no vocals
lyrics_optimizerbooleanfalseAuto-generate lyrics from the prompt (only supported by music-2.6)
formatstringmp3Output format: mp3, wav, pcm
sample_rateinteger32000Sample rate (Hz): 16000, 24000, 32000, 44100
bitrateinteger128000Bitrate: 32000, 64000, 128000, 256000

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…”

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.

  • lyrics is required unless is_instrumental: true or lyrics_optimizer: true.
  • lyrics_optimizer is only supported by the music-2.6 model, not music-2.6-free.
  • Lyrics structure tags ([Verse], [Chorus], etc.) help the model apply the correct arrangement.