使用AI模型生成带或不带歌词的音乐。
customMode、instrumental、modelcustomMode: true):title 可选,最多 80 字符。仅此模式可用prompt 可选;提供时将严格作为歌词使用并在生成的音轨中演 唱。若同时传入 lyrics,优先使用 lyrics 作为歌词style、lyrics、negativeTags 至少提供一项,全部为空时将拒绝生成instrumental: true:生成纯音乐(无歌词)instrumental: false:使用 lyrics(未传则回退到 prompt)作为歌词duration、negativeTags、vocalGender、styleWeight、weirdnessConstraint、audioWeight、variety、personaId、personaModelprompt 3000字符,style 200字符prompt 5000字符,style 1000字符style 1000字符;lyrics 5000字符;negativeTags 1000字符title 长度限制:80字符(所有模型)customMode: false):prompt 可选;作为核心创意,歌词将根据它自动生成(不严格匹配输入),最多 3000 字符lyrics 可作为歌词附件,与 prompt 同时使用imageUrls、videoUrls、audioUrls、style、lyrics 至少提供一项,全部为空时将拒绝生成imageUrls、videoUrls、audioUrls 仅在此模式下有效title、negativeTags、duration、vocalGender、styleWeight、weirdnessConstraint、audioWeight、variety、personaId、personaModelstyle+ lyrics +imageUrls +videoUrls +audioUrlsprompt(string):描述所需音频内容的提示词。可选。自定义模式下作为歌词;非自定义模式下作为核心创意(最多 3000 字符)。lyrics(string):歌词内容。可选。V6 最多 5000 字符。自定义模式优先于 prompt 作为歌词;非自定义模式可作为歌词附件与 prompt 同时使用。imageUrls(array):图片参考。仅在 customMode 为 false 时有效。最多 5 张,单张不超过 10 MB,支持 jpeg、png、webp、bmp。videoUrls(array):视频参考。仅在 customMode 为 false 时有效。最多 1 个,单个不超过 100 MB,时长不超过 241 秒,支持 mp4、mov、webm。audioUrls(array):音频参考。仅在 customMode 为 false 时有效。时长需在 6 秒至 30 分钟之间,单个不超过 500 MB。style(string):音乐风格规范。字符限制见上方「参数详情」。title(string):曲目标题。可选。仅当 customMode 为 true 时可用。最多 80 字符。将显示在播放器界面和文件名中。negativeTags(string):从生成音频中排除的音乐风格或特征。仅当 customMode 为 true 时可用。V6、V6_MINI、V6_WILD 最多 1000 字符。vocalGender(string):人声性别偏好。m 男声,f 女声。仅当 customMode 为 true 时可用。根据实践,此参数只能加强概率,但不能保证一定遵循男女声的指令。styleWeight(number):对指定风格的遵循强度。范围 0–1,保留两位小数。仅在 customMode 为 true 时有效。weirdnessConstraint(number):创意/离散程度。范围 0–1,保留两位小数。仅在 customMode 为 true 时有效。audioWeight(number):音频要素相对权重。范围 0–1,保留两位小数。仅在 customMode 为 true 时有效。variety(number):生成结果的多样性。范围 0–4 的整数,默认 1。仅在 customMode 为 true 时有效。0 off(严格同一风格),1 normal(默认,平衡),2 high(风格差异明显),3 extra(大胆探索),4 max(最大差异)。personaId(string):Persona ID 或 Voice ID。可选。要生成 Persona ID,请访问 生成 Persona 接口。personaModel(string):persona 模型,可选 style_persona 或 voice_persona。仅 V5(已废弃)、V5.5(已废弃)、V6、V6_MINI、V6_WILD 可用。duration(number):音频时长,单位为秒。范围 10–360,默认 20。仅当 customMode 为 true 时可用,且仅对 customMode: false 开始使用,更简单text(文本生成)、first(第一首完成)、complete(全部完成)curl --location 'https://api.emix.ai/api/v1/client/tasks' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "suno/generate",
"callBackUrl": "https://api.example.com/callback",
"input": {
"prompt": "A calm and relaxing piano track with soft melodies",
"imageUrls": [
"https://loremflickr.com/400/400?lock=1778655903590390"
],
"style": "Classical",
"title": "Peaceful Piano Meditation",
"customMode": true,
"instrumental": true,
"model": "V6",
"negativeTags": "重金属, 快节奏鼓点",
"vocalGender": "m",
"styleWeight": 0.65,
"weirdnessConstraint": 0.65,
"audioWeight": 0.65,
"personaId": "persona_123",
"personaModel": "voice_persona",
"duration": 20
}
}'{
"code": 200,
"msg": "success",
"data": {
"taskId": "5c79****be8e"
}
}