使用AI模型生成带或不带歌词的音乐。
customMode: true):instrumental: true:需提供 style 和 titleinstrumental: false:需提供 style、prompt 和 titleprompt 3000字符,style 200字符prompt 5000字符,style 1000字符prompt 5000字符,style 1000字符prompt 5000字符,style 1000字符title 长度限制:80字符(所有模型)customMode: false):instrumental 设置如何,仅需提供 promptprompt 长度限制:500字符customMode: false 开始使用,更简单text(文本生成)、first(第一首完成)、complete(全部完成)vocalGender(string): 人声性别偏好。m 男声,f 女声。注意:此参数仅在 customMode 为 true 时生效。根据实践,此参数只能加强概率,但不能保证一定遵循男女声的指令。styleWeight(number): 对风格的遵循强度。范围 0–1, 保留两位小数。示例:0.65。weirdnessConstraint(number): 创意/离散程度。范围 0–1,保留两位小数。示例:0.65。audioWeight(number): 音频要素权重。范围 0–1,保留两位小数。示例:0.65。personaId(string): 应用到生成音乐的personaId。仅在开启自定义模式时可用。使用此参数为音乐生成应用特定的人格风格。要生成personaId,请访问 生成 Persona 接口。curl --location --request POST 'https://api.kie.ai/api/v1/generate' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "A calm and relaxing piano track with soft melodies",
"style": "Classical",
"title": "Peaceful Piano Meditation",
"customMode": true,
"instrumental": true,
"model": "V4",
"callBackUrl": "https://api.example.com/callback",
"negativeTags": "重金属, 快节奏鼓点",
"vocalGender": "m",
"styleWeight": 0.65,
"weirdnessConstraint": 0.65,
"audioWeight": 0.65,
"personaId": "persona_123"
}'{
"code": 200,
"msg": "success",
"data": {
"taskId": "5c79****be8e"
}
}