> ## 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 Quickstart

> Call GLM with model and input. Supported models: glm-5.3, glm-5.3-flash, glm-5.3-flashx and glm-5.2. Set max_output_tokens to 1024 or higher to leave room for reasoning and the answer.

See the [full reference](./responses-reference) for more examples and model differences.

<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>

Use POST /v1/responses and select the model with model. The minimum required fields are model and input. The examples also set an output budget and reasoning effort to help you get started.

<Warning>
  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.
</Warning>

## Read the answer

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].

Once the response JSON is parsed into response, extract the answer as follows:

```python theme={null}
text = "".join(
    part["text"]
    for item in response.get("output", [])
    if item.get("type") == "message"
    for part in item.get("content", [])
    if part.get("type") == "output_text"
)
print(text)
```

<Note>
  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.
</Note>

See the [full reference](./responses-reference) for tool calls, images, SSE handling and multi-turn conversations.


## OpenAPI

````yaml en/api-manual/language-series/glm/responses/responses-quickstart.json POST /v1/responses
openapi: 3.1.0
info:
  title: GLM All-Model API - Responses Quickstart
  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 quickstart
      description: >-
        Call GLM with model and input. Supported models: glm-5.3, glm-5.3-flash,
        glm-5.3-flashx and glm-5.2. Set max_output_tokens to 1024 or higher to
        leave room for reasoning and the answer.


        See the [full reference](./responses-reference) for more examples and
        model differences.
      operationId: glmResponsesQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesQuickRequest'
            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
              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
              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
      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:
    ResponsesQuickRequest:
      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.
      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
    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.

````