> ## 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 All-Model API - Responses Reference

> Call GLM in Responses format for text conversations, streaming and function calling, with image understanding and web search available according to the model. See the parameters and model differences below.

<Note>
  **BaseURL**: The default BaseURL is `https://direct.evolink.ai`, which has better support for text models and long-lived connections. `https://api.evolink.ai` is the primary endpoint for multimodal services and serves as a fallback address for text models.
</Note>

Call GLM in Responses format for text conversations, streaming and function calling, with image understanding and web search available according to the model. See the parameters and model differences below.

## Models and parameter differences

Choose a GLM model. All four support text on this endpoint. Optional capabilities vary by model.

| Model ID         | Input        | Reasoning notes                                                                                                      |
| ---------------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
| `glm-5.3`        | Text         | Effective levels: `low` / `high` / `max`; compatible values are listed under reasoning. Thinking cannot be disabled. |
| `glm-5.3-flash`  | Text, images | Same as `glm-5.3`; use `input_image` for images.                                                                     |
| `glm-5.3-flashx` | Text, images | Same as `glm-5.3`; use `input_image` for images.                                                                     |
| `glm-5.2`        | Text         | `none` may still produce reasoning tokens and does not guarantee that thinking is disabled.                          |

Responses uses nested `reasoning.effort`, rather than top-level `reasoning_effort` or thinking. Reasoning usage is included in output\_tokens. Simple tasks may return `reasoning_tokens=0`; this does not imply that thinking can be disabled.

Reasoning effort; `low` is recommended.

**Compatibility rules for `glm-5.3` / `glm-5.3-flash` / `glm-5.3-flashx`**

| Supplied value         | Effective thinking level        |
| ---------------------- | ------------------------------- |
| `low` / `high` / `max` | Unchanged                       |
| `xhigh`                | `max`                           |
| `medium`               | `high`                          |
| `minimal` / `none`     | `low`; thinking remains enabled |

**`minimal` and `none` do not disable thinking on the 5.3 series.** Thinking tokens are billed as output. Unrecognized values are unchanged and have no compatibility mapping; use the listed values. These mappings do not apply to glm-5.2.

On this endpoint, `glm-5.2` may still produce reasoning tokens with none. This value does not guarantee that thinking is disabled.

## System prompts and multi-turn conversations

`instructions`: System instructions. `glm-5.3-flash` supports this field when input is a string. When input is a message array, put the system prompt in the first `role=system` message.

```json theme={null}
{
  "model": "glm-5.3-flash",
  "input": [
    {
      "role": "system",
      "content": "Answer concisely in English."
    },
    {
      "role": "user",
      "content": "Remember the passphrase RED-583"
    },
    {
      "role": "assistant",
      "content": "Remembered"
    },
    {
      "role": "user",
      "content": "What is the passphrase? Reply with only the passphrase."
    }
  ],
  "reasoning": {
    "effort": "low"
  },
  "max_output_tokens": 1024
}
```

Store the response for later reference. `glm-5.3-flash` and `glm-5.3-flashx` support multi-turn conversations using `store=true` with previous\_response\_id. `glm-5.2` does not support response-ID continuation; `store=true` does not enable it. Include the full history in input instead.

The top-level id of the previous response. `glm-5.3-flash` and `glm-5.3-flashx` support this with `store=true` and the same model. Pass the response id unchanged, not an item id from output. `glm-5.2` returns 400 for this field. For conversations across models, omit it and include the full history in input.

## Streaming responses

Enable SSE streaming. Read answer text from delta in response.output\_text.delta. The successful terminal event is response.completed. Also end the turn and handle `response.incomplete`, `response.failed` or error. Do not wait only for \[DONE] or connection closure.

| Event                                                                     | Handling                                                                          |
| ------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| `response.created` / `response.in_progress`                               | The turn starts.                                                                  |
| `response.output_text.delta`                                              | Append delta to the answer text.                                                  |
| `response.reasoning_text.delta` / `response.reasoning_summary_text.delta` | Reasoning content; keep it separate from the answer and support both event forms. |
| `response.output_item.done`                                               | Collect the complete output item, such as function\_call.                         |
| `response.completed`                                                      | Generation has ended; read `response.output` and response.usage.                  |
| `response.incomplete` / `response.failed` / `error`                       | Handle truncation or errors and end the turn.                                     |

Stop reading after a terminal event. HTTP 200 only means that the stream was established; check the final event status. A tool-call turn may end with `response.completed` and still require your application to execute the function and send another request.

## Function calling

Choose the function example in the request menu. Responses function definitions use a flat structure:

```json theme={null}
{
  "type": "function",
  "name": "get_temperature",
  "description": "Return the temperature for the specified city",
  "parameters": {
    "type": "object",
    "properties": {
      "city": {
        "type": "string"
      }
    },
    "required": [
      "city"
    ],
    "additionalProperties": false
  }
}
```

1. Traverse `response.output` and collect all items with type=function\_call.
2. Parse and validate the arguments JSON string, then execute each function in your application.
3. Append the entire previous output to the history. Add a `function_call_output` for each call, using the original `call_id` and a string output.
4. Send the updated history as input in the next request. The function-result example shows this structure.

<Note>
  `parallel_tool_calls`: Whether multiple tools may be called in a turn. false does not guarantee a single function call. Clients should traverse and handle every function\_call.
</Note>

## Images, search and JSON output

For `glm-5.3-flash` and `glm-5.3-flashx`, mix `input_text` and `input_image` in the user message content array. Pass a public image URL or Base64 Data URL in image\_url. Use text only for `glm-5.3` and glm-5.2.

Declare `tools: [{"type":"web_search"}]`. Search runs on the server and returns `web_search_call` items and answer text. Check the output items to see whether search was used. Searches may incur per-call fees in addition to token charges; see model pricing.

To continue after a search, append the entire previous `output`, including `web_search_call` and `message`, to `input`, then add your new question. Preserve original fields such as `id`, `status`, and `action`. The server has already executed the search, so do not create a `function_call_output` for `web_search_call`. See the `web_search_history` request example.

`text.format.type`: Output format: text for plain text or `json_object` for a JSON object. With `json_object`, explicitly request valid JSON in the prompt and parse and validate it in your client. Strict JSON Schema constraints are not provided; do not rely on `json_schema` or `strict=true` to enforce a structure.

## Responses and usage

Ordered output items. Extract text from content entries with `type=output_text` inside `type=message` items. Reasoning may precede the answer, and `function_call` turns may contain no answer text. Do not always read output\[0].

`output_text`: Optional aggregated answer text; it may be absent. General-purpose clients should traverse output.

`output_text` in message items; possibly `reasoning_text` in reasoning items. Reasoning may also be returned as summary\_text. Do not assume every reasoning item has content.

* `usage.input_tokens`: Total input tokens, including cached tokens. `usage.input_tokens_details.cached_tokens`: Cached subset of input tokens; do not add it to `input_tokens` again. Prefix caching is automatic and requires no explicit cache\_control. Use the returned value for the number of cache hits.
* `usage.output_tokens`: Total output tokens, including reasoning tokens. `usage.output_tokens_details.reasoning_tokens`: Subset of output tokens used for reasoning; do not count it again in output\_tokens. This detail may be absent or zero.

`status=incomplete` with `incomplete_details.reason=max_output_tokens` means the budget was exhausted. There may be reasoning without an answer; increase the output limit.


## OpenAPI

````yaml en/api-manual/language-series/glm/responses/responses-reference.json POST /v1/responses
openapi: 3.1.0
info:
  title: GLM All-Model API - Responses Reference
  description: >-
    Call the Zhipu GLM series using the OpenAI-compatible Responses format.
    Supports glm-5.3, glm-5.3-flash, glm-5.3-flashx and glm-5.2. Optional
    capabilities vary by model.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: Production (recommended)
  - url: https://api.evolink.ai
    description: Alternative URL
security:
  - bearerAuth: []
tags:
  - name: Responses
    description: GLM Responses API
paths:
  /v1/responses:
    post:
      tags:
        - Responses
      summary: GLM Responses API (full reference)
      description: >-
        Call GLM in Responses format for text conversations, streaming and
        function calling, with image understanding and web search available
        according to the model. See the parameters and model differences below.
      operationId: createGLMResponse
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesRequest'
            examples:
              basic:
                summary: Basic text conversation
                value:
                  model: glm-5.3-flash
                  input: Introduce yourself in one sentence.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              system_message:
                summary: System prompt and message array
                value:
                  model: glm-5.3-flash
                  input:
                    - role: system
                      content: Answer concisely in English.
                    - role: user
                      content: What is binary search?
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              stream:
                summary: SSE streaming output
                value:
                  model: glm-5.3-flash
                  input: Introduce yourself in one sentence.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  stream: true
              history:
                summary: Multi-turn conversation with history
                value:
                  model: glm-5.3-flash
                  input:
                    - role: user
                      content: Remember the passphrase RED-583
                    - role: assistant
                      content: Remembered
                    - role: user
                      content: What is the passphrase? Reply with only the passphrase.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              function:
                summary: Client-side function calling
                value:
                  model: glm-5.3-flash
                  input: Find the temperature in Beijing.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  tools:
                    - type: function
                      name: get_temperature
                      description: Return the temperature for the specified city
                      parameters:
                        type: object
                        properties:
                          city:
                            type: string
                        required:
                          - city
                        additionalProperties: false
                  tool_choice:
                    type: function
                    name: get_temperature
              function_result:
                summary: Return a function result
                description: >-
                  Replace the example call_id with the actual value returned in
                  the previous turn and preserve the complete previous output.
                value:
                  model: glm-5.3-flash
                  input:
                    - role: user
                      content: Find the temperature in Beijing.
                    - type: function_call
                      call_id: call_weather_demo
                      name: get_temperature
                      arguments: '{"city":"Beijing"}'
                    - type: function_call_output
                      call_id: call_weather_demo
                      output: '{"city":"Beijing","temperature":25}'
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  tools:
                    - type: function
                      name: get_temperature
                      description: Return the temperature for the specified city
                      parameters:
                        type: object
                        properties:
                          city:
                            type: string
                        required:
                          - city
                        additionalProperties: false
                  tool_choice: none
              web_search:
                summary: Server-side web search
                value:
                  model: glm-5.3-flash
                  input: >-
                    Use web search to find the title of the Python homepage.
                    Return only the title and source link.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  tools:
                    - type: web_search
                  tool_choice: required
              web_search_history:
                summary: Continue after a web search
                description: >-
                  For an actual request, replace the sample web_search_call and
                  message with all original output items from the previous
                  response, then append your new question. Preserve fields such
                  as id, status, and action. Do not create a
                  function_call_output for web_search_call.
                value:
                  model: glm-5.3-flash
                  input:
                    - role: user
                      content: >-
                        Use web search to find the title of the Python homepage.
                        Return only the title and source link.
                    - 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: >-
                        What homepage title did you find in the previous turn?
                        Return only the title without searching again.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              json_object:
                summary: JSON object output
                value:
                  model: glm-5.3-flash
                  input: >-
                    Return only a valid JSON object with a city field set to
                    Beijing. Do not use Markdown.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  text:
                    format:
                      type: json_object
              image:
                summary: Image understanding (Flash example)
                description: The example is a Data URL for a red PNG image.
                value:
                  model: glm-5.3-flash
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  input:
                    - role: user
                      content:
                        - type: input_text
                          text: >-
                            The image is a solid color. Reply with only its
                            color.
                        - type: input_image
                          image_url: >-
                            data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAABK0lEQVR4nO3RMQEAMAyAsLb+PW8y8hADHOybSEfraYDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANGOsDz+EB/5Uf+TQAAAAASUVORK5CYII=
              store:
                summary: Create a response for later reference (Flash)
                value:
                  model: glm-5.3-flash
                  input: >-
                    Remember the passphrase BLUE-728. Reply only with
                    Remembered.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  store: true
              previous_response:
                summary: Reference the previous response (Flash)
                description: >-
                  First run the example that creates a stored response, then set
                  previous_response_id to its top-level id. glm-5.2 does not
                  support this way of continuing a conversation.
                value:
                  model: glm-5.3-flash
                  input: What was the passphrase? Reply with only the passphrase.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  previous_response_id: Response ID returned in the previous turn
              flashx:
                summary: Call GLM-5.3-FlashX
                value:
                  model: glm-5.3-flashx
                  input: Introduce yourself in one sentence.
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              vision_flashx:
                summary: GLM-5.3-FlashX image input
                value:
                  model: glm-5.3-flashx
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  input:
                    - role: user
                      content:
                        - type: input_text
                          text: >-
                            The image is a solid color. Reply with only its
                            color.
                        - type: input_image
                          image_url: >-
                            data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAABK0lEQVR4nO3RMQEAMAyAsLb+PW8y8hADHOybSEfraYDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOwBmANGOsDz+EB/5Uf+TQAAAAASUVORK5CYII=
      responses:
        '200':
          description: >-
            Generation completed or returned an incomplete result; check status.
            Streaming returns 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: >-
                          Hello, I am GLM. I can help with conversation, writing
                          and coding.
                        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":"Hello"}


                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":"Hello","annotations":[]}]}],"usage":{"input_tokens":17,"output_tokens":3,"total_tokens":20},"error":null}}

        '400':
          description: >-
            Invalid request parameters, such as missing input, malformed
            reasoning settings or a model that does not support
            previous_response_id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: The API key is invalid or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Insufficient available credits.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded. Retry with backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: The service is temporarily unavailable. Try again later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ResponsesRequest:
      type: object
      properties:
        model:
          type: string
          description: >-
            Choose a GLM model. All four support text on this endpoint. Optional
            capabilities vary by model.


            | Model ID | Input | Reasoning notes |

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

            | `glm-5.3` | Text | Effective levels: low / high / max; compatible
            values are listed under reasoning. Thinking cannot be disabled. |

            | `glm-5.3-flash` | Text, images | Same as glm-5.3; use input_image
            for images. |

            | `glm-5.3-flashx` | Text, images | Same as glm-5.3; use input_image
            for images. |

            | `glm-5.2` | Text | none may still produce reasoning tokens and
            does not guarantee that thinking is disabled. |
          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: >-
            Required. A text string or an array of Responses input items. Arrays
            accept messages, returned model output items and
            function_call_output. For multi-turn conversations, include the full
            history in each request. Put the system prompt first as a
            role=system message. Images use input_image, supported only by
            glm-5.3-flash and glm-5.3-flashx. Do not use the Chat Completions
            messages / image_url block format.
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/InputItem'
          example: Introduce yourself in one sentence.
        max_output_tokens:
          type: integer
          minimum: 1
          description: >-
            Maximum output tokens for this generation, including reasoning.
            Start at 1024 and adjust for the task. A small budget may be
            exhausted during reasoning, leaving only reasoning items and no
            answer. Check status and incomplete_details. The parameter name is
            max_output_tokens, not max_tokens.
          example: 1024
        stream:
          type: boolean
          default: false
          description: >-
            Enable SSE streaming. Read answer text from delta in
            response.output_text.delta. The successful terminal event is
            response.completed. Also end the turn and handle
            response.incomplete, response.failed or error. Do not wait only for
            [DONE] or connection closure.
        reasoning:
          type: object
          properties:
            effort:
              type: string
              description: >-
                Reasoning effort; low is recommended.


                **Compatibility rules for glm-5.3 / glm-5.3-flash /
                glm-5.3-flashx**


                | Supplied value | Effective thinking level |

                | --- | --- |

                | `low` / `high` / `max` | Unchanged |

                | `xhigh` | `max` |

                | `medium` | `high` |

                | `minimal` / `none` | low; thinking remains enabled |


                **minimal and none do not disable thinking on the 5.3 series.**
                Thinking tokens are billed as output. Unrecognized values are
                unchanged and have no compatibility mapping; use the listed
                values. These mappings do not apply to glm-5.2.


                On this endpoint, glm-5.2 may still produce reasoning tokens
                with none. This value does not guarantee that thinking is
                disabled.
              enum:
                - max
                - xhigh
                - high
                - medium
                - low
                - minimal
                - none
              example: low
          description: >-
            Responses uses nested reasoning.effort, rather than top-level
            reasoning_effort or thinking. Reasoning usage is included in
            output_tokens. Simple tasks may return reasoning_tokens=0; this does
            not imply that thinking can be disabled.
        instructions:
          type: string
          description: >-
            System instructions. glm-5.3-flash supports this field when input is
            a string. When input is a message array, put the system prompt in
            the first role=system message.
        tools:
          type: array
          items:
            $ref: '#/components/schemas/Tool'
          description: >-
            Supports client-side function tools and server-side web_search.
            Declare functions with flat name / description / parameters fields,
            not a nested Chat Completions function object. Your application
            executes function_call and returns the result. web_search runs on
            the server; actual searches may incur per-call charges in addition
            to tokens. See model pricing.
        tool_choice:
          description: >-
            auto lets the model choose; none disables tools; required requires a
            tool call. To select a function, use
            {"type":"function","name":"get_temperature"}. Forced selection
            behavior is not guaranteed to be identical for every model and tool
            combination.
          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: >-
            Whether multiple tools may be called in a turn. false does not
            guarantee a single function call. Clients should traverse and handle
            every function_call.
        text:
          type: object
          properties:
            format:
              type: object
              properties:
                type:
                  type: string
                  description: >-
                    Output format: text for plain text or json_object for a JSON
                    object. With json_object, explicitly request valid JSON in
                    the prompt and parse and validate it in your client. Strict
                    JSON Schema constraints are not provided; do not rely on
                    json_schema or strict=true to enforce a structure.
                  enum:
                    - text
                    - json_object
                  example: json_object
              required:
                - type
          description: >-
            Output format. Examples use json_object. HTTP 200 does not guarantee
            JSON Schema compliance.
        store:
          type: boolean
          description: >-
            Store the response for later reference. glm-5.3-flash and
            glm-5.3-flashx support multi-turn conversations using store=true
            with previous_response_id. glm-5.2 does not support response-ID
            continuation; store=true does not enable it. Include the full
            history in input instead.
        previous_response_id:
          type: string
          description: >-
            The top-level id of the previous response. glm-5.3-flash and
            glm-5.3-flashx support this with store=true and the same model. Pass
            the response id unchanged, not an item id from output. glm-5.2
            returns 400 for this field. For conversations across models, omit it
            and include the full history in input.
          example: Response ID returned in the previous turn
        metadata:
          type: object
          additionalProperties:
            type: string
          description: >-
            Custom string key-value metadata, available in response metadata. Do
            not include keys or sensitive information.
          example:
            conversation: demo
        temperature:
          type: number
          description: >-
            Sampling parameter. The effective range and behavior depend on the
            model. It does not guarantee deterministic output and can be omitted
            for reasoning tasks.
        top_p:
          type: number
          description: >-
            Sampling parameter. The effective range and behavior depend on the
            model. It can usually be omitted.
      required:
        - model
        - input
    ResponsesResponse:
      type: object
      properties:
        id:
          type: string
          description: ID of this response. Pass it unchanged as previous_response_id.
          example: response_demo
        object:
          type: string
          const: response
        created_at:
          type: integer
          description: Creation time in Unix seconds.
        model:
          type: string
          example: glm-5.3-flash
        status:
          type: string
          description: >-
            completed means generation for this turn has ended, possibly with
            tool calls only. incomplete means the output is incomplete. Check
            both output and error.
          enum:
            - completed
            - incomplete
            - failed
            - in_progress
            - queued
        output:
          type: array
          items:
            $ref: '#/components/schemas/OutputItem'
          description: >-
            Ordered output items. Extract text from content entries with
            type=output_text inside type=message items. Reasoning may precede
            the answer, and function_call turns may contain no answer text. Do
            not always read output[0].
        output_text:
          type: string
          description: >-
            Optional aggregated answer text; it may be absent. General-purpose
            clients should traverse output.
        usage:
          $ref: '#/components/schemas/Usage'
        error:
          type:
            - object
            - 'null'
          description: Response error, normally null on success.
          additionalProperties: true
        incomplete_details:
          type: object
          properties:
            reason:
              type: string
              description: Details when output is truncated, for example 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: >-
        A message, function result or an item copied unchanged from the previous
        output. For tool results, use the returned call_id and preserve the
        original fields of previous output items.
      oneOf:
        - $ref: '#/components/schemas/InputMessage'
        - $ref: '#/components/schemas/FunctionCallOutput'
        - type: object
          properties:
            type:
              type: string
              description: Type of the returned output item.
              enum:
                - function_call
                - reasoning
                - web_search_call
            id:
              type: string
            call_id:
              type: string
            name:
              type: string
            arguments:
              type: string
              description: Arguments encoded as a JSON string.
            status:
              type: string
            action:
              type: object
              additionalProperties: true
              description: Search or page-access action for 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 for function parameters.
            strict:
              type: boolean
              description: >-
                Function-argument constraint option. Clients must still parse
                and validate arguments before executing the function.
          required:
            - type
            - name
            - parameters
        - type: object
          properties:
            type:
              type: string
              const: web_search
          required:
            - type
    OutputItem:
      type: object
      properties:
        type:
          type: string
          description: >-
            Common types are message, reasoning, function_call and
            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: >-
            output_text in message items; possibly reasoning_text in reasoning
            items.
        summary:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              text:
                type: string
          description: >-
            Reasoning may also be returned as summary_text. Do not assume every
            reasoning item has content.
        call_id:
          type: string
          description: Function call identifier used to return its result.
        name:
          type: string
          description: Function name.
        arguments:
          type: string
          description: >-
            Function arguments as a JSON string. Parse and validate them before
            execution.
        action:
          type: object
          additionalProperties: true
          description: Search or page-access action for web_search_call.
      required:
        - type
    Usage:
      type: object
      properties:
        input_tokens:
          type: integer
          description: Total input tokens, including cached tokens.
        output_tokens:
          type: integer
          description: Total output tokens, including reasoning tokens.
        total_tokens:
          type: integer
          description: Sum of input and output tokens.
        input_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
              description: >-
                Cached subset of input tokens; do not add it to input_tokens
                again. Prefix caching is automatic and requires no explicit
                cache_control. Use the returned value for the number of cache
                hits.
        output_tokens_details:
          type: object
          properties:
            reasoning_tokens:
              type: integer
              description: >-
                Subset of output tokens used for reasoning; do not count it
                again in output_tokens. This detail may be absent or zero.
    InputMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
        content:
          description: >-
            A text string or an array of input content blocks. When sending back
            an existing assistant output, its output_text blocks can be
            preserved unchanged.
          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: The call_id of the original function_call.
        output:
          type: string
          description: Function result, usually a JSON-encoded string.
      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: >-
            A public image URL or Base64 Data URL, such as
            data:image/png;base64,... for PNG. Only glm-5.3-flash /
            glm-5.3-flashx support images; use text only for glm-5.3 and
            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: Send Bearer YOUR_API_KEY in the Authorization header.

````