Responses API
OpenAI 的 Responses 格式。用 input 传内容、用 previous_response_id 串联多轮,适合需要工具调用与推理控制的场景。
POST https://open.feiyutoken.com/v1/responses
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model |
string | 是 | 模型名。可用值见模型列表 |
input |
string | array | 条件必填 | 输入内容,可以是字符串,也可以是消息数组。首轮必填;用 previous_response_id 续接时可以只传新输入 |
instructions |
string | 否 | 系统级指令,作用相当于对话接口里的 system 消息 |
max_output_tokens |
integer | 否 | 本次输出的长度上限 |
temperature |
number | 否 | 采样温度 |
top_p |
number | 否 | 核采样 |
stream |
boolean | 否 | true 时走流式输出 |
tools |
array | 否 | 工具调用定义 |
tool_choice |
string | object | 否 | 工具选择策略 |
reasoning |
object | 否 | 推理配置。effort 取 low / medium / high,summary 控制推理摘要 |
previous_response_id |
string | 否 | 上一轮响应的 id。传了它就不必把历史消息整段回传 |
truncation |
string | 否 | 上下文超长时的处理方式,取 auto 或 disabled |
其余标准参数按原样透传。
请求示例
curl https://open.feiyutoken.com/v1/responses \
-H "Authorization: Bearer <你的飞鱼Token API Key>" \
-H "Content-Type: application/json" \
-d '{
"model": "<模型名>",
"instructions": "你是一个简洁的助手。",
"input": "用一句话解释什么是 API 网关。",
"max_output_tokens": 256
}'
响应
{
"id": "resp-...",
"object": "response",
"created_at": 1770000000,
"status": "completed",
"model": "<模型名>",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{ "type": "output_text", "text": "..." }
]
}
],
"usage": {
"prompt_tokens": 32,
"completion_tokens": 48,
"total_tokens": 80
}
}
文本要从 output[].content[].text 取,不是对话接口那个 choices[].message.content;
status 取 completed / failed / in_progress / incomplete。
和对话接口的区别
| 对比项 | /v1/responses |
/v1/chat/completions |
|---|---|---|
| 输入 | input + instructions |
messages 数组 |
| 长度上限 | max_output_tokens |
max_tokens |
| 多轮 | 用 previous_response_id 串联,不必回传历史 |
每次把完整 messages 传上来 |
| 推理控制 | reasoning(effort / summary) |
reasoning_effort(值域与 Responses 不同) |
| 输出结构 | output[],文本在 output[].content[].text |
choices[].message.content |
已经按 Responses 格式写的项目继续用这一套;用 Chat Completions 格式的项目用 Chat Completions API。两者的请求与 响应结构不通用,解析代码不要混着写。