GPT-4o-audio

POST /v1/chat/completions

MethodPOST
Path/v1/chat/completions
Typehttp
Status1
Module2102810
Folder45008043

说明

概览

MethodPOST
Path/v1/chat/completions
Typehttp
Status1
Module2102810
Folder45008043

参数

{
  "header": [
    {
      "name": "Content-Type",
      "required": true,
      "description": "",
      "id": "d8C1kG4I6c",
      "type": "string",
      "enable": true,
      "sampleValue": "application/json"
    },
    {
      "name": "Authorization",
      "required": true,
      "description": "",
      "id": "Ev17NGSTaX",
      "type": "string",
      "enable": true,
      "sampleValue": "Bearer $OPENAI_API_KEY"
    }
  ]
}

请求体

{
  "type": "application/json",
  "parameters": [],
  "jsonSchema": {
    "type": "object",
    "properties": {
      "model": {
        "type": "string",
        "description": "要使用的模型 ID。"
      },
      "modalities": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "模型生成的输出类型。默认设置:[\"text\"]。要请求此模型生成文本和音频响应,您可以使用:[\"text\", \"audio\"]。"
      },
      "audio": {
        "type": "object",
        "properties": {
          "voice": {
            "type": "string",
            "description": "模型用于响应支持的语音有alloy, ash, ballad, coral, echo, fable, nova, onyx, sage,或者 shimmer。"
          },
          "format": {
            "type": "string",
            "description": "指定输出音频格式必须是wav, mp3, flac, opus, 或者 pcm16。"
          }
        },
        "required": [
          "voice",
          "format"
        ],
        "x-apifox-orders": [
          "voice",
          "format"
        ],
        "description": "音频输出参数。"
      },
      "messages": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "role": {
              "type": "string"
            },
            "content": {
              "type": "string",
              "description": "消息内容。"
            }
          },
          "x-apifox-orders": [
            "role",
            "content"
          ],
          "required": [
            "role",
            "content"
          ]
        },
        "description": "构成当前对话的消息列表。"
      }
    },
    "required": [
      "model",
      "messages"
    ],
    "x-apifox-orders": [
      "model",
      "modalities",
      "audio",
      "messages"
    ]
  },
  "mediaType": "",
  "examples": [
    {
      "value": "{\n      \"model\": \"gpt-4o-audio-preview\",\n      \"modalities\": [\"text\", \"audio\"],\n      \"audio\": { \"voice\": \"alloy\", \"format\": \"wav\" },\n      \"messages\": [\n        {\n          \"role\": \"user\",\n          \"content\": \"Is a golden retriever a good family dog?\"\n        }\n      ]\n    }",
      "mediaType": "application/json",
      "description": ""
    }
  ],
  "oasExtensions": ""
}

响应

[
  {
    "id": 609639810,
    "name": "成功",
    "code": 200,
    "contentType": "json",
    "jsonSchema": {
      "type": "object",
      "properties": {}
    },
    "itemSchema": {},
    "description": "",
    "mediaType": "",
    "headers": [],
    "oasExtensions": ""
  }
]