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/generationsAuthentication#
Authorization: Bearer sk-your-key-here
Content-Type: application/jsonRequest Body#
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model identifier, e.g. minimax-music-2.0. |
lyrics | string | Yes | Lyrics. Must not be empty. Use \n for line breaks; [verse]/[chorus] tags are supported. |
prompt | string | No | Style / mood description (genre, instruments, tempo, etc.). |
output_format | string | No | Output form, e.g. url (playable link) or hex (hex-encoded audio). |
aigc_watermark | boolean | No | Whether to add an AIGC watermark. |
audio_setting | object | No | Audio parameters, see below. |
audio_setting optional fields:
| Field | Type | Description |
|---|---|---|
sample_rate | number | Sample rate, e.g. 16000, 24000, 32000, 44100 |
bitrate | number | Bitrate, e.g. 32000, 64000, 128000, 256000 |
format | string | Audio 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.