跳轉到主要內容
The Responses API is OpenAI’s newer stateful conversation API. LemonData supports this format as an advanced optional path for compatible models; use POST /v1/chat/completions as the default OpenAI-compatible route unless you explicitly need Responses-specific behavior.

請求主體

model
string
必填
要使用的模型 ID。請參見 Models 以了解可用選項。
input
array
必填
由對話組成的輸入項目清單。每個項目可以是:
  • message: 含有 role 與 content 的對話訊息
  • function_call: 一個函式呼叫請求
  • function_call_output: 函式呼叫的輸出
對於多模態輸入,message.content 可以是純字串或內容區塊的陣列。對於支援影像的模型(例如 GPT-5.4 變體),請將影像作為 input_image 區塊傳遞,而非將 URL 或 Base64 字串直接嵌入純文字中。Example content blocks:
  • { "type": "input_text", "text": "Describe this image" }
  • { "type": "input_image", "image_url": "https://example.com/image.jpg" }
  • { "type": "input_image", "image_url": "data:image/png;base64,..." }
instructions
string
提供給模型的系統指示(等同於 system message)。
max_output_tokens
integer
可生成的最大 token 數。
temperature
number
預設值:"1"
抽樣溫度,範圍 0 到 2。
tools
array
模型可能呼叫的工具清單。
stream
boolean
預設值:"false"
若為 true,則回傳事件串流。
previous_response_id
string
先前回應的 ID,用於從該回應延續對話。
store
boolean
預設值:"true"
是否儲存回應以便日後擷取。
metadata
object
附加至回應的 metadata 以供追蹤使用。
text
object
文字生成的設定選項。text.format 的行為取決於所選模型與路由路徑;各模型之間不保證一致。
parallel_tool_calls
boolean
預設值:"true"
是否允許多個工具並行呼叫。
top_p
number
Nucleus 抽樣參數(0-1)。
reasoning
object
針對支援推理的模型(例如 GPT-5 系列變體)的推理設定。
  • effort (string): 推理努力等級(low, medium, high

回應

id
string
回應的唯一識別碼。
object
string
恆為 response
created
integer
回應建立的 Unix 時間戳。
output
array
模型產生的輸出項目清單。
usage
object
Token 使用統計。
curl -X POST "https://api.lemondata.cc/v1/responses" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "input": [
      {"type": "message", "role": "user", "content": "Hello!"}
    ],
    "max_output_tokens": 1000
  }'
{
  "id": "resp_abc123",
  "object": "response",
  "created": 1706000000,
  "model": "gpt-4o",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {"type": "text", "text": "Hello! How can I help you today?"}
      ]
    }
  ],
  "usage": {
    "input_tokens": 10,
    "output_tokens": 12,
    "total_tokens": 22
  }
}