文本转语音
curl --request POST \
--url https://api.hubto.ai/v1/audio/speech \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"voice": "<string>",
"input": "<string>"
}
'import requests
url = "https://api.hubto.ai/v1/audio/speech"
payload = {
"model": "<string>",
"voice": "<string>",
"input": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', voice: '<string>', input: '<string>'})
};
fetch('https://api.hubto.ai/v1/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"audio": {}
}接口示例
文本转语音
文本转语音接口。
POST
/
v1
/
audio
/
speech
文本转语音
curl --request POST \
--url https://api.hubto.ai/v1/audio/speech \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"voice": "<string>",
"input": "<string>"
}
'import requests
url = "https://api.hubto.ai/v1/audio/speech"
payload = {
"model": "<string>",
"voice": "<string>",
"input": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', voice: '<string>', input: '<string>'})
};
fetch('https://api.hubto.ai/v1/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"audio": {}
}用途
用于把输入文本合成为语音。请求头
string
默认值:"Bearer YOUR_API_KEY"
必填
Bearer 鉴权请求头。
请求体
string
默认值:"gpt-5.4-tts"
必填
语音模型名称。
string
默认值:"alloy"
必填
音色名称。
string
默认值:"欢迎使用 HubTo。"
必填
待合成文本。
string
默认值:"mp3"
可选,输出音频格式。
number
默认值:"1.0"
可选,语速倍率。
示例请求体
{
"model": "gpt-5.4-tts",
"voice": "alloy",
"input": "欢迎使用 HubTo。"
}
响应
binary
合成后的音频内容。
⌘I