Skip to main content
POST
/
v1
/
audio
/
speech
文本转语音
curl --request POST \
  --url https://api.tkhub.ai/v1/v1/audio/speech \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "tts-1",
  "input": "<string>",
  "voice": "alloy",
  "response_format": "mp3",
  "speed": 1
}
'
"<string>"

Authorizations

Authorization
string
header
required

使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx

Body

application/json
model
string
required
Example:

"tts-1"

input
string
required

要转换的文本

Maximum string length: 4096
voice
enum<string>
required
Available options:
alloy,
echo,
fable,
onyx,
nova,
shimmer
response_format
enum<string>
default:mp3
Available options:
mp3,
opus,
aac,
flac,
wav,
pcm
speed
number
default:1
Required range: 0.25 <= x <= 4

Response

200 - audio/mpeg

成功生成音频

The response is of type file.