Skip to main content
POST
/
v1
/
responses
Responses API
curl --request POST \
  --url https://api.chenyu.cn/v1/responses \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "input": {},
  "stream": true,
  "temperature": 123,
  "max_output_tokens": 123,
  "reasoning": {}
}
'
{
  "id": "<string>",
  "object": "<string>",
  "status": "<string>",
  "model": "<string>",
  "output": [
    {}
  ],
  "usage": {}
}

Responses API

使用 OpenAI Responses 兼容格式调用文本模型。适合使用 input 组织请求,或需要携带模型专属参数的场景。

请求参数

model
string
required
模型 ID。可通过 模型列表 查询
input
string | array
required
输入内容。可以是字符串,也可以是 Responses 格式的输入数组
stream
boolean
是否使用流式响应
temperature
number
采样温度
max_output_tokens
integer
最大输出 token 数
reasoning
object
推理相关参数,具体支持范围以模型为准

响应参数

id
string
响应 ID
object
string
响应类型,通常为 response
status
string
响应状态,如 completed
model
string
实际调用的模型 ID
output
array
输出内容数组
usage
object
token 用量

代码示例

import requests

url = "https://api.chenyu.cn/v1/responses"
headers = {
    "Authorization": "Bearer your_api_key",
    "Content-Type": "application/json"
}
payload = {
    "model": "doubao-seed-2-0-lite-260428",
    "input": "用三句话说明 GPU 云服务适合哪些场景"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())

模型专属参数

{
  "model": "doubao-seed-2-0-lite-260428",
  "input": "分析这个问题",
  "thinking": {"type": "enabled"},
  "reasoning": {"effort": "low"}
}

响应示例

{
  "id": "resp_xxx",
  "object": "response",
  "status": "completed",
  "model": "doubao-seed-2-0-lite-260428",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "GPU 云服务适合模型训练、推理部署和批量数据处理。"
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 18,
    "output_tokens": 16,
    "total_tokens": 34
  }
}