Skip to content

GLM

Model Overview

GLM is a family of high-performance text models for long-horizon reasoning, coding agents, repository analysis, technical planning, and production-style engineering workflows.

ExchangeToken exposes GLM models through the OpenAI-compatible Chat Completions API.

Supported model list:

  • glm-5.2
  • glm-5.1

Model Capabilities

  • Long-context reasoning: Supports project-level context understanding and long task execution.
  • Coding and software engineering: Helps with architecture analysis, implementation, refactoring, debugging, tests, and documentation.
  • Tool and function use: Suitable for workflows that call external tools or structured functions.
  • Streaming responses: Can return incremental output for interactive chat and agent experiences.
  • Structured output: Can generate JSON or other structured formats for application integration.
  • Production instruction following: Better suited for tasks with strict engineering rules, repository conventions, and multi-file constraints.

GLM-5.2

GLM-5.2 is a flagship text model designed for long-horizon development and complex reasoning tasks. It is built for large project contexts, multi-step execution, and workflows where the model needs to keep architectural constraints, interface contracts, and implementation details consistent across a long task. It is especially useful for coding agents, repository analysis, technical planning, and tasks that require stable instruction following over extended context.

GLM-5.2 Capabilities

  • Flagship model for long-horizon coding and complex reasoning.
  • Supports large project context and long task execution.
  • Supports a 1M context window.
  • Supports up to 128K output tokens.
  • Designed for stronger engineering convention following and multi-file consistency.
  • Supports thinking mode, streaming responses, tool/function workflows, and structured output.

GLM-5.1

GLM-5.1 is a high-intelligence text model for complex coding and long-horizon task execution. It is designed for autonomous agents and coding agents that need to plan, execute, iterate, and optimize over an extended workflow. It is a strong fit for multi-stage engineering tasks, frontend artifacts, general dialogue, creative writing, and office productivity scenarios.

GLM-5.1 Capabilities

  • Strong coding and autonomous agent performance for multi-step engineering tasks.
  • Improved long-horizon execution for planning, implementation, testing, and iteration.
  • Supports text input and output with a 200K context window and up to 128K output tokens.
  • Supports thinking mode, streaming responses, tool/function workflows, and structured output.

cURL Examples

The following examples use glm-5.2. To call another GLM model, change the model field.

Basic Request

bash
curl -X POST "https://api.exchangetoken.ai/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.2",
    "messages": [
      {
        "role": "system",
        "content": "You are a senior full-stack engineer with deep experience in frontend development, backend architecture, and modern web stacks."
      },
      {
        "role": "user",
        "content": "Design and implement a personal blog website with a homepage, article list, and article detail page using React and Node.js."
      }
    ],
    "thinking": {
      "type": "enabled"
    },
    "reasoning_effort": "max",
    "max_tokens": 65536,
    "temperature": 1.0,
    "stream": false
  }'

Streaming Request

bash
curl -X POST "https://api.exchangetoken.ai/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.2",
    "messages": [
      {
        "role": "system",
        "content": "You are a senior full-stack engineer with deep experience in frontend development, backend architecture, and modern web stacks."
      },
      {
        "role": "user",
        "content": "Design and implement a personal blog website with a homepage, article list, and article detail page using React and Node.js."
      }
    ],
    "thinking": {
      "type": "enabled"
    },
    "reasoning_effort": "max",
    "stream": true,
    "max_tokens": 65536,
    "temperature": 1.0
  }'