On this page
article
OpenAI
1.概述
业界第一大语言模型。根据输入文本生成音频
模型列表:
tts-1
tts-1-hd
2.请求说明
- 请求方法:
POST
- 请求地址
https://gateway.theturbo.ai/v1/audio/speech
3.请求参数
3.1 Head参数
参数名称 | 类型 | 必填 | 说明 | 示例值 |
---|---|---|---|---|
Content-Type |
string | 是 | 设置请求头类型,必须为application/json |
application/json |
Authorization |
string | 是 | 身份验证所需的 API_KEY,格式Bearer $YOUR_API_KEY |
Bearer $YOUR_API_KEY |
3.2 Body 参数 (application/json)
参数名称 | 类型 | 必填 | 说明 | 示例(默认值) |
---|---|---|---|---|
model | string | 是 | 要使用的模型 ID。详见概述列出的可用版本,如 tts-1 。 |
tts-1 |
input | string | 是 | 用于生成音频的文本,最大长度为 4096 个字符。 |
你好,我是小明 |
voice | string | 是 | 用于生成音频的语音类型。支持:alloy 、ash 、coral echo fable onyx nova sage shimmer |
alloy |
response_format | string | 否 | 音频的输出格式。支持:mp3 、opus 、aac 、flac 、wav 、pcm 。 |
mp3 |
speed | number | 否 | 生成音频的语速。可选的范围是 0.25 到 4.0 。 |
1.0 |
4.请求示例
POST /v1/audio/speech
Content-Type: application/json
Authorization: Bearer $YOUR_API_KEY
{
"model": "tts-1",
"input": "你好,我是小明",
"voice": "alloy"
}
5.响应示例
HTTP/1.1 200 OK
Content-Type: audio/mpeg
音频二进制文件