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 模型互動的建議方式。它原生支援工具使用、結構化輸出和推理設定。