ElevenLabs Voice Design
curl --request POST \
--url https://api.aihubmax.com/e/v1/audios/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "elevenlabs-voice-design",
"voice_description": "自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。",
"auto_generate_text": true
}
'import requests
url = "https://api.aihubmax.com/e/v1/audios/generations"
payload = {
"model": "elevenlabs-voice-design",
"voice_description": "自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。",
"auto_generate_text": True
}
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: 'elevenlabs-voice-design',
voice_description: '自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。',
auto_generate_text: true
})
};
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' => 'elevenlabs-voice-design',
'voice_description' => '自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。',
'auto_generate_text' => true
]),
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\": \"elevenlabs-voice-design\",\n \"voice_description\": \"自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。\",\n \"auto_generate_text\": true\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\": \"elevenlabs-voice-design\",\n \"voice_description\": \"自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。\",\n \"auto_generate_text\": true\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\": \"elevenlabs-voice-design\",\n \"voice_description\": \"自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。\",\n \"auto_generate_text\": true\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"
}
}语音合成
ElevenLabs 音色设计
- 通过文字描述设计候选音色,可选参考音频引导
- 返回试听文本和全部候选的试听链接及 generated_voice_id
- 试听并明确选择后,再调用 Voice Create
- 异步处理模式,使用返回的任务ID 进行查询
- 完成后读取
results[0].text与results[0].previews[];试听全部候选后,让用户明确选择一个generated_voice_id,再调用elevenlabs-voice-create。候选音频返回可下载 URL,不返回 Base64。 - 按实际返回的试听文本字符数计费一次,不乘候选数量。请及时保存试听音频。
POST
/
v1
/
audios
/
generations
ElevenLabs Voice Design
curl --request POST \
--url https://api.aihubmax.com/e/v1/audios/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "elevenlabs-voice-design",
"voice_description": "自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。",
"auto_generate_text": true
}
'import requests
url = "https://api.aihubmax.com/e/v1/audios/generations"
payload = {
"model": "elevenlabs-voice-design",
"voice_description": "自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。",
"auto_generate_text": True
}
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: 'elevenlabs-voice-design',
voice_description: '自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。',
auto_generate_text: true
})
};
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' => 'elevenlabs-voice-design',
'voice_description' => '自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。',
'auto_generate_text' => true
]),
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\": \"elevenlabs-voice-design\",\n \"voice_description\": \"自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。\",\n \"auto_generate_text\": true\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\": \"elevenlabs-voice-design\",\n \"voice_description\": \"自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。\",\n \"auto_generate_text\": true\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\": \"elevenlabs-voice-design\",\n \"voice_description\": \"自然、温暖、清晰的成年中文旁白声音,适合长篇讲解。\",\n \"auto_generate_text\": true\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"
}
}elevenlabs-voice-design 根据文字描述生成候选音色及试听。可以描述语言、年龄感、音色和表达风格,也可以提供有权使用的参考音频引导设计。
- 提交
voice_description(20–1000 字符)。试听文本方式二选一:传入text(100–1000 字符),或设置auto_generate_text=true并省略text。 - 查询任务,完成后读取
results[0].text与全部results[0].previews[]。每个候选包含试听url和generated_voice_id;音频已转换为下载链接,不返回 Base64。 - 展示并试听全部候选,让用户明确选中一个。确认后,才将该候选的
generated_voice_id传给 Voice Create。不要自动保存第一个候选或把全部候选都创建。
reference_audio_base64 只接受非空裸 Base64,不接受 URL 或 Data URI。仅使用本人或已获授权的音频。可选 prompt_strength 为0–1,0偏向参考音频、1偏向描述;loudness 为 -1–1(默认0.5),guidance_scale 为0–100(默认5),seed 为0–2147483647,should_enhance 默认false。当前设计模型不支持 quality,该字段及其他未知字段会被拒绝。
完成结果中的候选保留实际返回的 media_type、duration_secs、language、detected_labels 和其他元数据,并附 file_name、file_size;字段可为null,调用方应允许新增字段。每个候选的音色不同,通常共用同一份 text。候选数量以实际结果为准,请展示全部结果;候选可能过期,明确选定后应及时创建。
基准价为 USD 0.08/1000个实际返回的试听文本 Unicode 字符。只统计响应 text 一次,不乘候选数量,不补齐千字符;描述和其他控制参数不收费。自动文本预扣1000字符,手填文本预扣输入长度,完成后按实际文本和提交时分组倍率多退少补;失败按任务规则退款。
请及时下载试听音频,链接保留时间由文件存储策略决定。generated_voice_id 是待保存的候选 ID,后续合成使用的是 Create 返回的 voice_id。授权
请求体
application/json
试听文本,100–1000 字符。与 auto_generate_text=true 二选一。按响应 text 的实际字符数只计一次费用,不乘候选数量。
Required string length:
100 - 1000示例:
"欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。欢迎收听今天的分享。"
响应
任务创建成功