从样本音频克隆音色(异步)
curl --request POST \
--url https://api.vmeg.ai/openapi/v1/task/clone-voice/create-async \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--data '
{
"voiceName": "<string>",
"provider": "V1",
"refAudio": "<string>",
"sampleLanguage": "zh-CN",
"sampleText": "<string>",
"extraData": {}
}
'import requests
url = "https://api.vmeg.ai/openapi/v1/task/clone-voice/create-async"
payload = {
"voiceName": "<string>",
"provider": "V1",
"refAudio": "<string>",
"sampleLanguage": "zh-CN",
"sampleText": "<string>",
"extraData": {}
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Idempotency-Key': '<x-idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
voiceName: '<string>',
provider: 'V1',
refAudio: '<string>',
sampleLanguage: 'zh-CN',
sampleText: '<string>',
extraData: {}
})
};
fetch('https://api.vmeg.ai/openapi/v1/task/clone-voice/create-async', 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://api.vmeg.ai/openapi/v1/task/clone-voice/create-async",
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([
'voiceName' => '<string>',
'provider' => 'V1',
'refAudio' => '<string>',
'sampleLanguage' => 'zh-CN',
'sampleText' => '<string>',
'extraData' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Idempotency-Key: <x-idempotency-key>"
],
]);
$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://api.vmeg.ai/openapi/v1/task/clone-voice/create-async"
payload := strings.NewReader("{\n \"voiceName\": \"<string>\",\n \"provider\": \"V1\",\n \"refAudio\": \"<string>\",\n \"sampleLanguage\": \"zh-CN\",\n \"sampleText\": \"<string>\",\n \"extraData\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Idempotency-Key", "<x-idempotency-key>")
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://api.vmeg.ai/openapi/v1/task/clone-voice/create-async")
.header("X-Idempotency-Key", "<x-idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"voiceName\": \"<string>\",\n \"provider\": \"V1\",\n \"refAudio\": \"<string>\",\n \"sampleLanguage\": \"zh-CN\",\n \"sampleText\": \"<string>\",\n \"extraData\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vmeg.ai/openapi/v1/task/clone-voice/create-async")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Idempotency-Key"] = '<x-idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"voiceName\": \"<string>\",\n \"provider\": \"V1\",\n \"refAudio\": \"<string>\",\n \"sampleLanguage\": \"zh-CN\",\n \"sampleText\": \"<string>\",\n \"extraData\": {}\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "",
"data": {
"taskId": "<string>",
"createdAt": "<string>"
}
}声音克隆
从样本音频克隆音色(异步)
提交声音克隆任务。HTTP 仅返回受理信息(taskId)。新 voiceId 通过 Webhook 回调投递(event: openapi-clone-voice)。
POST
/
openapi
/
v1
/
task
/
clone-voice
/
create-async
从样本音频克隆音色(异步)
curl --request POST \
--url https://api.vmeg.ai/openapi/v1/task/clone-voice/create-async \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--data '
{
"voiceName": "<string>",
"provider": "V1",
"refAudio": "<string>",
"sampleLanguage": "zh-CN",
"sampleText": "<string>",
"extraData": {}
}
'import requests
url = "https://api.vmeg.ai/openapi/v1/task/clone-voice/create-async"
payload = {
"voiceName": "<string>",
"provider": "V1",
"refAudio": "<string>",
"sampleLanguage": "zh-CN",
"sampleText": "<string>",
"extraData": {}
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Idempotency-Key': '<x-idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
voiceName: '<string>',
provider: 'V1',
refAudio: '<string>',
sampleLanguage: 'zh-CN',
sampleText: '<string>',
extraData: {}
})
};
fetch('https://api.vmeg.ai/openapi/v1/task/clone-voice/create-async', 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://api.vmeg.ai/openapi/v1/task/clone-voice/create-async",
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([
'voiceName' => '<string>',
'provider' => 'V1',
'refAudio' => '<string>',
'sampleLanguage' => 'zh-CN',
'sampleText' => '<string>',
'extraData' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Idempotency-Key: <x-idempotency-key>"
],
]);
$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://api.vmeg.ai/openapi/v1/task/clone-voice/create-async"
payload := strings.NewReader("{\n \"voiceName\": \"<string>\",\n \"provider\": \"V1\",\n \"refAudio\": \"<string>\",\n \"sampleLanguage\": \"zh-CN\",\n \"sampleText\": \"<string>\",\n \"extraData\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Idempotency-Key", "<x-idempotency-key>")
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://api.vmeg.ai/openapi/v1/task/clone-voice/create-async")
.header("X-Idempotency-Key", "<x-idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"voiceName\": \"<string>\",\n \"provider\": \"V1\",\n \"refAudio\": \"<string>\",\n \"sampleLanguage\": \"zh-CN\",\n \"sampleText\": \"<string>\",\n \"extraData\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vmeg.ai/openapi/v1/task/clone-voice/create-async")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Idempotency-Key"] = '<x-idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"voiceName\": \"<string>\",\n \"provider\": \"V1\",\n \"refAudio\": \"<string>\",\n \"sampleLanguage\": \"zh-CN\",\n \"sampleText\": \"<string>\",\n \"extraData\": {}\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "",
"data": {
"taskId": "<string>",
"createdAt": "<string>"
}
}请求体
application/json
克隆音色在资产库中的展示名称
参考音频 URL(HTTPS)
refAudio 的可选对照文本,有助于提升克隆质量
异步提交时的可选客户端元数据;任务完成时在 Webhook 回调体 extraData 中回显。同步创建接口不使用。
回调
POSThttps://{yourWebhookUrl}taskCompleted
请求体
application/json
event 为 openapi-clone-voice 时的克隆 Webhook 请求体;成功时 data 含 voiceId 等。
event 为 openapi-clone-voice 时的克隆结果(含 voiceId 等)。
Show child attributes
Show child attributes
本次投递的业务结果码
示例:
200
任务的 API 版本号(如 v1、v2),与请求路径中的版本一致(如 /openapi/v1/...)。
示例:
"v1"
已完成的产品类型。请按此值路由:openapi-tts(TTS)、openapi-translate(文本翻译)、openapi-clone-voice(声音克隆)、openapi-media-translation(音视频翻译)。详见 Webhook 请求体。
可用选项:
openapi-tts, openapi-translate, openapi-clone-voice, openapi-media-translation 示例:
"openapi-tts"
该次异步完成的稳定标识。请用此字段对接收端去重 — 见 Webhook 请求体。
示例:
"a1b2c3d4e5f6789012345678901234ab"
当 code 非成功时的说明
与异步提交请求中的 extraData 一致
响应
200
请尽快返回 2xx 以停止重试

