curl --request POST \
--url https://apibox.erweima.ai/api/v1/generate/add-vocals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "带人声的轻松钢琴",
"negativeTags": "重金属, 激进人声",
"style": "爵士",
"uploadUrl": "https://example.com/instrumental.mp3",
"callBackUrl": "https://api.example.com/callback",
"prompt": "带有舒缓人声的平静放松钢琴曲",
"lyrics": "[Verse] 夜晚城市 灯火辉煌",
"vocalGender": "m",
"styleWeight": 0.61,
"weirdnessConstraint": 0.72,
"audioWeight": 0.65,
"variety": 1,
"model": "V6"
}
'import requests
url = "https://apibox.erweima.ai/api/v1/generate/add-vocals"
payload = {
"title": "带人声的轻松钢琴",
"negativeTags": "重金属, 激进人声",
"style": "爵士",
"uploadUrl": "https://example.com/instrumental.mp3",
"callBackUrl": "https://api.example.com/callback",
"prompt": "带有舒缓人声的平静放松钢琴曲",
"lyrics": "[Verse] 夜晚城市 灯火辉煌",
"vocalGender": "m",
"styleWeight": 0.61,
"weirdnessConstraint": 0.72,
"audioWeight": 0.65,
"variety": 1,
"model": "V6"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '带人声的轻松钢琴',
negativeTags: '重金属, 激进人声',
style: '爵士',
uploadUrl: 'https://example.com/instrumental.mp3',
callBackUrl: 'https://api.example.com/callback',
prompt: '带有舒缓人声的平静放松钢琴曲',
lyrics: '[Verse] 夜晚城市 灯火辉煌',
vocalGender: 'm',
styleWeight: 0.61,
weirdnessConstraint: 0.72,
audioWeight: 0.65,
variety: 1,
model: 'V6'
})
};
fetch('https://apibox.erweima.ai/api/v1/generate/add-vocals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apibox.erweima.ai/api/v1/generate/add-vocals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '带人声的轻松钢琴',
'negativeTags' => '重金属, 激进人声',
'style' => '爵士',
'uploadUrl' => 'https://example.com/instrumental.mp3',
'callBackUrl' => 'https://api.example.com/callback',
'prompt' => '带有舒缓人声的平静放松钢琴曲',
'lyrics' => '[Verse] 夜晚城市 灯火辉煌',
'vocalGender' => 'm',
'styleWeight' => 0.61,
'weirdnessConstraint' => 0.72,
'audioWeight' => 0.65,
'variety' => 1,
'model' => 'V6'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apibox.erweima.ai/api/v1/generate/add-vocals"
payload := strings.NewReader("{\n \"title\": \"带人声的轻松钢琴\",\n \"negativeTags\": \"重金属, 激进人声\",\n \"style\": \"爵士\",\n \"uploadUrl\": \"https://example.com/instrumental.mp3\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"prompt\": \"带有舒缓人声的平静放松钢琴曲\",\n \"lyrics\": \"[Verse] 夜晚城市 灯火辉煌\",\n \"vocalGender\": \"m\",\n \"styleWeight\": 0.61,\n \"weirdnessConstraint\": 0.72,\n \"audioWeight\": 0.65,\n \"variety\": 1,\n \"model\": \"V6\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apibox.erweima.ai/api/v1/generate/add-vocals")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"带人声的轻松钢琴\",\n \"negativeTags\": \"重金属, 激进人声\",\n \"style\": \"爵士\",\n \"uploadUrl\": \"https://example.com/instrumental.mp3\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"prompt\": \"带有舒缓人声的平静放松钢琴曲\",\n \"lyrics\": \"[Verse] 夜晚城市 灯火辉煌\",\n \"vocalGender\": \"m\",\n \"styleWeight\": 0.61,\n \"weirdnessConstraint\": 0.72,\n \"audioWeight\": 0.65,\n \"variety\": 1,\n \"model\": \"V6\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apibox.erweima.ai/api/v1/generate/add-vocals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"带人声的轻松钢琴\",\n \"negativeTags\": \"重金属, 激进人声\",\n \"style\": \"爵士\",\n \"uploadUrl\": \"https://example.com/instrumental.mp3\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"prompt\": \"带有舒缓人声的平静放松钢琴曲\",\n \"lyrics\": \"[Verse] 夜晚城市 灯火辉煌\",\n \"vocalGender\": \"m\",\n \"styleWeight\": 0.61,\n \"weirdnessConstraint\": 0.72,\n \"audioWeight\": 0.65,\n \"variety\": 1,\n \"model\": \"V6\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"taskId": "5c79****be8e"
}
}添加人声
通过为上传的音频文件添加人声元素,为现有的器乐音乐生成人声轨道
curl --request POST \
--url https://apibox.erweima.ai/api/v1/generate/add-vocals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "带人声的轻松钢琴",
"negativeTags": "重金属, 激进人声",
"style": "爵士",
"uploadUrl": "https://example.com/instrumental.mp3",
"callBackUrl": "https://api.example.com/callback",
"prompt": "带有舒缓人声的平静放松钢琴曲",
"lyrics": "[Verse] 夜晚城市 灯火辉煌",
"vocalGender": "m",
"styleWeight": 0.61,
"weirdnessConstraint": 0.72,
"audioWeight": 0.65,
"variety": 1,
"model": "V6"
}
'import requests
url = "https://apibox.erweima.ai/api/v1/generate/add-vocals"
payload = {
"title": "带人声的轻松钢琴",
"negativeTags": "重金属, 激进人声",
"style": "爵士",
"uploadUrl": "https://example.com/instrumental.mp3",
"callBackUrl": "https://api.example.com/callback",
"prompt": "带有舒缓人声的平静放松钢琴曲",
"lyrics": "[Verse] 夜晚城市 灯火辉煌",
"vocalGender": "m",
"styleWeight": 0.61,
"weirdnessConstraint": 0.72,
"audioWeight": 0.65,
"variety": 1,
"model": "V6"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '带人声的轻松钢琴',
negativeTags: '重金属, 激进人声',
style: '爵士',
uploadUrl: 'https://example.com/instrumental.mp3',
callBackUrl: 'https://api.example.com/callback',
prompt: '带有舒缓人声的平静放松钢琴曲',
lyrics: '[Verse] 夜晚城市 灯火辉煌',
vocalGender: 'm',
styleWeight: 0.61,
weirdnessConstraint: 0.72,
audioWeight: 0.65,
variety: 1,
model: 'V6'
})
};
fetch('https://apibox.erweima.ai/api/v1/generate/add-vocals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apibox.erweima.ai/api/v1/generate/add-vocals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '带人声的轻松钢琴',
'negativeTags' => '重金属, 激进人声',
'style' => '爵士',
'uploadUrl' => 'https://example.com/instrumental.mp3',
'callBackUrl' => 'https://api.example.com/callback',
'prompt' => '带有舒缓人声的平静放松钢琴曲',
'lyrics' => '[Verse] 夜晚城市 灯火辉煌',
'vocalGender' => 'm',
'styleWeight' => 0.61,
'weirdnessConstraint' => 0.72,
'audioWeight' => 0.65,
'variety' => 1,
'model' => 'V6'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apibox.erweima.ai/api/v1/generate/add-vocals"
payload := strings.NewReader("{\n \"title\": \"带人声的轻松钢琴\",\n \"negativeTags\": \"重金属, 激进人声\",\n \"style\": \"爵士\",\n \"uploadUrl\": \"https://example.com/instrumental.mp3\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"prompt\": \"带有舒缓人声的平静放松钢琴曲\",\n \"lyrics\": \"[Verse] 夜晚城市 灯火辉煌\",\n \"vocalGender\": \"m\",\n \"styleWeight\": 0.61,\n \"weirdnessConstraint\": 0.72,\n \"audioWeight\": 0.65,\n \"variety\": 1,\n \"model\": \"V6\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apibox.erweima.ai/api/v1/generate/add-vocals")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"带人声的轻松钢琴\",\n \"negativeTags\": \"重金属, 激进人声\",\n \"style\": \"爵士\",\n \"uploadUrl\": \"https://example.com/instrumental.mp3\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"prompt\": \"带有舒缓人声的平静放松钢琴曲\",\n \"lyrics\": \"[Verse] 夜晚城市 灯火辉煌\",\n \"vocalGender\": \"m\",\n \"styleWeight\": 0.61,\n \"weirdnessConstraint\": 0.72,\n \"audioWeight\": 0.65,\n \"variety\": 1,\n \"model\": \"V6\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apibox.erweima.ai/api/v1/generate/add-vocals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"带人声的轻松钢琴\",\n \"negativeTags\": \"重金属, 激进人声\",\n \"style\": \"爵士\",\n \"uploadUrl\": \"https://example.com/instrumental.mp3\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"prompt\": \"带有舒缓人声的平静放松钢琴曲\",\n \"lyrics\": \"[Verse] 夜晚城市 灯火辉煌\",\n \"vocalGender\": \"m\",\n \"styleWeight\": 0.61,\n \"weirdnessConstraint\": 0.72,\n \"audioWeight\": 0.65,\n \"variety\": 1,\n \"model\": \"V6\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"taskId": "5c79****be8e"
}
}模型版本
- 当前模型:
V6(默认)、V6_WILD、V6_MINI - 已废弃模型:
V5_5、V5、V4_5PLUS、V4_5ALL、V4_5、V4 - 废弃值仅为向后兼容保留,新接入请使用 V6 系列模型。
使用指南
- 此接口通过添加人声元素来增强器乐曲目
- 接受上传的音频文件,并根据您的规格生成人声
- 上传的音频必须可公开访问且采用支持的格式(MP3、WAV等)
参数详情
- 提供源音频(
uploadUrl)并填写下列必填字段即可生成,其余字段均为选填。 - 必需字段:
uploadUrl、callBackUrl、title、negativeTags、style - uploadUrl:必须是有效的、可公开访问的音频文件URL
- style:描述整体流派和人声方法(爵士、古典、电子、流行)
- negativeTags:要从生成中排除的音乐风格或人声特征
- title:用作生成的人声曲目的标题
可选参数
- lyrics(string):歌词内容。可选。V6 系列最多 5000 字符。优先于
prompt作为歌词。 - prompt(string):歌词内容。可选。未传入
lyrics时作为歌词使用。V6 系列最多 5000 字符。 - vocalGender(string):首选人声性别。允许的值:
m(男性)、f(女性) - styleWeight(number):范围0-1的风格权重(建议两位小数)
- weirdnessConstraint(number):范围0-1的创意/新颖性约束(建议两位小数)
- audioWeight(number):范围0-1的音频一致性相对权重(建议两位小数)
- variety(number):生成结果的多样性。范围 0–4 的整数,默认 1。
0关闭,1普通(默认),2高,3额外,4最大。 - model(string):用于生成的模型版本。当前值:
V6(默认)、V6_WILD、V6_MINI。已废弃:V5_5、V5、V4_5PLUS、V4_5ALL、V4_5、V4。
开发者注意事项
- 回调过程有三个阶段:
text(文本生成)、first(第一轨道完成)、complete(所有轨道完成) - 在某些情况下,
text和first阶段可能被跳过,直接返回complete - 详细回调格式请参见添加人声回调
- 使用获取音乐生成详情监控任务进度
授权
🔑 API 认证说明
所有接口都需要通过 Bearer Token 方式进行认证。
获取 API Key
- 访问 API Key 管理页面 获取您的 API Key
使用方式
在请求头中添加:
Authorization: Bearer YOUR_API_KEY
⚠️ 注意:
- 请妥善保管您的 API Key,不要泄露给他人
- 如果怀疑 API Key 泄露,请立即在管理页面重置
请求体
音乐曲目的标题。必填。这将作为生成的人声曲目的标题。
"带人声的轻松钢琴"
要从生成的曲目中排除的音乐风格或人声特征。必填。用于避免特定的人声风格或特征。
"重金属, 激进人声"
音乐和人声风格。必填。例如:爵士、古典、电子、流行。描述整体流派和人声方法。
"爵士"
要添加人声的上传音频文件的URL。必须是系统可以访问的有效音频文件URL。上传的音频应该采用支持的格式(MP3、WAV等)。
"https://example.com/instrumental.mp3"
当人声生成完成时接收任务完成通知的URL。回调过程分为三个阶段:text、first、complete。在某些情况下,text和first阶段可能被跳过,直接返回complete。
"https://api.example.com/callback"
歌词内容。可选。未传入 lyrics 时作为歌词使用;若同时传入 lyrics,优先使用 lyrics。V6、V6_MINI、V6_WILD 最多 5000 字符。
"带有舒缓人声的平静放松钢琴曲"
歌词内容。可选。V6、V6_MINI、V6_WILD 最多 5000 字符。优先于 prompt 作为歌词;未传入时使用 prompt 作为歌词。
"[Verse] 夜晚城市 灯火辉煌"
首选人声性别。可选。允许的值:m(男性)、f(女性)。
m, f "m"
风格权重。可选。范围:0-1。建议保留两位小数。
0 <= x <= 1必须是以下数值的倍数 0.010.61
创意/新颖性约束。可选。范围:0-1。建议保留两位小数。
0 <= x <= 1必须是以下数值的倍数 0.010.72
音频一致性与其他控制的相对权重。可选。范围:0-1。建议保留两位小数。
0 <= x <= 1必须是以下数值的倍数 0.010.65
控制生成结果的多样性和风格差异程度。可选。范围 0–4 的整数,默认值为 1。
0:off(exact style),完全关闭,严格用同一风格1:normal(balanced variety),默认值,在稳定性和多样性之间保持平衡2:high(distinct styles),生成风格差异明显的结果3:extra(bold exploration),提供更高程度的变化,鼓励大胆探索不同风格4:max(unreasonably varied),最大程度增加多样性,生成结果可能具有非常明显的风格差异
0 <= x <= 4必须是以下数值的倍数 11
AI 模型版本。默认值:V6。
V6:当前标准模型,推荐默认使用。V6_WILD:当前实验性、创造性更强的模型。V6_MINI:当前轻量模型。- 已废弃:
V5_5、V5、V4_5PLUS、V4_5ALL、V4_5、V4。这些值仅为向后兼容保留,新接入请使用 V6 系列模型。
V6, V6_WILD, V6_MINI, V5_5, V5, V4_5PLUS, V4_5ALL, V4_5, V4 "V6"
响应
请求成功
状态码说明
- ✅ 200 - 请求成功
- ⚠️ 400 - 参数错误
- ⚠️ 401 - 没有访问权限
- ⚠️ 404 - 请求方式或者路径错误
- ⚠️ 405 - 调用超过限制
- ⚠️ 413 - 主题或者prompt过长
- ⚠️ 429 - 积分不足
- ⚠️ 430 - 您的调用频率过高。请稍后再试。
- ⚠️ 455 - 网站维护
- ❌ 500 - 服务器异常
200, 400, 401, 404, 405, 413, 429, 430, 455, 500 200
当 code != 200 时,展示错误信息
"success"
Show child attributes
Show child attributes
