Z.ai

GLM 5.2

Z.ai’s flagship text model for long-horizon work supports up to a 1M-token context and 128K-token output, with adjustable reasoning, tool calling, structured output, and context caching for project-scale code understanding, complex refactoring, and persistent agent workflows.

Modalities
Chat
Starting price
From $0.234 / call
Context
1.0M context

Z.ai

README

GLM-5.2 is a flagship foundation language model released by Z.ai in June 2026 for long-horizon tasks and project-scale engineering. It accepts and produces text, provides a one-million-token context window with up to 128,000 output tokens, and supports thinking modes, streaming, function calling, context caching, structured output, and MCP tool integration. Its official open model card identifies a 753B-parameter MoE text-generation model released under the MIT license.

The release focuses on making very long context useful throughout real work rather than merely increasing input capacity. Z.ai trained it specifically for long-horizon coding agents and reports 81.0 on Terminal-Bench 2.1 and 62.1 on SWE-bench Pro, with particular emphasis on cross-file implementation, adherence to engineering constraints, research reproduction, and sustained verification.

Key Capabilities

  • Project-Scale Context: Processes large repositories, long documents, configuration, tests, and prior decisions in one workflow, reducing context fragmentation over multiple stages.
  • Long-Horizon Coding: Decomposes dependencies, performs cross-file changes, runs validation, and iterates toward completion for refactoring, migration, and optimization tasks.
  • Engineering Constraint Adherence: Carries code style, architectural boundaries, dependency rules, build steps, and testing requirements through extended execution.
  • Tool and Agent Collaboration: Uses function calling and MCP to work with retrieval, files, execution environments, and other external systems.
  • Structured Integration: Produces structured formats such as JSON and supports streaming responses for applications, automation pipelines, and interactive assistants.
  • Research-to-Implementation Loops: Translates papers, datasets, and experimental requirements into multi-file projects, then debugs and checks the resulting implementation.

Technical Strengths

FeatureBenefit
Usable One-Million-Token ContextKeeps code, documents, rules, and task history available within information-heavy projects.
Sparse MoE ArchitectureActivates a subset of experts per token while retaining high model capacity for difficult reasoning and engineering work.
IndexShare AttentionReuses an indexer across groups of sparse-attention layers to reduce compute demands at very long context lengths.
Configurable Reasoning EffortLets applications match thinking depth to task difficulty and interaction needs.
Context CachingReuses stable prompt prefixes and background material in ongoing conversations and agent workflows.
Open Weights and Standard ServingMIT-licensed weights plus vLLM and SGLang deployment paths support teams that manage their own runtime.

Frequently Asked Questions

What tasks are best suited to GLM-5.2?

It is most useful for work requiring extensive context and sustained execution, including repository analysis, cross-module refactoring, difficult debugging, mobile development, research reproduction, and multi-tool agents. It can answer short questions, but those tasks do not fully use its long-context and long-horizon strengths.

How do you keep GLM-5.2 from making uncontrolled changes across a large codebase?

Require an impact map, immutable interfaces, test entry points, and stop conditions before implementation begins. Use builds, linting, tests, and a change manifest as stage gates, and return machine-readable tool results so the model can verify rather than assume success.

What makes GLM-5.2 function calling reliable in an agent workflow?

Use narrow JSON Schemas and validate arguments, permissions, and results in application code. Add idempotency keys, confirmation steps, and bounded retries for write operations, then return each tool result as a new message instead of letting the model infer the outcome.

How can context caching reduce cost?

Keep stable system prompts, project instructions, and shared code context unchanged to improve cache-hit probability. Because cached_tokens is already included in prompt_tokens, subtract cached input before charging the remaining input at the normal rate.

How do I connect GLM-5.2 to an existing app or agent through LinkModel?

LinkModel provides bearer authentication, a unified base URL, and OpenAI-compatible endpoints, so an existing client can typically switch its base URL, key, and verified model ID. Before release, confirm the current request fields, streaming events, and tool-call schema in LinkModel documentation and run a small regression suite against your parser and prompts.

Pricing

Token TypeLinkAI PriceOfficial Price
input$1.260000 / 1M tokens$1.400000 / 1M tokens
output$3.960000 / 1M tokens$4.400000 / 1M tokens
cache_read$0.234000 / 1M tokens$0.260000 / 1M tokens

More from Z.ai