配音員與模型
配音員、風格、模型版本是三個綁在一起的維度。 串接前先查一次可用組合,可以省掉大量參數錯誤。
三種模型
| 版本 | 特性 | 適用場景 | 計費 | 採樣率上限 |
|---|---|---|---|---|
Classic |
極速生成、穩定性高 | 日常辦公、內容創作 | 1 字 1 點 | 44100 |
Neo |
情感層次細膩、語調自然 | 短影音、故事朗讀 | 1 字 1 點 | 32000 |
Sota+ |
最新生成式技術,擬真度最高 | 高品質語音需求 | 1 字 1 點 | 24000 |
style_weight 只有 Classic 會生效,
Neo 與 Sota+ 會忽略這個參數。
查詢可用配音員
回傳你的金鑰可以使用的所有配音員,依模型版本分組。不需要 request body。
回應
data.models
array
依模型版本分組的清單。
info.version
string
模型版本名稱。
info.remark
string
可能不存在
補充說明,無內容時不會出現在 JSON 中。
speakers[]
array
每筆包含
name(名稱)、styles(支援的風格)、
gender(性別)、age(年齡)、
category(聲線類型)。
curl --location '{{BASE_URL}}/TTS/GetSpeaker' \
--header 'x-api-key: your-api-key'
import requests
resp = requests.get(
"{{BASE_URL}}/TTS/GetSpeaker",
headers={"x-api-key": "your-api-key"},
timeout=30,
)
resp.raise_for_status()
for model in resp.json()["data"]["models"]:
print(model["info"]["version"])
for s in model["speakers"]:
print(" ", s["name"], s["styles"])
const resp = await fetch("{{BASE_URL}}/TTS/GetSpeaker", {
headers: { "x-api-key": "your-api-key" },
});
const { data } = await resp.json();
for (const model of data.models) {
console.log(model.info.version);
for (const s of model.speakers) {
console.log(" ", s.name, s.styles);
}
}
{
"data": {
"models": [
{
"info": { "version": "Neo" },
"speakers": [
{
"name": "佑希",
"styles": ["預設", "聊天", "輕鬆"],
"age": 25,
"gender": "女",
"category": "溫柔"
},
{
"name": "子墨",
"styles": ["預設", "沉穩"],
"age": 30,
"gender": "男",
"category": "厚實"
}
]
}
]
}
}
建議做法
配音員清單會隨合約與上架調整而變動, 不要把名稱硬寫在程式裡。 建議在服務啟動時取一次並快取,或在使用者選單中直接呈現這份清單。
錯誤
401
未提供或無效的 API Key
500
伺服器內部錯誤