Compose music up to 60 seconds long using a text prompt
September 25, 2024 (August 21, 2025)
This version of MiniMax audio has been decommissioned. Consider switching to Mureka API
Table of contents
Equivalent of hailuoai.com/music.
Generate music in under 60 seconds. Add a new line to separate sentences. Add two empty lines for a pause.
Use hailuoai.com/music account to generate music, see Setup MiniMax for details.
https://api.useapi.net/v1/minimax/music/create?…
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
API tokenis required, see Setup useapi.net for details.
Query Parameters
-
accountis optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required. -
promptis required. Provide your lyrics.
Maximum length 600 characters. -
styleIdis required. Specify desired music style. -
titleis optional.
Responses
-
Use the returned
musicIdto retrieve full music results, such ascoverURL,style,lyricsand moderationstatusby using GET /music/musicId.Sometimes, MiniMax will apply post-moderation to an already generated song. In such cases, attempting to retrieve and play
audioURLwill fail, and thestatusof the generation will be set to4. Those songs will not appear under GET /music and can only be retrieved by the GET /music/musicIdendpoint.{ "musicId": "user:1234-minimax:987654321-music:998877665544332211", "audioURL": "https://cdn.hailuoai.com/prod/2024-10-05-08/music/123456789-music_998877665544332211.mp3", "duration": 55, } -
{ "error": "<Error message>", "code": 400 } -
{ "error": "Unauthorized", "code": 401 } -
Moderated prompt.
{ "error": "Moderated prompt" } -
Only one concurrent music generation is supported per account.
{ "error": "The previous request has not been completed yet. Please try again later." }
Model
{ // TypeScript, all fields are optional
musicId: string
audioURL: string
duration: number
error: string
code: number
}
Examples
-
curl "https://api.useapi.net/v1/minimax/music/create?styleId=…&prompt=…" \ -H "Accept: application/json" \ -H "Authorization: Bearer …" -
const styleId = "abcdef"; const prompt = "lyrics"; const apiUrl = `https://api.useapi.net/v1/minimax/music/create?styleId=${styleId}&prompt=${prompt}`; const token = "API token"; const response = await fetch(apiUrl, { headers: { "Authorization": `Bearer ${token}`, }, }); const result = await response.json(); console.log("response", {response, result}); -
import requests styleId = "abcdef"; prompt = "lyrics"; apiUrl = f"https://api.useapi.net/v1/minimax/music/create?styleId={styleId}&prompt={prompt}"; token = "API token" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } response = requests.get(apiUrl, headers=headers) print(response, response.json())