Docs / Music Series / StepAudio
Docs / Music Series / StepAudio
Request parameters, reference audio, and asynchronous polling for StepAudio 3 Music.
This document explains how to call StepFun's stepaudio-3-music music model through the new-api gateway. Callers only need to use the gateway's unified music API and do not need to handle StepFun's task IDs or response formats directly.
model_params Parameters#model_params accepts only the fields listed below and cannot override common fields such as model, prompt, lyrics, instrumental, or callback_url. Numeric 0 and boolean false values are preserved and sent to the upstream.
| Field | Type | Constraint | Description |
|---|---|---|---|
task | string | text_to_music, music_cover, vocal_to_music | Task type; inferred from the reference audio when omitted |
song_audio | string | Audio Base64 or Data URL, at most 64 MB after decoding by default | Reference audio for song covers |
vocal_audio | string | Audio Base64 or Data URL, at most 64 MB after decoding by default | Reference audio for vocal-to-music |
response_format | string | wav, flac, opus, mp3, pcm | Output format; defaults to wav |
sample_rate | integer | Greater than or equal to 0 | Output sample rate |
bit_rate | integer | Greater than or equal to 0 | Output bit rate |
lyrics_rewrite | boolean | — | Whether rewriting the lyrics is allowed |
disable_caption_rewrite | boolean | — | Whether to disable caption rewriting |
max_tokens | integer | Greater than or equal to 1 | Upstream generation limit |
temperature | number | Finite and greater than 0 | Sampling temperature |
top_k | integer | Greater than or equal to 0 | Top-K sampling parameter |
top_p | number | Between 0 and 1 | Top-P sampling parameter |
repetition_penalty | number | Finite and greater than 0 | Repetition penalty |
The following combinations are rejected by the gateway:
song_audio and vocal_audio provided at the same time.task=music_cover without song_audio, or task=vocal_to_music without vocal_audio.text_to_music used together with a reference audio.instrumental=true provided together with lyrics, or instrumental set in a cover task.disable_caption_rewrite=true set together with lyrics_rewrite=true.disable_caption_rewrite=true that provides no lyrics.callback_url can be placed at the top level of the request; the gateway validates and stores it and does not forward it as a StepFun request field.
Endpoint: POST ${BASE}/v1/music/generations
On successful submission, the gateway immediately returns its own task ID; this is an asynchronous endpoint, so do not treat it as a raw StepFun task ID.
curl -X POST "${BASE}/v1/music/generations" \
-H "Authorization: Bearer ${KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "stepaudio-3-music",
"prompt": "A warm acoustic folk song about a summer road trip",
"lyrics": "[Verse]\nThe road is open, the morning is bright",
"instrumental": false,
"model_params": {
"response_format": "mp3",
"sample_rate": 44100,
"bit_rate": 192
}
}'Instrumental-only tracks may omit lyrics, but a StepAudio request should provide a non-empty prompt:
{
"model": "stepaudio-3-music",
"prompt": "Ambient piano and strings for a quiet night",
"instrumental": true
}When instrumental: true is set, lyrics must not be passed at the same time. You can provide descriptive text through style or tags.
Put the song audio in model_params.song_audio. The value can be plain Base64 or a data:audio/...;base64,... Data URL:
{
"model": "stepaudio-3-music",
"prompt": "Keep the chord progression and make the arrangement more cinematic",
"lyrics": "[Verse]\nA new lyric line",
"model_params": {
"task": "music_cover",
"song_audio": "data:audio/wav;base64,BASE64_AUDIO"
}
}music_cover requires song_audio and non-empty lyrics, and instrumental must not be set. When task is omitted, the gateway automatically selects music_cover based on song_audio.
Put the vocal reference audio in model_params.vocal_audio:
{
"model": "stepaudio-3-music",
"prompt": "Build a full pop arrangement around this vocal",
"lyrics": "[Chorus]\nWe will meet beneath the summer sky",
"model_params": {
"task": "vocal_to_music",
"vocal_audio": "BASE64_AUDIO"
}
}vocal_to_music requires vocal_audio and non-empty lyrics, and instrumental must not be set. song_audio and vocal_audio cannot appear at the same time. When task is omitted, the gateway automatically selects vocal_to_music based on vocal_audio.
Successful submission response:
{
"code": "success",
"message": "",
"data": "task_01KABCDEF0123456789XYZ"
}Query endpoint: GET ${BASE}/v1/tasks/:id
curl "${BASE}/v1/tasks/task_01KABCDEF0123456789XYZ" \
-H "Authorization: Bearer ${KEY}"A task usually moves through queued and in_progress and ends as completed or failed. In the completed response, data is the unified music track array:
{
"status": "completed",
"model": "stepaudio-3-music",
"data": [
{
"audio_url": "https://your-gateway.example/media/audio.wav",
"model_name": "stepaudio-3-music",
"provider": "stepfun",
"status": "completed"
}
]
}Clients should read audio_url to play or download the audio and keep polling until the task reaches a terminal state. A failed task's fail_reason may come from a StepFun error message; if the upstream provides no usable audio or the gateway cannot store the audio, the task is returned as failed.
401: Check the gateway API key.400: Check prompt, lyrics, the task type, and the model_params constraints.502 or a task entering failed: Check the StepFun API key, the channel base URL, and the upstream service status.audio/ and that the decoded Base64 does not exceed the gateway limit.Do not call StepFun's /v1/audio/music/submit or /v1/audio/music/query directly. These two upstream paths are used internally by the gateway adapter; clients should always call the gateway's unified endpoints.