创建音频生成任务
POST/api/v1/generate
创建一个新的音频生成任务。该接口支持自定义模式和非自定义模式,可以生成纯音乐或带歌词的音乐。
参数说明
-
customMode 为 true(自定义模式)时:
- instrumental 为 true:需提供 style 和 title
- instrumental 为 false:需提供 style、prompt 和 title
- prompt 长度限制:3000字符
- style 长度限制:200字符
- title 长度限制:80字符
-
customMode 为 false(非自定义模式)时:
- 无论 instrumental 是否启用,都只需提供 prompt
- prompt 长度限制:400字符
- 其他参数留空
注意事项
- 生成的文件将保留15天
- 回调过程分为三个阶段:text(文本生成)、first(第一首完成)、complete(全部完成)
- 某些情况下可能会跳过 text 和 first 直接返回 complete
Request
Responses
- 200
- 500
请求成功
服务器异常
Callbacks
- POST audioGenerated
POST{request.body#/callBackUrl}
当音频生成完成时,系统会调用此回调通知结果。
回调示例
{
"code": 200,
"msg": "All generated successfully.",
"data": {
"callbackType": "complete",
"task_id": "2fac****9f72",
"data": [
{
"id": "8551****662c",
"audio_url": "https://example.cn/****.mp3",
"source_audio_url": "https://example.cn/****.mp3",
"stream_audio_url": "https://example.cn/****",
"source_stream_audio_url": "https://example.cn/****",
"image_url": "https://example.cn/****.jpeg",
"source_image_url": "https://example.cn/****.jpeg",
"prompt": "[Verse] 夜晚城市 灯火辉煌",
"model_name": "chirp-v3-5",
"title": "钢铁侠",
"tags": "electrifying, rock",
"createTime": "2025-01-01 00:00:00",
"duration": 198.44
},
{
"id": "bd15****1873",
"audio_url": "https://example.cn/****.mp3",
"source_audio_url": "https://example.cn/****.mp3",
"stream_audio_url": "https://example.cn/****",
"source_stream_audio_url": "https://example.cn/****",
"image_url": "https://example.cn/****.jpeg",
"source_image_url": "https://example.cn/****.jpeg",
"prompt": "[Verse] 夜晚城市 灯火辉煌",
"model_name": "chirp-v3-5",
"title": "钢铁侠",
"tags": "electrifying, rock",
"createTime": "2025-01-01 00:00:00",
"duration": 228.28
}
]
}
}
Callbacks Responses
- 200
回调接收成功