POST
/v2/generate生成音乐API
默认音乐生成用于 AI 音乐创作的端点。支持灵感模式和自定义模式。
POST
https://udioapi.pro/api/v2/generatetips
默认 Music Generate endpoint:标准音乐生成请使用此路由。MiniMax 是已接入的提供商,有独立 endpoint,不是本 API 的默认模型。
两种生成模式:
- 灵感模式:使用
gpt_description_prompt根据文本描述生成音乐 - 自定义模式:使用
prompt、style、title进行精细控制
模型选择:可选 chirp-v4-0、chirp-v4-5、chirp-v4-5-plus、chirp-v5 或 chirp-v5-5,质量档位不同。可跳转查看模型介绍与积分消耗。
下一步:调用本接口提交生成任务后,请使用 音乐生成任务状态 API 轮询任务进度并获取音频链接。
requestHeaders
| name | required | description |
|---|---|---|
Authorization | yes | 用于身份验证的承载令牌 |
Content-Type | yes | application/json |
requestBody
请求体支持灵感模式或自定义模式
灵感模式
从文本描述生成音乐
| paramName | paramType | required | description | example |
|---|---|---|---|---|
gpt_description_prompt | string | yes | 您要生成的音乐的文字描述 | A upbeat pop song about summer vacation with catchy melody |
自定义模式
使用自定义歌词、风格和标题生成音乐
| paramName | paramType | required | description | example |
|---|---|---|---|---|
prompt | string | yes | 自定义歌词或详细提示 | Verse 1: Walking down the street, feeling so free... |
style | string | no | 音乐风格或流派 | pop, upbeat, electronic, 120 bpm |
title | string | no | 歌名 | Summer Dreams |
tags | string | no | 要避免的负面标签 | sad, slow |
commonParams
| paramName | paramType | required | description | example |
|---|---|---|---|---|
model | string | no | 要使用的 AI 模型。 | chirp-v5-5 |
make_instrumental | boolean | no | 生成没有人声的器乐 | false |
gender | string | no | 声音性别偏好 | female |
style_weight | number | no | 坚持风格的强度 | 0.65 |
weirdness_constraint | number | no | 控制创意偏差 | 0.65 |
audio_weight | number | no | 音频功能的平衡重量 | 0.65 |
responses
json
{
"code": 200,
"message": "success",
"workId": "gen2abc123def456bksv",
"data": {
"task_id": "gen2abc123def456bksv"
}
}codeExamples
curl
curl -X POST "https://udioapi.pro/api/v2/generate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "chirp-v4-5",
"prompt": "Verse 1: Walking down the street, feeling so free\nChorus: Summer dreams are calling me",
"style": "pop, upbeat, electronic, 120 bpm",
"title": "Summer Dreams",
"make_instrumental": false,
"gender": "female",
"style_weight": 0.65,
"weirdness_constraint": 0.65,
"audio_weight": 0.65
}'