Skip to content
POST/v1/responses

Responses

第一版实现聚焦 `model`、`input`、`instructions`、`tools`、`tool_choice`、`stream`、`temperature`、`top_p` 等核心字段。

基础信息

鉴权Authorization: Bearer sk-...
请求类型application/json
响应类型application/json 或 text/event-stream

请求参数

Body

字段
类型
必填
位置
说明
model
string
body
平台统一模型 ID。
示例:"gpt-4o"
input
array<object>
body
输入内容,可为文本、多模态片段等结构。
示例:[{"role":"user","content":[{"type":"input_text","text":"总结一下接入步骤"}]}]
role
string
body
输入消息角色。
示例:"user"
content
array<object>
body
输入内容片段数组。
instructions
string
body
系统级指令。
示例:"使用简洁中文回答。"
tools
array<object>
body
函数工具定义数组。
示例:[{"type":"function","name":"lookupDoc"}]
type
string
body
工具类型。
示例:"function"
name
string
body
工具名称。
示例:"lookupDoc"
tool_choice
object
body
工具调用策略。
示例:{"type":"auto"}
type
string
body
auto / required / none。
示例:"auto"
name
string
body
指定工具时填写工具名称。
示例:"lookupDoc"
stream
boolean
body
是否使用流式返回。
示例:false
temperature
number
body
采样温度。
示例:0.5
top_p
number
body
Top-p 采样。
示例:1

请求示例

json
{
  "model": "gpt-4o",
  "instructions": "使用简洁中文回答。",
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "总结一下接入步骤"
        }
      ]
    }
  ],
  "stream": false
}

响应示例

json
{
  "id": "resp_123",
  "object": "response",
  "model": "gpt-4o",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "先配置 Base URL,再填入 API Key,最后按统一协议发起请求。"
        }
      ]
    }
  ]
}

错误码

HTTPcode说明
400invalid_request_error请求体结构不合法、缺少必填参数,或 JSON 无法解析。
401invalid_auth_header缺少或传错鉴权头,网关无法识别当前调用身份。
403model_not_allowed当前 API Key 没有访问该模型的权限。
402insufficient_balance余额不足,平台在调用前预检时已拒绝请求。
503model_not_available当前模型没有可用路由或上游渠道不可用。

在线调试

Playground · 浏览器直连网关

Responses

兼容 OpenAI Responses API 的核心字段,适合统一多模态与工具调用场景。

json
尚未发起请求。
bash
curl --location --request POST 'https://api.harnmodel.com/v1/responses' \
  --header 'Authorization: Bearer sk-xxx' \
  --header 'Content-Type: application/json' \
  --data '{}'

多语言示例

bash
curl --location --request POST 'https://api.harnmodel.com/v1/responses' \
  --header 'Authorization: Bearer sk-xxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-4o",
    "instructions": "使用简洁中文回答。",
    "input": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_text",
            "text": "总结一下接入步骤"
          }
        ]
      }
    ],
    "stream": false
  }'

千云开发者中心仅维护中文第一版文档;接口口径以当前后端实现为准。