Eleven v4 Dialogue / Custom Voice
curl --request POST \
--url https://api.aihubmax.com/e/v1/audios/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "eleven-v4-text-to-dialogue",
"inputs": [
{
"text": "你好。",
"voice_id": "existing-voice-id"
}
]
}
'import requests
url = "https://api.aihubmax.com/e/v1/audios/generations"
payload = {
"model": "eleven-v4-text-to-dialogue",
"inputs": [
{
"text": "你好。",
"voice_id": "existing-voice-id"
}
]
}
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({
model: 'eleven-v4-text-to-dialogue',
inputs: [{text: '你好。', voice_id: 'existing-voice-id'}]
})
};
fetch('https://api.aihubmax.com/e/v1/audios/generations', 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.aihubmax.com/e/v1/audios/generations",
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([
'model' => 'eleven-v4-text-to-dialogue',
'inputs' => [
[
'text' => '你好。',
'voice_id' => 'existing-voice-id'
]
]
]),
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://api.aihubmax.com/e/v1/audios/generations"
payload := strings.NewReader("{\n \"model\": \"eleven-v4-text-to-dialogue\",\n \"inputs\": [\n {\n \"text\": \"你好。\",\n \"voice_id\": \"existing-voice-id\"\n }\n ]\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://api.aihubmax.com/e/v1/audios/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"eleven-v4-text-to-dialogue\",\n \"inputs\": [\n {\n \"text\": \"你好。\",\n \"voice_id\": \"existing-voice-id\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aihubmax.com/e/v1/audios/generations")
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 \"model\": \"eleven-v4-text-to-dialogue\",\n \"inputs\": [\n {\n \"text\": \"你好。\",\n \"voice_id\": \"existing-voice-id\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "audio.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "audio"
}{
"error": {
"message": "请求格式错误",
"type": "invalid_request_error"
}
}{
"error": {
"message": "API密钥无效",
"type": "authentication_error"
}
}{
"error": {
"message": "账户余额不足",
"type": "insufficient_quota"
}
}{
"error": {
"message": "参数校验失败",
"type": "validation_error"
}
}{
"error": {
"message": "请求频率超限",
"type": "rate_limit_error"
}
}{
"error": {
"message": "服务器内部错误",
"type": "server_error"
}
}{
"error": {
"message": "服务暂不可用,请稍后重试",
"type": "service_unavailable"
}
}语音合成
Eleven v4 多音色对话
- 顺序台词与指定音色合成对话
- inputs 每项使用 text/voice_id,最多10个不同音色
- 总文本建议不超过2000字符
- 异步处理模式,使用返回的任务ID 进行查询
- 完成后从
results[0].url下载音频;timestamps 请求仅在完整功能可用时受理,结果保留实际返回的对齐和说话人区间,不补造缺失字段。请及时下载,链接保留时间取决于文件存储服务。
POST
/
v1
/
audios
/
generations
Eleven v4 Dialogue / Custom Voice
curl --request POST \
--url https://api.aihubmax.com/e/v1/audios/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "eleven-v4-text-to-dialogue",
"inputs": [
{
"text": "你好。",
"voice_id": "existing-voice-id"
}
]
}
'import requests
url = "https://api.aihubmax.com/e/v1/audios/generations"
payload = {
"model": "eleven-v4-text-to-dialogue",
"inputs": [
{
"text": "你好。",
"voice_id": "existing-voice-id"
}
]
}
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({
model: 'eleven-v4-text-to-dialogue',
inputs: [{text: '你好。', voice_id: 'existing-voice-id'}]
})
};
fetch('https://api.aihubmax.com/e/v1/audios/generations', 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.aihubmax.com/e/v1/audios/generations",
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([
'model' => 'eleven-v4-text-to-dialogue',
'inputs' => [
[
'text' => '你好。',
'voice_id' => 'existing-voice-id'
]
]
]),
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://api.aihubmax.com/e/v1/audios/generations"
payload := strings.NewReader("{\n \"model\": \"eleven-v4-text-to-dialogue\",\n \"inputs\": [\n {\n \"text\": \"你好。\",\n \"voice_id\": \"existing-voice-id\"\n }\n ]\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://api.aihubmax.com/e/v1/audios/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"eleven-v4-text-to-dialogue\",\n \"inputs\": [\n {\n \"text\": \"你好。\",\n \"voice_id\": \"existing-voice-id\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aihubmax.com/e/v1/audios/generations")
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 \"model\": \"eleven-v4-text-to-dialogue\",\n \"inputs\": [\n {\n \"text\": \"你好。\",\n \"voice_id\": \"existing-voice-id\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "audio.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "audio"
}{
"error": {
"message": "请求格式错误",
"type": "invalid_request_error"
}
}{
"error": {
"message": "API密钥无效",
"type": "authentication_error"
}
}{
"error": {
"message": "账户余额不足",
"type": "insufficient_quota"
}
}{
"error": {
"message": "参数校验失败",
"type": "validation_error"
}
}{
"error": {
"message": "请求频率超限",
"type": "rate_limit_error"
}
}{
"error": {
"message": "服务器内部错误",
"type": "server_error"
}
}{
"error": {
"message": "服务暂不可用,请稍后重试",
"type": "service_unavailable"
}
}eleven-v4-text-to-dialogue 与 eleven-v4-text-to-dialogue-custom-voice 共用非空 inputs,每项必填 text 与 voice_id。保持台词顺序和音色ID;最多10个不同音色,重复ID只计一次,台词可超过10段。总文本建议不超过2000字符,超出可能提前结束或报错;这不是本地硬上限。
可选 settings 包含 stability(默认0.5)、similarity(默认0.75)及可选 clone_strength,均为0–1。省略/null整个对象保留音色设置;clone_strength仅适用于v4专业克隆音色。前后文为 previous_text / future_text,不计字符费。seed为0–4294967295,文本规范化默认auto。
custom允许公共/私有音色混合,普通入口不检查互斥类别。同一次请求的所有ID必须可共同访问;不会拆分到不同账号生成或替换音色。ID不保证永久可用、可跨服务迁移或用户独享,音色不可用按任务规则失败退款。
默认输出mp3_44100_128,28种格式见参数。显式时间戳与发音词典只有在完整功能可用时受理;结果仅保留实际返回的对齐和说话人段,可能缺省,不补造元数据。完成后查询任务并及时下载results[0].url。
两模型均为 $0.00008/Unicode字符,累计各项inputs[].text,包括空格、标点和标签,不计ID、前后文与设置,不补齐千字符。使用提交时价格和分组倍率,预扣差额在完成时结算。
迁移:inputs[].voice → inputs[].voice_id;平铺控制移至settings,原similarity_boost改为settings.similarity。未知字段明确拒绝;历史任务不重建、不重新生成。授权
请求体
application/json
音频编码、采样率及码率;共 28 种格式。
可用选项:
mp3_22050_32, mp3_24000_48, mp3_44100_32, mp3_44100_64, mp3_44100_96, mp3_44100_128, mp3_44100_192, pcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_32000, pcm_44100, pcm_48000, wav_8000, wav_16000, wav_22050, wav_24000, wav_32000, wav_44100, wav_48000, ulaw_8000, alaw_8000, opus_48000_32, opus_48000_64, opus_48000_96, opus_48000_128, opus_48000_192 示例:
"mp3_44100_128"
响应
任务创建成功