Responses API
POST /v1/responses
兼容 OpenAI Responses API。支持结构化输入项、工具使用和内置推理。gateway 透明地代理到上游提供商。
请求体
| 参数 | 类型 | 说明 |
|---|---|---|
model* | string | 要使用的模型 ID(例如 gpt-5.4、gpt-5.4-mini)。 |
input* | string | array | 文本字符串或输入项数组(带有 role 和 content 的消息对象)。 |
stream | boolean | 若为 true,则返回 SSE 事件流。默认:false。 |
temperature | number | 采样温度 0–2。默认:1。 |
max_output_tokens | integer | 响应中生成的最大 token 数。 |
tools | array | 模型可以调用的工具定义列表。 |
reasoning | object | 针对 o 系列模型的推理配置(例如 { "effort": "high" })。 |
示例请求
POST /v1/responses
Authorization: Bearer YOUR_API_KEY
{
"model": "gpt-5.4-mini",
"input": "What is the capital of France?",
"max_output_tokens": 256
} 示例响应
{
"id": "resp_abc123",
"object": "response",
"created_at": 1714000000,
"model": "gpt-5.4-mini",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{ "type": "output_text", "text": "The capital of France is Paris." }
]
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 9,
"total_tokens": 21
}
} ℹ
Responses API 是与 OpenAI 模型交互的推荐方式。它原生支持工具使用、结构化输出和推理配置。