文本转语音
curl --request POST \
--url https://zero.cat/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "tts-1",
"input": "<string>",
"response_format": "mp3",
"speed": 1
}
'import requests
url = "https://zero.cat/v1/audio/speech"
payload = {
"model": "tts-1",
"input": "<string>",
"response_format": "mp3",
"speed": 1
}
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: 'tts-1', input: '<string>', response_format: 'mp3', speed: 1})
};
fetch('https://zero.cat/v1/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));"<string>"音频
文本转语音
将文本转换为音频
POST
/
v1
/
audio
/
speech
文本转语音
curl --request POST \
--url https://zero.cat/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "tts-1",
"input": "<string>",
"response_format": "mp3",
"speed": 1
}
'import requests
url = "https://zero.cat/v1/audio/speech"
payload = {
"model": "tts-1",
"input": "<string>",
"response_format": "mp3",
"speed": 1
}
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: 'tts-1', input: '<string>', response_format: 'mp3', speed: 1})
};
fetch('https://zero.cat/v1/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));"<string>"授权
ZeroCat API 密钥(sk- 开头),在控制台「API 密钥」页面创建。
格式:Authorization: Bearer sk-xxxxxx
请求体
application/json
响应
200 - audio/mpeg
成功生成音频
The response is of type file.

