Tabbit
ResourcesBlogModels
Tabbit LogoTabbit

Tabbit — The AI Browser that Works for You

Topics

  • AI Browser Resources
  • Agentic Browser Resources
  • Browser Downloads and Install Guides
  • Browser Comparisons
  • AI Browser Alternatives
  • Browser Productivity Resources

Popular Guides

  • AI Browser
  • Agentic Browser Download
  • Best AI Browser 2026: Top 9 Tested & Ranked
  • AI Browser Download
  • Free AI Browser
  • Best AI Browser 2026
  • AI Browser Comparison 2026
  • AI Browser for Windows
  • AI Browser for Mac
  • Chrome Alternative 2026

Events

  • Tabbit Skill Competition
  • KPOP SBTI Fandom Personality Test
  • Tabbit Campus Creator Program
  • fifi's Picks: AI Skills for Research Papers
  • User Survey

About

  • Tabbit Blog
  • Press & Media
English
简体中文English
Prompts and workflows

GLM-5.2 · configuration

GLM-5.2 Thinking Mode Configuration: Default Thinking / Interleaved Thinking / Preserved Thinking / Turn-level Thinking (Official)

The official documentation states that thinking is enabled by default for GLM-5.2 (as with GLM-5.1/5/4.7), and provides four thinking modes: default thinking, interleaved thinking (thinking between tool calls), preserved thinking (retaining reasoning content across turns with `clear_thinking: false`), and turn-level thinking (an independent switch for each turn). It also highlights a key constraint for Agent integrations: historical `reasoning_content` must be returned unchanged..

Source not verifiedGLM-5.2 tool-calling conversation

Prerequisites and inputs

  • reasoning_content history
  • clear_thinking
  • turn policy
  • tool result

Complete templates

Editorial adaptation:GLM-5.2 Thinking Mode Configuration: Default Thinking / Interleaved Thinking / Preserved Thinking / Turn-level Thinking (Official)

Tabbit editorial adaptation; not the original source prompt
Run {{MULTI_TURN_TASK}} with {{THINKING_MODE}}; return {{REASONING_FIELD}} and {{TOOL_RESULT}} in order, record {{CLEAR_THINKING}}, and check {{FINAL_ANSWER}}.

Replace before running: {{MULTI_TURN_TASK}}, {{THINKING_MODE}}, {{REASONING_FIELD}}, {{TOOL_RESULT}}, {{CLEAR_THINKING}}, {{FINAL_ANSWER}}

Use one multi-turn tool task to test default, interleaved, preserved, and turn-level thinking. Return reasoning_content exactly as required each turn, recording clear_thinking, tool results, and the final answer. If state is lost, check message order before reducing task complexity.

Read the source research notes

One-sentence takeaway

The official documentation states that thinking is enabled by default for GLM-5.2 (as with GLM-5.1/5/4.7), and provides four thinking modes: default thinking, interleaved thinking (thinking between tool calls), preserved thinking (retaining reasoning content across turns with clear_thinking: false), and turn-level thinking (an independent switch for each turn). It also highlights a key constraint for Agent integrations: historical reasoning_content must be returned unchanged.

Use cases

  • Suitable tasks: building tool-calling Agents (which need to continue reasoning after each tool result); coding/Agent products that prioritize consistency in long sessions and cache hit rates (preserved thinking); multi-turn applications that need fine-grained per-turn control over cost and latency (turn-level thinking).

  • Unsuitable tasks: session systems that cannot or do not want to return complete reasoning_content (this will break preserved thinking and reduce performance and cache hits); forwarding layers with privacy or compliance concerns about thinking content (thinking is enabled by default and cannot be globally disabled without changing behavior).

  • Supported model versions: GLM-5.2, GLM-5.1, GLM-5, and GLM-4.7 (thinking enabled by default); GLM-4.6 uses hybrid thinking by default and behaves differently.

  • Supported clients, Agents, or APIs: the Z.ai Chat Completions API; the GLM Coding Plan endpoint (preserved thinking enabled by default); standard API endpoints (preserved thinking disabled by default and must be explicitly enabled with "clear_thinking": false).

  • Recommended reasoning mode and parameters: thinking enabled by default; thinking.type supports enabled / disabled; for Agent scenarios, use "clear_thinking": false (preserved thinking) and return the complete, unmodified reasoning_content; for lightweight turns, use thinking.type: disabled for faster responses.

Ready-to-use content

Disable thinking (official syntax)

"thinking": {
    "type": "disabled"
}

Preserved Thinking configuration essentials

  • Recommended for coding/Agent scenarios; enabled by default for Coding Plan endpoints and disabled by default for standard API endpoints.

  • How to enable it (API endpoints): "clear_thinking": false.

  • The complete, unmodified reasoning_content must be returned to the API; all consecutive reasoning blocks must remain in exactly the same order in which the model originally generated them and must not be reordered or edited. Otherwise, performance will decline and cache hits will be affected.

  • Effect: retains the previous assistant turn's reasoning content in the context, maintains reasoning continuity, improves performance, and increases cache hits to save tokens.

Interleaved Thinking + complete tool-calling example (official)

"""Interleaved Thinking + Tool Calling Example"""

import json
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.z.ai/api/paas/v4/",
)

tools = [{"type": "function", "function": {
    "name": "get_weather",
    "description": "Get weather information",
    "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
}}]

messages = [
    {"role": "system", "content": "You are an assistant"},
    {"role": "user", "content": "What's the weather like in Beijing?"},
]

# Round 1: the model reasons and then calls a tool
response = client.chat.completions.create(model="glm-5.2", messages=messages, tools=tools, stream=True, extra_body={
        "thinking":{
        "type":"enabled",
        "clear_thinking": False  # False for Preserved Thinking
    }})
reasoning, content, tool_calls = "", "", []
for chunk in response:
    delta = chunk.choices[0].delta
    if hasattr(delta, "reasoning_content") and delta.reasoning_content:
        reasoning += delta.reasoning_content
    if hasattr(delta, "content") and delta.content:
        content += delta.content
    if hasattr(delta, "tool_calls") and delta.tool_calls:
        for tc in delta.tool_calls:
            if tc.index >= len(tool_calls):
                tool_calls.append({"id": tc.id, "function": {"name": "", "arguments": ""}})
            if tc.function.name:
                tool_calls[tc.index]["function"]["name"] = tc.function.name
            if tc.function.arguments:
                tool_calls[tc.index]["function"]["arguments"] += tc.function.arguments

print(f"Reasoning: {reasoning}\nTool calls: {tool_calls}")

# Key: return reasoning_content to keep the reasoning coherent
messages.append({"role": "assistant", "content": content, "reasoning_content": reasoning,
                 "tool_calls": [{"id": tc["id"], "type": "function", "function": tc["function"]} for tc in tool_calls]})
messages.append({"role": "tool", "tool_call_id": tool_calls[0]["id"],
                 "content": json.dumps({"weather": "Sunny", "temp": "25°C"})})

# Round 2: the model continues reasoning based on the tool result and responds
response = client.chat.completions.create(model="glm-5.2", messages=messages, tools=tools, stream=True, extra_body={
        "thinking":{
        "type":"enabled",
        "clear_thinking": False # False for Preserved Thinking
    }})
reasoning, content = "", ""
for chunk in response:
    delta = chunk.choices[0].delta
    if hasattr(delta, "reasoning_content") and delta.reasoning_content:
        reasoning += delta.reasoning_content
    if hasattr(delta, "content") and delta.content:
        content += delta.content

print(f"Reasoning: {reasoning}\nReply: {content}")

Turn-level Thinking essentials

  • Within the same session, each request can independently choose whether to enable or disable thinking.

  • For lightweight turns (fact lookup, wording edits), disable thinking for faster responses; for demanding tasks (complex planning, multi-constraint reasoning, code debugging), enable thinking for greater accuracy and stability.

  • Agent/tool scenarios: reduce reasoning overhead for turns that need to execute tools quickly, and deepen thinking for turns that need to make decisions based on tool results.

  • Across multiple turns, the model maintains coherent, consistent output style.

Notes and limitations

  • The example code in the official documentation uses model="glm-4.7" as a generic documentation example; the same page clearly states that the default-enabled thinking behavior applies to the GLM-5.2 series. When integrating GLM-5.2, change it to model="glm-5.2".

  • The requirement to return reasoning_content verbatim for preserved thinking is a hard requirement for forwarding layers and intermediate caches. Failure to meet it will directly harm performance.

Source and dates

Z.ai Official Developer Documentation (docs.z.ai, Capabilities / Thinking Mode) · Source date: Not disclosed · Edited: 2026-09-20

Read the original source
Variable checklist

Still to replace: 6

{{MULTI_TURN_TASK}}{{THINKING_MODE}}{{REASONING_FIELD}}{{TOOL_RESULT}}{{CLEAR_THINKING}}{{FINAL_ANSWER}}

Related prompts

GLM-5.2 Official Documentation: Overview and API Quick Start (docs.z.ai)Official Configuration Guide for Migrating from GLM-5.1 / GLM-5 / GLM-4.x to GLM-5.2Using GLM-5.2 (zai-glm-5-2) Through Mistral: Third-Party Hosting Configuration and PricingGLM-5.2 Role-Playing (RP) System Prompt: Evening-Truth Complete Dark-Version Prompt

Related reviews

NIST CAISI's Independent Capability Assessment of Z.ai GLM-5.2Semgrep IDOR Benchmark: GLM-5.2 Results with a Prompt-Only Setup in Security Code AuditingGLM-5.2 Official Release Notes and Complete Benchmark Table (Z.ai Blog)Reddit Blind Code Review: GLM-5.2's Production-Readiness Score and Multi-Judge Recheck

Read the full analysis

Overview · English

GLM-5.2: What It Is, What It Costs, and Where It Fits

A sourced GLM-5.2 overview covering the June 2026 release, 1M context, open-weight deployment, API pricing boundaries, coding evidence and a safer pilot path.

GLM-5.2

Use GLM-5.2 in Tabbit

Run this guide in the environment listed above. Downloading does not transfer the template or establish model availability for your account.