跳转至

Responses格式

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

OpenAPI 摘要

Responses格式

项目
方法 POST
路径 /v1/responses
Operation ID createresponse
标签 聊天(Chat)/原生OpenAI格式

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

认证

名称 类型 方案 说明
BearerAuth http bearer 使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx

请求体

必填: 是

application/json
字段 类型 必填 说明
model string
input oneOf(string, array) 输入内容,可以是字符串或消息数组
instructions string
max_output_tokens integer
temperature number
top_p number
stream boolean
tools array
tool_choice oneOf(string, object)
reasoning object
reasoning.effort string 可选值: low, medium, high
reasoning.summary string
previous_response_id string
truncation string 可选值: auto, disabled

调用案例

curl -X POST "https://你的newapi服务器地址/v1/responses" \
  -H "Authorization: Bearer $NEWAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-4o"
}'

成功响应示例

{
  "id": "task_123456",
  "object": "response",
  "created_at": 1,
  "status": "completed",
  "model": "gpt-4o",
  "output": [
    {
      "type": "string",
      "id": "task_123456",
      "status": "string",
      "role": "assistant",
      "content": "你好,请介绍一下 New API。"
    }
  ]
}

响应

HTTP 200

成功创建响应

application/json
字段 类型 必填 说明
id string
object string 示例: response
created_at integer
status string 可选值: completed, failed, in_progress, incomplete
model string
output array
output[].type string
output[].id string
output[].status string
output[].role string
output[].content array
output[].content[].type string
output[].content[].text string
usage object
usage.prompt_tokens integer 提示词 Token 数
usage.completion_tokens integer 补全 Token 数
usage.total_tokens integer 总 Token 数
usage.prompt_tokens_details object
usage.prompt_tokens_details.cached_tokens integer
usage.prompt_tokens_details.text_tokens integer
usage.prompt_tokens_details.audio_tokens integer
usage.prompt_tokens_details.image_tokens integer
usage.completion_tokens_details object
usage.completion_tokens_details.text_tokens integer
usage.completion_tokens_details.audio_tokens integer
usage.completion_tokens_details.reasoning_tokens integer

OpenAPI 源文件

openapi/generated/ai-model/聊天(Chat)/原生OpenAI格式/post-v1-responses-createresponse-383826475.json