Skip to main content
This guide explains how to migrate your calls from GLM-5.1, GLM-5, GLM-4.7, GLM-4.6, GLM-4.5 or other earlier models to Z.AI GLM-5.2, our strongest coding model to date, covering sampling parameter differences, streaming tool calls, reasoning_effort parameter, and other key points.

GLM-5.2 Features

  • Support for larger context and output: Maximum context 1M, maximum output 128K.
  • New support for streaming output during tool calling process (tool_stream=true), real-time retrieval of tool call parameters.
  • Supports deep thinking (thinking={ type: "enabled" }): when enabled, the model automatically determines whether to think (unlike GLM-4.7, which uses forced thinking).
  • New reasoning_effort parameter for controlling the model’s reasoning effort level when chain-of-thought thinking is enabled.
  • Superior code performance and advanced reasoning capabilities.

Migration Checklist

  • Update model identifier to glm-5.2
  • Sampling parameters: temperature default value 1.0, top_p default value 0.95, recommend choosing only one for tuning
  • Deep thinking: Enable or disable thinking={ type: "enabled" } as needed for complex reasoning/coding
  • Control reasoning effort: Configure reasoning_effort to decide between high (enhanced reasoning) or max (deep reasoning, default)
  • Streaming response: Enable stream=true and properly handle delta.reasoning_content and delta.content
  • Streaming tool calls: Enable stream=true and tool_stream=true and stream-concatenate delta.tool_calls[*].function.arguments
  • Maximum output and context: Set max_tokens appropriately (GLM-5.2 maximum output 128K, context 1M)
  • Prompt optimization: Work with deep thinking, use clearer instructions and constraints
  • Development environment verification: Conduct use case testing and regression, focus on randomness, latency, parameter completeness in tool streams

Start Migration

1. Update Model Identifier

  • Update model to glm-5.2.

2. Update Sampling Parameters

  • temperature: Controls randomness; higher values are more divergent, lower values are more stable.
  • top_p: Controls nucleus sampling; higher values expand candidate set, lower values converge candidate set.
  • temperature defaults to 1.0, top_p defaults to 0.95, not recommended to adjust both simultaneously.

3. Deep Thinking (Optional)

  • GLM-5.2 continues to support deep thinking capability, enabled by default.
  • Recommended to enable for complex reasoning and coding tasks:
  • Control reasoning effort, default max for deep reasoning:

4. Streaming Output and Tool Calls (Optional)

  • GLM-5.2 supports real-time streaming construction and output during tool calling process, disabled by default (False), requires enabling both:
    • stream=True: Enable streaming output for responses
    • tool_stream=True: Enable streaming output for tool call parameters
See: Tool Streaming Output Documentation

5. Testing and Regression

First verify in development environment that post-migration calls are stable, focus on:
  • Whether responses meet expectations, whether there’s excessive randomness or excessive conservatism in output
  • Whether tool streaming construction and output work normally
  • Latency and cost in long context and deep thinking scenarios

More Resources

Concept Parameters

Common model parameter concepts and sampling recommendations

Tool Streaming Output

View tool streaming output usage details

API Reference

View complete API documentation

Technical Support

Get technical support and help