Music Generation

Music generation is a synchronous endpoint. The upstream provider (MiniMax) streams on the server side; the proxy fully consumes the stream on the server and returns the aggregated result in a single response, so clients don’t need to handle streaming.

POST https://api.smartapi.cc/api/openapi/v1/generate/music/generations

Authentication#

Authorization: Bearer sk-your-key-here
Content-Type: application/json

Request Body#

FieldTypeRequiredDescription
modelstringYesModel identifier, e.g. minimax-music-2.0.
lyricsstringYesLyrics. Must not be empty. Use \n for line breaks; [verse]/[chorus] tags are supported.
promptstringNoStyle / mood description (genre, instruments, tempo, etc.).
output_formatstringNoOutput form, e.g. url (playable link) or hex (hex-encoded audio).
aigc_watermarkbooleanNoWhether to add an AIGC watermark.
audio_settingobjectNoAudio parameters, see below.

audio_setting optional fields:

FieldTypeDescription
sample_ratenumberSample rate, e.g. 16000, 24000, 32000, 44100
bitratenumberBitrate, e.g. 32000, 64000, 128000, 256000
formatstringAudio format, e.g. mp3, wav, pcm

Which fields each model accepts and their allowed values can be found in the Models page; you can also select a model in the Playground and open “Custom request body / Debug” to inspect the actual request body.

Example#

curl https://api.smartapi.cc/api/openapi/v1/generate/music/generations \
  -H "Authorization: Bearer $SMARTAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-music-2.0",
    "prompt": "Upbeat electronic pop with bright synths and punchy drums",
    "lyrics": "[verse]\nWe run through the night\nChasing the wind\n[chorus]\nLight up the whole sky\nNever look back",
    "output_format": "url",
    "audio_setting": { "sample_rate": 44100, "bitrate": 256000, "format": "mp3" }
  }'

Response#

The upstream raw JSON is passed through as-is. When output_format=url, it usually contains a playable link:

{
  "data": { "audio_url": "https://.../result.mp3", "status": 2 },
  "base_resp": { "status_code": 0, "status_msg": "success" }
}

When output_format=hex, the audio is returned as a hex string (e.g. data.audio); decode it into an audio file yourself. If upstream validation fails or errors out, the endpoint returns the upstream’s raw error message for easier troubleshooting.

lyrics is required; a missing value returns a parameter error immediately. Music generation can take a while, so set a sufficiently long request timeout.

Billing#

Music models are billed in credits (not tokens). minimax-music-2.0 is billed per call: a fixed number of credits per song (up to 5 minutes), independent of lyrics length or audio_setting, and only charged on success. See per-model pricing on the Models page and billing details in Billing.