Skip to content

Responses格式 ​

Responses格式 ​

POST /v1/responses

OpenAI Responses API,用于创建模型响应。 支持多轮对话、工具调用、推理等功能。

请求头 (Headers) ​

参数名类型必选描述示例
Authorizationstring否鉴权令牌Bearer ********************

请求体 (Request Body) ​

Content-Type: application/json

字段类型必选描述
modelstring是
inputany否输入内容,可以是字符串或消息数组
instructionsstring否
max_output_tokensinteger否
temperaturenumber否
top_pnumber否
streamboolean否
toolsarray of object否
tool_choiceany否
reasoningobject否
reasoning.effortstring否
reasoning.summarystring否
previous_response_idstring否
truncationstring否

请求体示例 ​

json
{
  "model": "string",
  "input": null,
  "instructions": "string",
  "max_output_tokens": 0,
  "temperature": 0,
  "top_p": 0,
  "stream": true,
  "tools": [
    {}
  ],
  "tool_choice": null,
  "reasoning": {
    "effort": "string",
    "summary": "string"
  },
  "previous_response_id": "string",
  "truncation": "string"
}

返回响应 (Responses) ​

200 - 成功创建响应 ​

字段类型描述
idstring
objectstring
created_atinteger
statusstring
modelstring
outputarray of object
output[].typestring
output[].idstring
output[].statusstring
output[].rolestring
output[].contentarray of object
output[].content[].typestring
output[].content[].textstring
usageany

响应示例 ​

json
{
  "id": "string",
  "object": "response",
  "created_at": 0,
  "status": "string",
  "model": "string",
  "output": [
    {
      "type": "string",
      "id": "string",
      "status": "string",
      "role": "string",
      "content": [
        {
          "type": "string",
          "text": "string"
        }
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "text_tokens": 0,
      "audio_tokens": 0,
      "image_tokens": 0
    },
    "completion_tokens_details": {
      "text_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0
    }
  }
}

Released under the MIT License.