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 的上限。

Content parts

input_textcontent part

发送给模型的文本内容。

input_imagecontent part

图片内容。Lazu 可以解引用 purpose 为 vision 的上传文件。

input_filecontent part

上传文件引用。Lazu 会在服务端读取文件内容后再转发给上游。

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}

相关页面