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

# glm-5.2

> Model details for glm-5.2. Reasoning, function calling, and batch tasks with a 1M-token context window.

<Note>
  This model supports the Chat Completions API only. Send requests to
  `/v1/chat/completions` — the Responses endpoint (`/v1/responses`) is not
  available for this model.
</Note>

> Z.ai's GLM-5.2 is an open-weight Mixture-of-Experts flagship built for long-horizon tasks, with 753B total parameters activating 8 of 256 experts per token, served on ZeroGPU for general text generation. It sustains a solid 1,048,576-token (1M) context, reasons through a problem with flexible thinking effort before answering, and supports function calling and batch tasks. MIT-licensed with no usage restrictions. When the work spans entire repos, day-long agent sessions, or million-token documents, this is the model.

**References:** [Model docs](https://huggingface.co/zai-org/GLM-5.2) • [Terms](https://zerogpu.ai/terms) • [Privacy](https://zerogpu.ai/privacy-policy)


## OpenAPI

````yaml api-reference/openapi/playgrounds/glm-5_2.openapi.json POST /chat/completions
openapi: 3.1.0
info:
  title: glm-5.2 playground
  version: '1.0'
  description: >-
    Interactive playground for **glm-5.2**.

    Model is always `glm-5.2` on this page (shown in the form, not editable).

    Use the **request example** selector to switch use cases (JSON, NER, PII,
    etc.).

    Authentication: `x-api-key` (required) and `x-project-id` (optional).
servers:
  - url: https://api.zerogpu.ai/v1
    description: Production
security:
  - ApiKey: []
paths:
  /chat/completions:
    post:
      tags:
        - glm-5.2
      summary: 'glm-5.2: Chat completions'
      operationId: createChatCompletion_glm-5.2
      parameters:
        - name: x-project-id
          in: header
          required: false
          schema:
            type: string
          description: >-
            Optional project identifier. Scopes the request to a specific
            project when provided.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/CreateChatCompletionRequest'
                - type: object
                  properties:
                    model:
                      type: string
                      const: glm-5.2
                      default: glm-5.2
                      example: glm-5.2
                      description: >-
                        Model identifier (fixed for this playground). Use
                        request examples to change use cases.
            examples:
              default:
                summary: Default
                value:
                  model: glm-5.2
                  messages:
                    - role: system
                      content: You are a precise code-review assistant. Be brief.
                    - role: user
                      content: >-
                        Review this function name:
                        getUserDataAndSendEmailAndLog(). What does it tell you
                        about the function, and how would you refactor it? 3
                        bullets max.
                  max_tokens: 800
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
              examples:
                default:
                  summary: Default
                  value:
                    id: id-1784840133815
                    object: chat.completion
                    created: 1784840133
                    model: glm-5.2
                    choices:
                      - index: 0
                        finish_reason: stop
                        message:
                          role: assistant
                          content: >-
                            **1. The name confesses the crime** – "And" in a
                            function name means it violates single
                            responsibility: fetching, emailing, and logging are
                            three separate concerns.


                            **2. Split it** – Extract `getUserData()`,
                            `sendEmail()`, and `logActivity()`, each
                            independently testable and reusable.


                            **3. Orchestrate at the edge** – If the sequence
                            matters, compose them in a thin workflow function
                            named for the *why* (e.g. `onUserSignup()`), not the
                            *how*.
                          reasoning: >-
                            The name reveals the function does three unrelated
                            things — fetch data, send email, log — a
                            single-responsibility violation. Recommend splitting
                            into three functions plus a thin orchestrator. Keep
                            to 3 bullets.
                          tool_calls: []
                    usage:
                      prompt_tokens: 58
                      completion_tokens: 151
                      total_tokens: 209
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '420':
          description: Insufficient quota
        '500':
          description: Internal server error
components:
  schemas:
    CreateChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          const: glm-5.2
          default: glm-5.2
          example: glm-5.2
          description: >-
            Model identifier (fixed for this playground). Use request examples
            to change use cases.
        messages:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/ChatMessage'
        max_tokens:
          type: integer
          minimum: 1
          example: 800
          description: Maximum number of tokens to generate in the response.
        metadata:
          type: object
          additionalProperties: true
    ChatCompletionResponse:
      type: object
      additionalProperties: true
    ChatMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
        content:
          type: string
          minLength: 1
          format: textarea
          maxLength: 131072
          description: Message text.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key

````