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

> - Call GLM series models through the Anthropic Messages protocol, choosing the specific model with the `model` parameter
- `model`, `max_tokens` and `messages` are the only parameters you need (`max_tokens` is mandatory in the Anthropic protocol)
- 1M token context window across the series, with up to 131,072 output tokens
- **Thinking is on by default** across the series, so the response `content` carries a `type="thinking"` block, and that part counts towards output tokens
- For streaming, tool calls, image input and other capabilities, see the Reference page

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

<Note>
  **The GLM series has thinking on by default** — the response `content` array carries a `type="thinking"` block, and that part counts towards output tokens. So `max_tokens` should not be set too low; 1024 or higher is recommended, otherwise the response may be truncated before the thinking finishes and you get no answer text.
</Note>


## OpenAPI

````yaml en/api-manual/language-series/glm/messages/messages-quickstart.json POST /v1/messages
openapi: 3.1.0
info:
  title: GLM All-Model API - Messages Quickstart
  description: >-
    A quickstart example for calling Zhipu GLM text models through the Anthropic
    Messages protocol. Just `model`, `max_tokens` and `messages` are enough to
    start a conversation; for the full parameter set, see the Reference page.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: Production (Recommended, better support for text models)
  - url: https://api.evolink.ai
    description: Alternative URL
security:
  - bearerAuth: []
tags:
  - name: Messages
    description: Anthropic Messages protocol endpoints
paths:
  /v1/messages:
    post:
      tags:
        - Messages
      summary: GLM Quick Chat (All Models, Anthropic-Compatible)
      description: >-
        - Call GLM series models through the Anthropic Messages protocol,
        choosing the specific model with the `model` parameter

        - `model`, `max_tokens` and `messages` are the only parameters you need
        (`max_tokens` is mandatory in the Anthropic protocol)

        - 1M token context window across the series, with up to 131,072 output
        tokens

        - **Thinking is on by default** across the series, so the response
        `content` carries a `type="thinking"` block, and that part counts
        towards output tokens

        - For streaming, tool calls, image input and other capabilities, see the
        Reference page
      operationId: glmMessagesQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageQuickRequest'
            examples:
              simple:
                summary: Minimal call
                value:
                  model: glm-5.3
                  max_tokens: 1024
                  messages:
                    - role: user
                      content: Hello, please introduce yourself in one sentence
              flash:
                summary: Switch to the lightweight model
                description: >-
                  `glm-5.3-flash` costs far less than `glm-5.3` and suits
                  high-frequency calls.
                value:
                  model: glm-5.3-flash
                  max_tokens: 1024
                  messages:
                    - role: user
                      content: Explain what HTTP is in one sentence
              multi_turn:
                summary: Multi-turn conversation
                value:
                  model: glm-5.3
                  max_tokens: 1024
                  messages:
                    - role: user
                      content: >-
                        Recommend a programming language that is good for
                        beginners
                    - role: assistant
                      content: 'I recommend Python: concise syntax and a rich ecosystem.'
                    - role: user
                      content: Roughly how long does it take to learn?
      responses:
        '200':
          description: Message object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
              examples:
                with_thinking:
                  summary: Includes a thinking content block by default
                  value:
                    id: msg_0842a705-9d0b-4eaa-b12d-09a4106326c5
                    type: message
                    role: assistant
                    model: glm-5.3
                    content:
                      - type: thinking
                        thinking: >-
                          The user asked to greet them with one word, so
                          answering "Hi" will do.
                        signature: ''
                      - type: text
                        text: Hi.
                    stop_reason: end_turn
                    usage:
                      input_tokens: 18
                      output_tokens: 101
                      cache_creation_input_tokens: 0
                      cache_read_input_tokens: 0
                      prompt_tokens_details:
                        cached_tokens: 0
                tool_use:
                  summary: Triggers a tool call (stop_reason=tool_use)
                  value:
                    id: msg_067e85db-53df-43a1-bd38-09c53375f2f0
                    type: message
                    role: assistant
                    model: glm-5.3
                    content:
                      - type: tool_use
                        id: toolu_36b8a98e284c426799f08612
                        name: get_weather
                        input:
                          city: Tokyo
                    stop_reason: tool_use
                    usage:
                      input_tokens: 161
                      output_tokens: 11
                      cache_creation_input_tokens: 0
                      cache_read_input_tokens: 0
                      prompt_tokens_details:
                        cached_tokens: 0
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                request_id: req_xxx
                error:
                  type: invalid_request_error
                  message: Invalid request
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: authentication_error
                  message: Authentication error
        '402':
          description: Insufficient quota
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: billing_error
                  message: Insufficient quota
        '403':
          description: Permission error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: permission_error
                  message: Permission denied
        '404':
          description: Model or resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: not_found_error
                  message: Model not found
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: rate_limit_error
                  message: Rate limited
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Upstream service error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateMessageQuickRequest:
      title: Create Message Quick Request
      type: object
      required:
        - model
        - max_tokens
        - messages
      properties:
        model:
          type: string
          description: >
            Model to call:


            | Model ID | Positioning |

            |---|---|

            | `glm-5.3` | Flagship model, with across-the-board gains on complex
            software engineering and agent tasks; 1M context |

            | `glm-5.3-flash` | Lightweight multimodal model, extremely low
            cost, native image input; 1M context |

            | `glm-5.2` | Previous-generation flagship, complex reasoning and
            very long context; 1M context |
          enum:
            - glm-5.3
            - glm-5.3-flash
            - glm-5.2
          default: glm-5.3
          example: glm-5.3
        max_tokens:
          type: integer
          description: >-
            Maximum number of tokens to generate for this request; **required**
            by the Anthropic protocol.


            Note: the GLM series has thinking on by default, and the thinking
            content also consumes output tokens, so this value should not be too
            small — 1024 or higher is recommended.
          minimum: 1
          maximum: 131072
          default: 1024
          example: 1024
        messages:
          type: array
          description: >-
            The list of conversation messages, in chronological order. At least
            one message is required.
          minItems: 1
          items:
            $ref: '#/components/schemas/MessageSimple'
    MessageResponse:
      type: object
      description: Anthropic-style message response
      properties:
        id:
          type: string
          description: 'The message''s unique ID (format: `msg_<uuid>`)'
        type:
          type: string
          enum:
            - message
          description: Response object type
        role:
          type: string
          enum:
            - assistant
        model:
          type: string
          description: Model actually used
          example: glm-5.3
        content:
          type: array
          description: >-
            The list of response content blocks


            **Possible block types**:

            - `thinking`: the reasoning process (when thinking is enabled, which
            is the default)

            - `text`: the final answer text

            - `tool_use`: a tool call initiated by the model
          items:
            $ref: '#/components/schemas/OutputContentBlock'
        stop_reason:
          type: string
          description: >-
            Stop reason


            - `end_turn`: natural completion (also returned when stop_sequences
            is hit)

            - `max_tokens`: reached the max_tokens limit

            - `tool_use`: the model triggered a tool call
          enum:
            - end_turn
            - max_tokens
            - tool_use
        usage:
          $ref: '#/components/schemas/AnthropicUsage'
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          properties:
            type:
              type: string
              description: >-
                Error type (e.g. invalid_request_error / authentication_error /
                billing_error, etc.)
            message:
              type: string
              description: Error description
        request_id:
          type: string
          description: Request tracing ID
    MessageSimple:
      title: Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          description: >-
            Message role


            - `user`: user input

            - `assistant`: model reply (included in multi-turn conversations)


            Pass the system prompt through the top-level `system` field rather
            than inside `messages`.
          example: user
        content:
          type: string
          description: Message content (plain text)
          example: Hello, please introduce yourself in one sentence
    OutputContentBlock:
      type: object
      description: A content block in the response
      properties:
        type:
          type: string
          enum:
            - text
            - thinking
            - tool_use
        text:
          type: string
          description: Text when type=`text`
        thinking:
          type: string
          description: The reasoning-process text when type=`thinking`
        signature:
          type: string
          description: Signature when type=`thinking` (may be an empty string)
        id:
          type: string
          description: Tool call ID when type=`tool_use`
        name:
          type: string
          description: Tool name when type=`tool_use`
        input:
          type: object
          description: >-
            The JSON input parameters generated by the model when
            type=`tool_use`
    AnthropicUsage:
      type: object
      description: Token usage statistics (Anthropic specification)
      properties:
        input_tokens:
          type: integer
          description: Number of input tokens (the portion not served from cache)
          example: 18
        output_tokens:
          type: integer
          description: Number of output tokens (including thinking)
          example: 101
        cache_creation_input_tokens:
          type: integer
          description: >-
            Number of input tokens written to the cache (always 0 for the GLM
            series)
          example: 0
        cache_read_input_tokens:
          type: integer
          description: >-
            Number of input tokens served from cache (when an implicit cache
            hits, roughly the length of the shared prefix)
          example: 0
        prompt_tokens_details:
          type: object
          description: >-
            Input token breakdown (cache-hit fields, also returned by the GLM
            series)
          properties:
            cached_tokens:
              type: integer
              description: Number of input tokens served from cache
              example: 0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        ##All interfaces require authentication using a Bearer Token##


        **Get an API Key**:


        Visit the [API Key management page](https://evolink.ai/dashboard/keys)
        to obtain your API Key


        **Add it to the request header when using**:

        ```

        Authorization: Bearer YOUR_API_KEY

        ```


        **Note**: EvoLink uses Bearer Token authentication uniformly for
        `/v1/messages`.

````