- 前言(必读)
- 常见错误代码及其含义
- 聊天模型(chat)
- 创建嵌入
- 音频模型(Audio)
- 绘画模型(Painting)
- Dalle
- MidJourney
- 常用调用代码整理
文字转语音 TTS
POST
/v1/audio/speech
请求参数
Body 参数application/json
model
string
模型名称
input
string
待生成文字
voice
string
音色选择
response_format
string | null
音频格式
speed
string | null
播放速度
示例
{
"model": "tts-1",
"input": "敏捷的棕色狐狸从懒惰的狗身上跳过去。",
"voice": "alloy"
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST '/v1/audio/speech' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "tts-1",
"input": "敏捷的棕色狐狸从懒惰的狗身上跳过去。",
"voice": "alloy"
}'
返回响应
🟢200成功
application/json
Body
object {0}
示例
// 直接返回音频文件 xxx.mp3