切换主题
文本转语音
将文本转换为音频
文本转语音
POST /v1/audio/speech
将文本转换为音频
认证
BearerAuth
请求体
必填:是
application/json
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| model | 是 | string | Examples: tts-1 |
| input | 是 | string | 要转换的文本 |
| voice | 是 | enum: alloy | echo | fable | onyx | nova | shimmer | - |
| response_format | 否 | enum: mp3 | opus | aac | flac | wav | pcm | Default: mp3 |
| speed | 否 | number | Default: 1 |
原始 Schema
json
{
"type": "object",
"required": [
"model",
"input",
"voice"
],
"properties": {
"model": {
"type": "string",
"examples": [
"tts-1"
]
},
"input": {
"type": "string",
"description": "要转换的文本",
"maxLength": 4096
},
"voice": {
"type": "string",
"enum": [
"alloy",
"echo",
"fable",
"onyx",
"nova",
"shimmer"
]
},
"response_format": {
"type": "string",
"enum": [
"mp3",
"opus",
"aac",
"flac",
"wav",
"pcm"
],
"default": "mp3"
},
"speed": {
"type": "number",
"minimum": 0.25,
"maximum": 4,
"default": 1
}
},
"x-apifox-orders": [
"model",
"input",
"voice",
"response_format",
"speed"
]
}响应
200 成功生成音频
audio/mpeg
类型:string
原始 Schema
json
{
"type": "string",
"format": "binary"
}