主题
GPT-4o-audio
POST
https://az.gptplus5.com/v1/chat/completions
官方文档:https://platform.openai.com/docs/api-reference/chat/create
请求参数
Authorization
在 Header 添加参数Authorization,其值为在 Bearer 之后拼接 Token
示例:Authorization: Bearer ********************
Header 参数
| 参数名 | 类型 | 必需 | 说明 | 示例 |
|---|---|---|---|---|
Content-Type | string | 必需 | application/json | |
Authorization | string | 必需 | Bearer $OPENAI_API_KEY |
Body 参数 (application/json)
| 参数名 | 类型 | 必需 | 说明 |
|---|---|---|---|
model | string | 必需 | 要使用的模型 ID。 |
modalities | array[string] | 可选 | 模型生成的输出类型。默认设置:["text"]。要请求此模型生成文本和音频响应,您可以使用:["text", "audio"]。 |
audio | object | 可选 | |
└ voice | string | 必需 | 模型用于响应支持的语音有alloy, ash, ballad, coral, echo, fable, nova, onyx, sage,或者 shimmer。 |
└ format | string | 必需 | 指定输出音频格式必须是wav, mp3, flac, opus, 或者 pcm16。 |
messages | array[object] | 必需 | 构成当前对话的消息列表。 |
└ role | string | 必需 | |
└ content | string | 必需 |
请求示例
json
{
"model": "gpt-4o-audio-preview",
"modalities": ["text", "audio"],
"audio": { "voice": "alloy", "format": "wav" },
"messages": [
{
"role": "user",
"content": "Is a golden retriever a good family dog?"
}
]
}cURL 示例
bash
curl --location --request POST 'https://az.gptplus5.com/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-4o-audio-preview",
"modalities": ["text", "audio"],
"audio": { "voice": "alloy", "format": "wav" },
"messages": [
{
"role": "user",
"content": "Is a golden retriever a good family dog?"
}
]
}'返回响应
🟢200成功
响应示例
json
{}