POST
/
v1
/
responses
curl --request POST \
  --url https://vip.xmsmartlink.com/v1/responses \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-4.1",
  "instructions": "You are a concise assistant.",
  "input": "Explain what server-sent events are in one sentence."
}
'
{
  "id": "resp_xxx",
  "object": "response",
  "status": "completed",
  "model": "gpt-4.1",
  "output": [
    {
      "id": "msg_xxx",
      "type": "message",
      "role": "assistant",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "text": "反向代理先接收客户端请求,再转发给后端服务,并将结果统一返回给客户端。"
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 18,
    "output_tokens": 17,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 35
  }
}

Authorizations

Authorization
string
header
required

使用 Authorization: Bearer <YOUR_API_KEY> 进行认证。

Body

application/json
model
string
required

支持 Responses 的模型名称,示例里请替换成控制台已启用的模型。

Example:

"gpt-4.1"

input

用户输入。字符串等价于单条文本输入;数组可携带 developer/user/assistant 等角色消息。

instructions
string

当前请求级别的高优先级指令,适合临时 system/developer 提示。

previous_response_id
string

基于上一轮 response 继续生成,不要与 conversation 同时使用。

conversation

绑定到 OpenAI 风格的 conversation 对象。

reasoning
object

推理模型配置,常见字段为 effort 与 summary。

text
object

文本输出配置;结构化输出可使用 json_schema。

tools
object[]

Responses API 格式的工具定义。

tool_choice

工具选择策略,如 auto、required 或指定工具。

parallel_tool_calls
boolean

是否允许模型并行执行工具调用。

max_output_tokens
integer

最大输出 token 上限。

max_tool_calls
integer

本次 response 允许的最大工具调用次数。

stream
boolean

是否启用 SSE 流式返回。

stream_options
object

流式选项;官方 Responses 协议下应按 Responses 事件流字段理解。

metadata
object

用户自定义元数据。

store
boolean

是否允许上游存储本次 response。

truncation

Responses API 定义的上下文截断策略。

prompt
object

OpenAI prompt 模板引用。

Response

Responses API 响应结果。stream=true 时返回 text/event-stream,并使用 Responses 类型事件。

id
string
Example:

"resp_xxx"

object
string
Example:

"response"

status
string
Example:

"completed"

model
string
Example:

"gpt-4.1"

output
object[]
usage
object

本次响应的 token 用量。