Skip to main content
POST
/
v1
/
music_generation
Music Generation
curl --request POST \
  --url https://api.minimax.io/v1/music_generation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: <content-type>' \
  --data '{
  "model": "music-1.5",
  "prompt": "Indie folk, melancholic, introspective, longing, solitary walk, coffee shop",
  "lyrics": "[verse]\nStreetlights flicker, the night breeze sighs\nShadows stretch as I walk alone\nAn old coat wraps my silent sorrow\nWandering, longing, where should I go\n[chorus]\nPushing the wooden door, the aroma spreads\nIn a familiar corner, a stranger gazes",
  "audio_setting": {
    "sample_rate": 44100,
    "bitrate": 256000,
    "format": "mp3"
  }
}'
{
  "data": {
    "audio": "hex-encoded audio data",
    "status": 2
  },
  "trace_id": "04ede0ab069fb1ba8be5156a24b1e081",
  "extra_info": {
    "music_duration": 25364,
    "music_sample_rate": 44100,
    "music_channel": 2,
    "bitrate": 256000,
    "music_size": 813651
  },
  "analysis_info": null,
  "base_resp": {
    "status_code": 0,
    "status_msg": "success"
  }
}

Authorizations

Authorization
string
header
required

HTTP: Bearer Auth

Headers

Content-Type
enum<string>
default:application/json
required

The media type of the request body. Must be set to application/json to ensure the data is sent in JSON format.

Available options:
application/json

Body

application/json
model
enum<string>
required

The model name. Currently only music-1.5 is supported.

Available options:
music-1.5
prompt
string
required

A description of the music, specifying style, mood, and scenario.

For example: "Pop, melancholic, perfect for a rainy night".

Length: 10–300 characters.

Required string length: 10 - 300
lyrics
string
required

Lyrics of the song. Use \n to separate lines. You may add structure tags like [Intro], [Verse], [Chorus], [Bridge], [Outro] to enhance the arrangement.

Length: 10–3000 characters.

Required string length: 10 - 3000
stream
boolean
default:false

Whether to use streaming output.

output_format
enum<string>
default:hex

The output format of the audio. Options: url or hex.

When stream is true, only hex is supported.

⚠️ Note: url links expire after 24 hours, so download promptly.

Available options:
url,
hex
audio_setting
object

Audio output configuration

Response

200 - application/json
data
object
base_resp
object

Status code and details