创建模型响应 gpt-5启用思考

POST /v1/responses

MethodPOST
Path/v1/responses
Typehttp
Status1
Module2102810
Folder62503105

说明

https://platform.openai.com/docs/api-reference/responses/create 部分OpenAI模型仅支持Response格式,例如o3-pro,codex-mini-latest

概览

MethodPOST
Path/v1/responses
Typehttp
Status1
Module2102810
Folder62503105

参数

{
  "query": [],
  "path": [],
  "cookie": [],
  "header": [
    {
      "id": "NQs7bxnpZf",
      "name": "Content-Type",
      "required": true,
      "description": "",
      "type": "string",
      "enable": true,
      "sampleValue": "application/json"
    },
    {
      "id": "qb8tEQbCty",
      "name": "Accept",
      "required": true,
      "description": "",
      "type": "string",
      "enable": true,
      "sampleValue": "application/json"
    },
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "gBxcCbXhsa",
      "enable": true,
      "name": "Authorization",
      "sampleValue": "Bearer {{YOUR_API_KEY}}"
    }
  ]
}

请求体

{
  "type": "application/json",
  "parameters": [],
  "jsonSchema": {
    "type": "object",
    "properties": {
      "model": {
        "type": "string",
        "description": "要使用的模型的 ID。有关哪些模型可与聊天 API 一起使用的详细信息,请参阅模型端点兼容性表。"
      },
      "input": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "role": {
              "type": "string"
            },
            "content": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "x-apifox-orders": [
                  "type",
                  "text"
                ]
              }
            }
          },
          "x-apifox-orders": [
            "role",
            "content"
          ],
          "required": [
            "content",
            "role"
          ]
        },
        "description": "模型的文本、图像,用于生成响应。"
      },
      "tools": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "模型可以调用的一组工具列表。目前,只支持作为工具的函数。使用此功能来提供模型可以为之生成 JSON 输入的函数列表。"
      },
      "text": {
        "type": "object",
        "properties": {
          "format": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "description": "定义的响应格式类型。始终为text。"
              }
            },
            "required": [
              "type"
            ],
            "x-apifox-orders": [
              "type"
            ],
            "description": "指定模型必须输出的格式。"
          },
          "verbosity": {
            "type": "string",
            "description": "限制模型响应的详细程度。较低的值为更简洁的响应,而较高的值会有更详细的响应。目前支持的值为low、medium和high。默认为medium"
          }
        },
        "x-apifox-orders": [
          "format",
          "verbosity"
        ],
        "description": "用于模型文本响应的配置选项。可以是纯文本或结构化 JSON 数据。"
      },
      "reasoning": {
        "type": "object",
        "properties": {
          "effort": {
            "type": "string",
            "description": "当前支持的值有minimal、low、medium和high。减少推理工作量可以加快响应速度,并减少响应中用于推理的标记。默认为medium"
          },
          "summary": {
            "type": "string",
            "description": "模型执行的推理的摘要。这对于调试和理解模型的推理过程很有用。auto、concise或之一detailed。"
          }
        },
        "x-apifox-orders": [
          "effort",
          "summary"
        ]
      },
      "stream": {
        "type": "boolean",
        "description": "默认为 false  如果设置,则像在 ChatGPT 中一样会发送部分消息增量。标记将以仅数据的服务器发送事件的形式发送,这些事件在可用时,并在 data: [DONE] 消息终止流。Python 代码示例。"
      },
      "store": {
        "type": "boolean",
        "description": "是否存储生成的模型响应以供以后通过 API 检索。默认为true"
      }
    },
    "x-apifox-orders": [
      "model",
      "input",
      "tools",
      "text",
      "reasoning",
      "stream",
      "store"
    ]
  },
  "mediaType": "",
  "examples": [
    {
      "value": "{\n    \"model\": \"gpt-5-2025-08-07\",\n    \"input\": [\n        {\n            \"role\": \"user\",\n            \"content\": [\n                {\n                    \"type\": \"input_text\",\n                    \"text\": \"1+2+3+4+5....9985\"\n                }\n            ]\n        }\n    ],\n    \"tools\": [],\n    \"text\": {\n        \"format\": {\n            \"type\": \"text\"\n        },\n        \"verbosity\": \"medium\"\n    },\n    \"reasoning\": {\n        \"effort\": \"medium\",\n        \"summary\": \"auto\"\n    },\n    \"stream\": true,\n    \"store\": true\n}",
      "mediaType": "application/json"
    }
  ],
  "oasExtensions": ""
}

响应

[
  {
    "id": 740626503,
    "name": "OK",
    "code": 200,
    "contentType": "json",
    "jsonSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "created": {
          "type": "integer"
        },
        "choices": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "index": {
                "type": "integer"
              },
              "message": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string"
                  },
                  "content": {
                    "type": "string"
                  }
                },
                "required": [
                  "role",
                  "content"
                ],
                "x-apifox-orders": [
                  "role",
                  "content"
                ]
              },
              "finish_reason": {
                "type": "string"
              }
            },
            "x-apifox-orders": [
              "index",
              "message",
              "finish_reason"
            ]
          }
        },
        "usage": {
          "type": "object",
          "properties": {
            "prompt_tokens": {
              "type": "integer"
            },
            "completion_tokens": {
              "type": "integer"
            },
            "total_tokens": {
              "type": "integer"
            }
          },
          "required": [
            "prompt_tokens",
            "completion_tokens",
            "total_tokens"
          ],
          "x-apifox-orders": [
            "prompt_tokens",
            "completion_tokens",
            "total_tokens"
          ]
        }
      },
      "required": [
        "id",
        "object",
        "created",
        "choices",
        "usage"
      ],
      "x-apifox-orders": [
        "id",
        "object",
        "created",
        "choices",
        "usage"
      ]
    },
    "itemSchema": {},
    "description": "",
    "mediaType": "",
    "headers": [],
    "oasExtensions": ""
  }
]

响应示例

[
  {
    "name": "OK",
    "responseId": 740626503,
    "data": "{\n    \"id\": \"chatcmpl-123\",\n    \"object\": \"chat.completion\",\n    \"created\": 1677652288,\n    \"choices\": [\n        {\n            \"index\": 0,\n            \"message\": {\n                \"role\": \"assistant\",\n                \"content\": \"\\n\\nHello there, how may I assist you today?\"\n            },\n            \"finish_reason\": \"stop\"\n        }\n    ],\n    \"usage\": {\n        \"prompt_tokens\": 9,\n        \"completion_tokens\": 12,\n        \"total_tokens\": 21\n    }\n}",
    "description": "",
    "oasKey": "",
    "oasExtensions": "",
    "id": 652577738
  }
]