> ## Documentation Index
> Fetch the complete documentation index at: https://evolink.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# GLM 全模型接口 - Responses 完整参数

> 使用 Responses 格式调用 GLM，支持文本对话、流式输出、函数调用，以及按型号提供的图像理解和联网搜索能力。具体参数与模型差异见下方说明。

<Note>
  **BaseURL 说明**：默认 BaseURL 为 `https://direct.evolink.ai`，对文本模型支持更好，支持长连接；`https://api.evolink.ai` 为备用地址。
</Note>

通过 Responses 接口调用 GLM 系列模型，支持文本对话、流式输出、函数调用，以及按型号提供的图像理解和联网搜索能力。

## 模型与参数差异

| 模型               | 输入能力  | 思考档位                           |
| ---------------- | ----- | ------------------------------ |
| `glm-5.3`        | 文本    | `low` / `high` / `max`，兼容规则见下表 |
| `glm-5.3-flash`  | 文本、图像 | 同 `glm-5.3`                    |
| `glm-5.3-flashx` | 文本、图像 | 同 `glm-5.3`                    |
| `glm-5.2`        | 文本    | 不适用 5.3 系列的兼容规则                |

四个型号均可通过在 `input` 中携带历史消息实现多轮对话。

通过 `reasoning.effort` 设置推理强度，不要用顶层 `reasoning_effort` 或 `thinking` 替代。`glm-5.3`、`glm-5.3-flash` 与 `glm-5.3-flashx` 按以下规则处理：

| 传入值                    | 实际思考档位     |
| ---------------------- | ---------- |
| `low` / `high` / `max` | 保持对应档位     |
| `xhigh`                | `max`      |
| `medium`               | `high`     |
| `minimal` / `none`     | `low`，仍会思考 |

未识别的值保持原值，不提供兼容映射；请使用表中列出的值。

<Warning>
  **5.3 系列无法关闭思考。** `minimal` 与 `none` 按 `low` 处理，仍会产生思考 token，并按输出计费。

  `glm-5.2` 传入 `none` 仍可能产生推理 token，不能通过该值确保关闭思考。所有型号的推理 token 都包含在输出用量中。
</Warning>

## 系统提示词与多轮对话

系统提示词推荐放在 `input` 数组的 `role="system"` 消息中。`glm-5.3-flash` 的顶层 `instructions` 可用于字符串输入；使用消息数组时，请改用系统消息。

```json theme={null}
{
  "model": "glm-5.3-flash",
  "input": [
    {"role": "system", "content": "请用简洁的中文回答。"},
    {"role": "user", "content": "记住暗号是 RED-583。"},
    {"role": "assistant", "content": "已记住。"},
    {"role": "user", "content": "暗号是什么？只回复暗号。"}
  ],
  "reasoning": {"effort": "low"},
  "max_output_tokens": 1024
}
```

`glm-5.3-flash` 与 `glm-5.3-flashx` 支持通过响应 ID 续聊：首轮传 `store=true`，次轮把返回的顶层 `id` 原样填入 `previous_response_id`，保持相同模型并传入新问题。它不是 `output` 中某一项的 ID。

<Warning>
  **`glm-5.2` 不支持通过响应 ID 续聊。** 传入 `previous_response_id` 会返回 `400`，设置 `store=true` 不会开启此能力。需要跨型号使用时，省略 `previous_response_id`，每轮携带完整历史。
</Warning>

## 流式响应

设置 `stream=true` 后，按 SSE 事件逐条处理：

| 事件                                                                        | 处理方式                                           |
| ------------------------------------------------------------------------- | ---------------------------------------------- |
| `response.created` / `response.in_progress`                               | 本轮开始                                           |
| `response.output_text.delta`                                              | 将 `delta` 追加到正文                                |
| `response.reasoning_text.delta` / `response.reasoning_summary_text.delta` | 推理相关内容，和正文分开处理；客户端应兼容这两种事件形式                   |
| `response.output_item.done`                                               | 收集完整输出项，例如 `function_call`                     |
| `response.completed`                                                      | 本轮生成完成；读取 `response.output` 与 `response.usage` |
| `response.incomplete` / `response.failed` / `error`                       | 处理截断或错误，结束本轮                                   |

收到终态事件后即可结束读取，不要只等连接关闭或 Chat Completions 风格的 `[DONE]`。HTTP `200` 只表示流已建立，还要检查事件中的最终状态。工具调用轮次可能以 `response.completed` 结束，但仍需客户端执行函数并发起下一轮。

## 函数调用

在请求示例中选择“客户端函数调用”查看完整请求。Responses 的函数定义是平铺结构：

```json theme={null}
{
  "type": "function",
  "name": "get_temperature",
  "description": "返回指定城市温度",
  "parameters": {
    "type": "object",
    "properties": {"city": {"type": "string"}},
    "required": ["city"],
    "additionalProperties": false
  }
}
```

1. 遍历 `response.output`，找出所有 `type="function_call"` 项。
2. 解析并校验 `arguments` JSON 字符串，再由你的程序执行对应函数。
3. 将上一轮完整 `output` 追加到历史，再为每个调用追加 `function_call_output`，使用原始 `call_id` 与字符串形式的 `output`。
4. 把更新后的历史作为下一轮 `input`，继续请求。请求示例中的“回传函数执行结果”展示了这一结构。

<Note>
  **`parallel_tool_calls=false` 不能确保每轮只调用一个函数。** 客户端应处理本轮返回的全部函数调用，并在执行前校验参数。
</Note>

## 图像、搜索与 JSON 输出

* **图像理解**：仅 `glm-5.3-flash` 与 `glm-5.3-flashx` 支持。在用户消息的 `content` 中混排 `input_text` 与 `input_image`，通过 `image_url` 传入图片公网 URL 或 Base64 Data URL。`glm-5.3` 和 `glm-5.2` 不支持图像输入，请使用纯文本。
* **联网搜索**：声明 `tools: [{"type":"web_search"}]`。搜索由服务端执行，结果通过 `web_search_call` 和正文返回；是否调用搜索以实际输出项为准。实际搜索除 token 外可能产生按次费用，以模型定价为准。
* **JSON 输出**：使用 `text.format.type="json_object"`，在提示词中明确要求合法 JSON，并在客户端解析、校验。本接口暂不提供严格 JSON Schema 约束，不能依赖 `json_schema` 或 `strict=true` 确保输出符合指定结构。

搜索后续聊时，将上一轮完整 `output`（包括 `web_search_call` 和 `message`）追加到 `input`，再加入新问题。保留输出项的原始 `id`、`status`、`action` 等字段。搜索已由服务端执行，无需为 `web_search_call` 构造 `function_call_output`。请求示例 `web_search_history` 展示了这一结构。

## 响应与用量

正文位于 `output` 中 `type="message"` 项的 `content[type="output_text"].text`。响应可能包含顶层 `output_text`；为兼容该字段缺失的情况，仍应遍历 `output`。推理可能位于 `reasoning.content` 或 `reasoning.summary`，不要把它拼入正文。

* `usage.input_tokens` 包含缓存命中的输入；`input_tokens_details.cached_tokens` 是其中的子集。
* `usage.output_tokens` 包含推理 token；`output_tokens_details.reasoning_tokens` 是其中的子集，可能为 `0` 或缺失。
* 前缀缓存自动生效，无需额外 `cache_control`，命中量以本次返回的 `cached_tokens` 为准。
* `status="incomplete"` 且 `incomplete_details.reason="max_output_tokens"` 表示预算耗尽，可能只有推理、没有正文；请提高输出上限。


## OpenAPI

````yaml cn/api-manual/language-series/glm/responses/responses-reference.json POST /v1/responses
openapi: 3.1.0
info:
  title: GLM 全模型接口 - Responses 完整参数
  description: >-
    通过 OpenAI 兼容的 Responses 格式调用智谱 GLM 系列。支持
    glm-5.3、glm-5.3-flash、glm-5.3-flashx、glm-5.2；不同型号支持的可选能力有所不同。
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 生产环境（推荐）
  - url: https://api.evolink.ai
    description: 备用地址
security:
  - bearerAuth: []
tags:
  - name: Responses
    description: GLM Responses 接口
paths:
  /v1/responses:
    post:
      tags:
        - Responses
      summary: GLM Responses 对话接口（完整参数）
      description: >-
        使用 Responses 格式调用
        GLM，支持文本对话、流式输出、函数调用，以及按型号提供的图像理解和联网搜索能力。具体参数与模型差异见下方说明。
      operationId: createGLMResponse
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesRequest'
            examples:
              basic:
                summary: 基础文本对话
                value:
                  model: glm-5.3-flash
                  input: 请用一句话介绍你自己。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              system_message:
                summary: 系统提示词与消息数组
                value:
                  model: glm-5.3-flash
                  input:
                    - role: system
                      content: 请用简洁的中文回答。
                    - role: user
                      content: 什么是二分查找？
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              stream:
                summary: SSE 流式输出
                value:
                  model: glm-5.3-flash
                  input: 请用一句话介绍你自己。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  stream: true
              history:
                summary: 携带历史的多轮对话
                value:
                  model: glm-5.3-flash
                  input:
                    - role: user
                      content: 记住暗号是 RED-583
                    - role: assistant
                      content: 已记住
                    - role: user
                      content: 暗号是什么？只回复暗号。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              function:
                summary: 客户端函数调用
                value:
                  model: glm-5.3-flash
                  input: 请查询北京气温。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  tools:
                    - type: function
                      name: get_temperature
                      description: 返回指定城市温度
                      parameters:
                        type: object
                        properties:
                          city:
                            type: string
                        required:
                          - city
                        additionalProperties: false
                  tool_choice:
                    type: function
                    name: get_temperature
              function_result:
                summary: 回传函数执行结果
                description: 将示例 call_id 替换为上一轮模型实际返回的值，并保留上一轮完整 output。
                value:
                  model: glm-5.3-flash
                  input:
                    - role: user
                      content: 请查询北京气温。
                    - type: function_call
                      call_id: call_weather_demo
                      name: get_temperature
                      arguments: '{"city":"北京"}'
                    - type: function_call_output
                      call_id: call_weather_demo
                      output: '{"city":"北京","temperature":25}'
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  tools:
                    - type: function
                      name: get_temperature
                      description: 返回指定城市温度
                      parameters:
                        type: object
                        properties:
                          city:
                            type: string
                        required:
                          - city
                        additionalProperties: false
                  tool_choice: none
              web_search:
                summary: 服务端联网搜索
                value:
                  model: glm-5.3-flash
                  input: 请使用联网搜索查询 Python 官网首页标题，只回复标题和来源链接。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  tools:
                    - type: web_search
                  tool_choice: required
              web_search_history:
                summary: 搜索后的多轮对话
                description: >-
                  实际调用时，将示例中的 web_search_call 和 message 替换为上一轮返回的全部原始 output
                  项，再追加新问题。保留输出项的 id、status、action 等字段；无需为 web_search_call 构造
                  function_call_output。
                value:
                  model: glm-5.3-flash
                  input:
                    - role: user
                      content: 请使用联网搜索查询 Python 官网首页标题，只回复标题和来源链接。
                    - type: web_search_call
                      id: ws_search_demo
                      status: completed
                      action:
                        type: open_page
                        url: https://www.python.org
                    - type: message
                      id: msg_search_demo
                      status: completed
                      role: assistant
                      content:
                        - type: output_text
                          text: Welcome to Python.org — https://www.python.org
                          annotations: []
                    - role: user
                      content: 上一轮查到的官网标题是什么？只回复标题，不要再次搜索。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              json_object:
                summary: JSON 对象输出
                value:
                  model: glm-5.3-flash
                  input: 请只输出合法 JSON 对象，包含 city 字段，值为 Beijing。不要 Markdown。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  text:
                    format:
                      type: json_object
              image:
                summary: 图像理解（Flash 示例）
                description: 示例为一张红色 PNG 图片的 Data URL。
                value:
                  model: glm-5.3-flash
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  input:
                    - role: user
                      content:
                        - type: input_text
                          text: 图片是纯色。只回答这张图的颜色。
                        - type: input_image
                          image_url: >-
                            data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAABK0lEQVR4nO3RMQEAMAyAsLb+PW8y8hADHOybSEfraYDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANGOsDz+EB/5Uf+TQAAAAASUVORK5CYII=
              store:
                summary: 创建可引用响应（Flash）
                value:
                  model: glm-5.3-flash
                  input: 记住暗号是 BLUE-728，只回复已记住。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  store: true
              previous_response:
                summary: 引用上一轮响应（Flash）
                description: >-
                  先运行创建可引用响应的示例，再将 previous_response_id 设置为返回的顶层 id。glm-5.2
                  当前不支持此续聊方式。
                value:
                  model: glm-5.3-flash
                  input: 刚才的暗号是什么？只回复暗号。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  previous_response_id: 上一轮返回的响应 ID
              flashx:
                summary: 调用 GLM-5.3-FlashX
                value:
                  model: glm-5.3-flashx
                  input: 请用一句话介绍你自己。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              vision_flashx:
                summary: GLM-5.3-FlashX 图像输入
                value:
                  model: glm-5.3-flashx
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  input:
                    - role: user
                      content:
                        - type: input_text
                          text: 图片是纯色。只回答这张图的颜色。
                        - type: input_image
                          image_url: >-
                            data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAABK0lEQVR4nO3RMQEAMAyAsLb+PW8y8hADHOybSEfraYDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANGOsDz+EB/5Uf+TQAAAAASUVORK5CYII=
      responses:
        '200':
          description: 生成成功或返回不完整结果；检查 status。流式时返回 text/event-stream。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponsesResponse'
              example:
                id: response_demo
                object: response
                created_at: 1789971757
                model: glm-5.3-flash
                status: completed
                output:
                  - type: message
                    id: message_demo
                    status: completed
                    role: assistant
                    content:
                      - type: output_text
                        text: 你好，我是 GLM，可以帮你完成对话、写作和代码任务。
                        annotations: []
                usage:
                  input_tokens: 17
                  output_tokens: 24
                  total_tokens: 41
                  input_tokens_details:
                    cached_tokens: 0
                  output_tokens_details:
                    reasoning_tokens: 0
                error: null
            text/event-stream:
              schema:
                type: string
              example: >+
                event: response.output_text.delta

                data:
                {"type":"response.output_text.delta","item_id":"message_demo","output_index":0,"content_index":0,"delta":"你好"}


                event: response.completed

                data:
                {"type":"response.completed","response":{"id":"response_demo","object":"response","created_at":1789971757,"model":"glm-5.3-flash","status":"completed","output":[{"type":"message","id":"message_demo","status":"completed","role":"assistant","content":[{"type":"output_text","text":"你好","annotations":[]}]}],"usage":{"input_tokens":17,"output_tokens":3,"total_tokens":20},"error":null}}

        '400':
          description: 请求参数无效，例如缺少 input、推理参数格式错误，或所选模型不支持 previous_response_id。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: API Key 无效或已过期。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: 可用额度不足。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: 请求频率超限，请退避后重试。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务端错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: 服务暂时不可用，请稍后重试。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ResponsesRequest:
      type: object
      properties:
        model:
          type: string
          description: >-
            选择 GLM 模型。四个型号均支持本接口的文本调用。


            | 模型 ID | 输入能力 | 推理参数注意事项 |

            |---|---|---|

            | `glm-5.3` | 文本 | 实际思考档位为 `low` / `high` / `max`；支持兼容取值，见
            `reasoning`；不能关闭思考 |

            | `glm-5.3-flash` | 文本、图像 | 同上；图像使用 `input_image` 内容块 |

            | `glm-5.3-flashx` | 文本、图像 | 同 `glm-5.3`；图像使用 `input_image` 内容块 |

            | `glm-5.2` | 文本 | 传入 `none` 仍可能产生推理 token，不保证关闭思考 |


            不同模型支持的能力有所不同，请查看对应型号的说明。
          enum:
            - glm-5.3
            - glm-5.3-flash
            - glm-5.3-flashx
            - glm-5.2
          default: glm-5.3-flash
          example: glm-5.3-flash
        input:
          description: >-
            必填。纯文本字符串，或 Responses 输入项数组。数组支持消息、回传的模型输出项与
            function_call_output。多轮对话可在每次请求中携带完整历史；系统提示词推荐作为 role=system
            消息放在数组首项。图片使用 input_image，仅 glm-5.3-flash 与 glm-5.3-flashx 支持。不要使用
            Chat Completions 的 messages / image_url 内容块格式。
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/InputItem'
          example: 请用一句话介绍你自己。
        max_output_tokens:
          type: integer
          minimum: 1
          description: >-
            本次生成的输出 token 上限，包含推理 token。建议从 1024 起按任务调整。过小可能在思考阶段耗尽预算，只返回
            reasoning 项而没有正文；检查 status 和 incomplete_details。不要改写为 max_tokens。
          example: 1024
        stream:
          type: boolean
          default: false
          description: >-
            开启 SSE 流式返回。正文读取 response.output_text.delta 的 delta；成功终态为
            response.completed。遇到 response.incomplete、response.failed 或 error
            也应结束本轮并处理。不要只等待 [DONE] 或连接断开。
        reasoning:
          type: object
          properties:
            effort:
              type: string
              description: >-
                推理强度，建议使用 low。


                **`glm-5.3` / `glm-5.3-flash` / `glm-5.3-flashx` 的兼容规则**：


                | 传入值 | 实际思考档位 |

                |---|---|

                | `low` / `high` / `max` | 保持对应档位 |

                | `xhigh` | `max` |

                | `medium` | `high` |

                | `minimal` / `none` | `low`，仍会思考 |


                **`minimal` 与 `none` 不会关闭 5.3 系列的思考**，思考 token
                仍按输出计费。未识别的值保持原值，不提供兼容映射；请使用表中列出的值。`glm-5.2` 不适用上述兼容规则。


                glm-5.2 在本接口传入 none 仍可能产生推理 token，不能通过该值确保关闭思考。
              enum:
                - max
                - xhigh
                - high
                - medium
                - low
                - minimal
                - none
              example: low
          description: >-
            Responses 使用嵌套 reasoning.effort，而非顶层 reasoning_effort 或
            thinking。推理用量包含在 output_tokens 中；简单任务可能返回
            reasoning_tokens=0，这不代表支持关闭思考。
        instructions:
          type: string
          description: >-
            系统指令。glm-5.3-flash 可在 input 为字符串时使用此字段。input 为消息数组时，请将系统提示词放在数组首项的
            role=system 消息中。
        tools:
          type: array
          items:
            $ref: '#/components/schemas/Tool'
          description: >-
            支持客户端 function 工具和服务端 web_search。函数声明使用平铺的 name / description /
            parameters，不能嵌套成 Chat Completions 的 function 对象。function_call
            需要由你的程序执行并回传结果；web_search 由服务端执行，实际搜索除 token 外可能产生按次费用，以模型定价为准。
        tool_choice:
          description: >-
            auto：由模型选择；none：不调用工具；required：要求调用工具；指定函数可传
            {"type":"function","name":"get_temperature"}。并非所有模型与工具组合都保证支持相同的强制选择行为。
          oneOf:
            - type: string
              enum:
                - auto
                - none
                - required
            - type: object
              properties:
                type:
                  type: string
                  const: function
                name:
                  type: string
              required:
                - type
                - name
          example: auto
        parallel_tool_calls:
          type: boolean
          description: 是否允许一轮调用多个工具。设置 false 不能确保每轮只返回一个函数调用，客户端应遍历并处理全部 function_call。
        text:
          type: object
          properties:
            format:
              type: object
              properties:
                type:
                  type: string
                  description: >-
                    输出格式：text 为普通文本，json_object 为 JSON 对象。使用 json_object
                    时，请在提示词中明确要求合法 JSON，并在客户端解析和校验。暂不提供严格 JSON Schema 约束，不能依赖
                    json_schema 或 strict=true 确保输出符合指定结构。
                  enum:
                    - text
                    - json_object
                  example: json_object
              required:
                - type
          description: 输出格式。示例提供 json_object；HTTP 200 不等于返回内容满足 JSON Schema。
        store:
          type: boolean
          description: >-
            是否保存本次响应以便后续引用。glm-5.3-flash 与 glm-5.3-flashx 可配合 store=true 与
            previous_response_id 串联多轮对话。glm-5.2 不支持响应 ID 续聊，设置 store=true
            不会开启此能力；请在 input 中携带完整历史。
        previous_response_id:
          type: string
          description: >-
            上一轮响应的顶层 id，用于串联多轮对话。glm-5.3-flash 与 glm-5.3-flashx 支持此方式，请配合
            store=true 并保持相同模型。原样传入响应 id，不要使用 output 中某一项的 id。glm-5.2
            不支持此方式，传入该字段会返回 400。需要跨型号使用时，请省略此字段并在 input 中携带完整历史。
          example: 上一轮返回的响应 ID
        metadata:
          type: object
          additionalProperties:
            type: string
          description: 自定义字符串键值元数据，可在响应的 metadata 中读取。不要放入密钥或敏感信息。
          example:
            conversation: demo
        temperature:
          type: number
          description: 采样参数；具体有效范围和是否生效由模型决定。不要依赖它保证确定性，推理场景可省略。
        top_p:
          type: number
          description: 采样参数；具体有效范围和是否生效由模型决定，通常可省略。
      required:
        - model
        - input
    ResponsesResponse:
      type: object
      properties:
        id:
          type: string
          description: 本轮响应 ID。用于 previous_response_id 时原样传入。
          example: response_demo
        object:
          type: string
          const: response
        created_at:
          type: integer
          description: 创建时间，Unix 秒。
        model:
          type: string
          example: glm-5.3-flash
        status:
          type: string
          description: >-
            completed 表示本轮生成结束，也可能仅有工具调用；incomplete 表示输出不完整。请同时检查 output 和
            error。
          enum:
            - completed
            - incomplete
            - failed
            - in_progress
            - queued
        output:
          type: array
          items:
            $ref: '#/components/schemas/OutputItem'
          description: >-
            有序输出项。遍历 type=message 的 content 中 type=output_text 的 text
            得到正文。reasoning 可能在正文之前；function_call 轮次可能没有正文。不要固定读取 output[0]。
        output_text:
          type: string
          description: 可选的正文聚合字段，可能缺失。通用客户端应遍历 output。
        usage:
          $ref: '#/components/schemas/Usage'
        error:
          type:
            - object
            - 'null'
          description: 响应错误；成功时通常为 null。
          additionalProperties: true
        incomplete_details:
          type: object
          properties:
            reason:
              type: string
              description: 输出被截断时，例如 max_output_tokens。
        metadata:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            param:
              type:
                - string
                - 'null'
            code:
              type:
                - string
                - integer
                - 'null'
      required:
        - error
    InputItem:
      description: 消息、函数结果，或上一轮 output 中原样回传的项。回传工具结果时使用模型返回的 call_id，保留上一轮输出项的原始字段。
      oneOf:
        - $ref: '#/components/schemas/InputMessage'
        - $ref: '#/components/schemas/FunctionCallOutput'
        - type: object
          properties:
            type:
              type: string
              description: 回传的输出项类型。
              enum:
                - function_call
                - reasoning
                - web_search_call
            id:
              type: string
            call_id:
              type: string
            name:
              type: string
            arguments:
              type: string
              description: JSON 编码的参数字符串。
            status:
              type: string
            action:
              type: object
              additionalProperties: true
              description: web_search_call 的搜索或网页访问动作。
          required:
            - type
    Tool:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              const: function
            name:
              type: string
            description:
              type: string
            parameters:
              type: object
              description: 函数参数 JSON Schema。
            strict:
              type: boolean
              description: 函数参数约束选项。执行函数前仍需在客户端解析并校验 arguments。
          required:
            - type
            - name
            - parameters
        - type: object
          properties:
            type:
              type: string
              const: web_search
          required:
            - type
    OutputItem:
      type: object
      properties:
        type:
          type: string
          description: 常见类型为 message、reasoning、function_call、web_search_call。
          enum:
            - message
            - reasoning
            - function_call
            - web_search_call
        id:
          type: string
        status:
          type: string
        role:
          type: string
        content:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              text:
                type: string
              annotations:
                type: array
                items:
                  type: object
          description: message 中为 output_text；reasoning 中可能为 reasoning_text。
        summary:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              text:
                type: string
          description: 推理内容也可能通过 summary_text 返回。不要假设每个 reasoning 项都有 content。
        call_id:
          type: string
          description: 函数调用标识，用于回传结果。
        name:
          type: string
          description: 函数名。
        arguments:
          type: string
          description: 函数参数的 JSON 字符串；执行前自行解析并校验。
        action:
          type: object
          additionalProperties: true
          description: web_search_call 的搜索或网页访问动作。
      required:
        - type
    Usage:
      type: object
      properties:
        input_tokens:
          type: integer
          description: 总输入 token，包含缓存命中部分。
        output_tokens:
          type: integer
          description: 总输出 token，包含推理 token。
        total_tokens:
          type: integer
          description: 输入与输出 token 总和。
        input_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
              description: >-
                输入中命中缓存的 token 子集，不要重复加到 input_tokens 上。前缀缓存自动命中，不要求显式
                cache_control；命中量以实际返回值为准。
        output_tokens_details:
          type: object
          properties:
            reasoning_tokens:
              type: integer
              description: 输出中用于推理的 token 子集，不要重复计入 output_tokens。此明细可能缺失或为 0。
    InputMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
        content:
          description: 文本字符串，或输入内容块数组。回传已有 assistant 输出时，也可以原样保留其 output_text 内容块。
          oneOf:
            - type: string
            - type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/InputText'
                  - $ref: '#/components/schemas/InputImage'
                  - $ref: '#/components/schemas/OutputText'
      required:
        - role
        - content
    FunctionCallOutput:
      type: object
      properties:
        type:
          type: string
          const: function_call_output
        call_id:
          type: string
          description: 原 function_call 的 call_id。
        output:
          type: string
          description: 函数结果，通常为 JSON 编码字符串。
      required:
        - type
        - call_id
        - output
    InputText:
      type: object
      properties:
        type:
          type: string
          const: input_text
        text:
          type: string
      required:
        - type
        - text
    InputImage:
      type: object
      properties:
        type:
          type: string
          const: input_image
        image_url:
          type: string
          description: >-
            图片公网 URL 或 Base64 Data URL，例如 PNG 图片的 data:image/png;base64,...。仅
            glm-5.3-flash / glm-5.3-flashx 支持图像输入；glm-5.3 和 glm-5.2 请使用纯文本。
      required:
        - type
        - image_url
    OutputText:
      type: object
      properties:
        type:
          type: string
          const: output_text
        text:
          type: string
        annotations:
          type: array
          items:
            type: object
      required:
        - type
        - text
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 在 Authorization 请求头中传入 Bearer YOUR_API_KEY。

````