文档 / 音乐系列 / Suno / 音乐生成
音乐生成POSTSunoCONCATclipsuno_concat
拼接续写歌曲
把 extend 产生的片段合并为完整歌曲。
Bearer API KeyJSON服务端调用
用途#
通过 POST /v1/music/concat 将续写后得到的歌曲片段合并为完整歌曲。
请求字段#
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
clip_id | string | 是 | 要合并的续写歌曲片段 ID |
is_infill | boolean | 否 | 是否将中段填充结果合并回原曲,默认 false |
callback_url | string | 否 | 任务完成或失败时接收通知的 HTTPS 地址;不合法的地址不会导致提交失败,但不会收到回调 |
请求示例#
bash
curl -X POST 'https://api.apimax.ai/v1/music/concat' \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"clip_id": "1f78f8de-4ca6-4375-ae79-46c33a2c97f7",
"is_infill": false,
"callback_url": "https://your-app.example/music-callback"
}'成功响应#
200
{
"created_at": 1795404821,
"id": "task_q7VHHWV14XZNQiG5tzioM5w0CoZ6qbZx",
"model": "suno_concat",
"status": "queued",
"task_id": "task_q7VHHWV14XZNQiG5tzioM5w0CoZ6qbZx"
}响应字段#
| 字段 | 类型 | 说明 |
|---|---|---|
task_id | string | 公开任务 ID,用于后续查询与回调 |
id | string | 与 task_id 相同 |
status | string | 提交后固定为 queued |
model | string | 模型名,固定为 suno_concat |
created_at | integer | 任务创建时间(Unix 秒) |
所有后续查询都使用 task_id。
错误响应#
出错时统一返回下面的结构,error.code 是错误码,error.message 是具体原因:
400
{
"error": {
"code": "plugin_request_invalid",
"message": "clip_id_empty",
"type": "max_api_error"
}
}| HTTP | error.code | error.message | 场景 |
|---|---|---|---|
| 400 | plugin_request_invalid | clip_id_empty | clip_id 为空 |
| 400 | invalid_request | 具体的解析错误 | 请求体不是合法的 JSON 对象 |
| 400 | upstream_error | clip_id not produced by this pool | clip_id 不是本服务生成的 clip,提交时直接返回 |
| 503 | model_not_found | 无可用渠道(含分组与模型名) | 当前没有可用渠道 |
查询任务结果#
提交成功后,使用返回的 task_id 轮询:
- 单个查询:
GET /v1/tasks/:id
status 枚举#
| 值 | 说明 |
|---|---|
queued | 任务已创建,等待处理 |
in_progress | 任务正在处理 |
completed | 任务处理完成,可读取 data |
failed | 任务处理失败,可读取 error |
completed 和 failed 为终态;其余状态请继续轮询。
响应字段#
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 公开任务 ID |
object | string | 固定为 task |
model | string | 模型名,固定为 suno_concat |
platform / type | string | 固定为 suno |
status | string | 任务状态,见上方枚举 |
progress | integer | 进度百分比,0–100 |
created_at | integer | 提交时间(Unix 秒) |
started_at | integer | 开始处理时间(Unix 秒),未开始时不返回 |
finished_at | integer | 结束时间(Unix 秒),未结束时不返回 |
data | — | 任务结果,仅 completed 时返回,结构见下文 |
error | object | 失败信息,仅 failed 时返回,含 code 与 message |
任务失败时 status 为 failed,原因在 error.message(例如上游超时的 task_timeout),该次费用会退回。
结果字段(data)#
查询结果中的 data 字段是只含一个元素的数组,即拼接后的完整歌曲(metadata 仅展示部分字段):
json
{
"created_at": 1795404821,
"data": [
{
"audio_url": "https://cdn2.suno.show/media/export/ce8bd812-df28-4760-9540-4c09cd1ba9b2.mp3",
"created_at": "2026-11-23T03:33:42.135Z",
"id": "ce8bd812-df28-4760-9540-4c09cd1ba9b2",
"image_url": "https://cdn2.suno.ai/image_38f2fa52-0a7c-4e75-918f-5104a939951e.jpeg",
"status": "complete",
"title": "你在身旁",
"metadata": {
"duration": 39.08,
"type": "concat"
}
}
],
"finished_at": 1795404842,
"id": "task_q7VHHWV14XZNQiG5tzioM5w0CoZ6qbZx",
"model": "suno_concat",
"object": "task",
"platform": "suno",
"progress": 100,
"started_at": 1795404821,
"status": "completed",
"type": "suno"
}data[0].id 是拼接后新 clip 的 ID;metadata.type 为 concat,metadata.concat_history 记录被拼接的各个片段。

