主题
创建语音 gpt-4o-mini-tts
POST
https://az.gptplus5.com/v1/audio/speech
官方文档:https://platform.openai.com/docs/guides/text-to-speech
请求参数
Authorization
在 Header 添加参数Authorization,其值为在 Bearer 之后拼接 Token
示例:Authorization: Bearer ********************
Body 参数 (application/json)
| 参数名 | 类型 | 必需 | 说明 |
|---|---|---|---|
model | string | 必需 | 可用的 TTS 模型之一:tts-1 或 tts-1-hd |
input | string | 必需 | 要生成音频的文本。最大长度为4096个字符。 |
voice | string | 必需 | 生成音频时使用的语音。支持的语音有:alloy、echo、fable、onyx、nova 和 shimmer。 |
response_format | string | 可选 | 默认为 mp3 音频的格式。支持的格式有:mp3、opus、aac 和 flac。 |
speed | number | 可选 | 默认为 1 生成的音频速度。选择0.25到4.0之间的值。1.0是默认值。 |
请求示例
json
{
"model": "gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy"
}cURL 示例
bash
curl --location --request POST 'https://az.gptplus5.com/v1/audio/speech' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy"
}'返回响应
🟢200成功
响应示例
json
{}