GLM 5.2
GLM 5.2 is Z.AI’s earlier flagship model for long-horizon coding and engineering workflows, with thinking mode, function calls, structured output, streaming, MCP support, and strong community interest around coding-agent use.
🚀Function Overview
GLM 5.2 is designed for long-horizon reasoning and engineering workflows where context continuity, tool calling, structured outputs, and agent-harness compatibility are important.
Key Features
- 1M base context window in Z.AI documentation and text-input/output focus
- Up to 128K max output capacity in base model documentation
- Thinking mode for deeper reasoning steps in long workflows
- Built-in function-calling/tool-calling and streaming behavior
- Structured output and MCP-oriented integrations
- Mistral-hosted zai-glm-5-2 retires October 31 with GLM 5.3 replacement; this is not a global Z.AI retirement.
Use Cases
- •Long-horizon coding and software engineering support
- •Agent workflows requiring function calls and structured output
- •Provider-aware pricing and token-budget comparisons
- •MCP-aware orchestration and model routing
- •One-shot app, UI, and game prototyping where users compare result quality against Opus/Fable-class models
- •Hosted open-model routing when users care about access control, cached-input pricing, and avoiding single-provider lock-in
- •Community-informed trials in OpenCode, Ollama cloud, Codex-style clients, and other coding harnesses
⚙️Input Parameters
model
stringThe model id value, such as glm-5.2.
messages
arrayChat message array in OpenAI-compatible format for reasoning and coding workflows.
tools
arrayOptional tool definitions for function-calling workflows.
thinking
stringOptional thinking mode switch used by Z.AI and provider clients.
response_format
objectOptional response format for structured output.
stream
booleanWhether to stream partial outputs.
💡Usage Examples
Example 1
Input Parameters
{
"model": "glm-5.2",
"messages": [
{
"role": "user",
"content": "Draft a migration plan for upgrading a monorepo from JavaScript to TypeScript under a canary rollout."
}
],
"thinking": "high",
"stream": true
}Output Results
Example 2
Input Parameters
{
"model": "glm-5.2",
"messages": [
{
"role": "user",
"content": "Build a single-file prototype for a small browser game and explain which mechanics were completed."
}
],
"thinking": "max",
"stream": true
}Output Results
Quick Actions
Technical Specifications
- Hardware Type
- z.ai cloud / Cloudflare Workers AI
- Commercial Use
- Supported
- Pricing
- Cloudflare Workers AI: input $1.40 per M, output $4.40 per M, cached input $0.26 per M
- Platform
- Replicate