Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
介面 / OpenAI-compatible

Responses API

POST/v1/responses

Responses 適合 reasoning 模型、多模態輸入和 Lazu file_id 解引用。上傳檔案或使用較新的 OpenAI response 特性時,優先使用這個 endpoint。

何時使用

使用 Responses

上傳檔案、reasoning 控制、文件 workflow,以及需要服務端標準化的多模態輸入。

使用 Chat completions

簡單聊天、SDK 相容、tool calling,以及已經圍繞 /v1/chat/completions 建構的應用。

請求 Body

modelstring
required

來自 /api/models/catalog 的模型 ID。優先選擇 supported_endpoint_types 包含 responses 的模型。

inputstring | object[]
required

文字輸入,或 response input messages 陣列。

instructionsstring
nullable

response 的系統級 instructions。

reasoningobject
nullable

支援 reasoning 的模型可使用 effort 控制,例如 {"effort":"medium"}

toolsobject[]
nullable

OpenAI-compatible Responses shape 的工具定義。

streamboolean
nullable

當模型支援時,返回 response events stream。

max_output_tokensinteger
nullable

生成輸出 token 的上限。

File 解引用

先透過 Files 上傳檔案,再引用返回的

file_id。如果請求中發生了解引用,Lazu 會加入 X-Lazu-File-Dereference: 1

限制:

  • 單檔案仍受 purpose 對應大小限制。
  • 單次 Responses 呼叫中解引用的檔案總大小必須低於 64 MB。
  • Chat completions 不會自動解引用 file_id

響應

idstring

Response ID。

outputobject[]

輸出訊息、reasoning items、tool calls 或其它 response events。

usage.input_tokensinteger
nullable

上游返回 usage 時的輸入 token 數。

usage.output_tokensinteger
nullable

上游返回 usage 時的輸出 token 數。

usage.input_tokens_details.cached_tokensinteger
nullable

支援 response-level cache usage 的 provider 返回的 cache read tokens。

完整對帳請使用同一把 API Key 呼叫:

GET /api/usage/requests/{request_id}

相關頁面