Responses API

面向智能体场景的 Responses 接口,用 input 统一承载文本、图像等多项输入,兼容 OpenAI Responses 协议。

基本信息

方法POST 端点https://koprouter.kopglobal.com/v1/responses 鉴权Authorization: Bearer sk-...

请求参数

参数 类型 必填 说明
model string 是 要调用的模型 ID
input string/array 是 输入内容,可为字符串或消息/内容数组
instructions string 否 系统指令
temperature number 否 采样温度
max_output_tokens number 否 最大输出 token 数
stream boolean 否 是否流式返回
tools array 否 工具定义列表
tool_choice string/object 否 工具调用策略

请求示例

curl https://koprouter.kopglobal.com/v1/responses \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "instructions": "You are a helpful assistant.",
    "input": "帮我总结这段内容。"
  }'

响应示例

{
  "id": "resp_abc123",
  "object": "response",
  "created_at": 1720000000,
  "model": "MODEL_ID",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        { "type": "output_text", "text": "这是一段总结。", "annotations": [] }
      ]
    }
  ],
  "usage": {
    "input_tokens": 20,
    "output_tokens": 15,
    "total_tokens": 35
  }
}
Responses 接口天然支持多模态输入,`input` 数组里可同时放入文本与图片内容块。