Back to blog
ChatGPT13 min read

How to Prompt GLM Models

GLM prompting verified against Z.ai's own docs: the current model (not GLM-5.2), forced reasoning in GLM-5.3, sampling defaults, and how GLM prompting actually differs from generic prompting.

NH
Nafiul Hasan
Founder, Prompt Architects

TL;DR: GLM is Z.ai's (formerly Zhipu AI's) model family, and the current flagship is GLM-5.3, not GLM-5.2. Z.ai shipped 5.3 on 18 August 2026, about two weeks before this was checked. Z.ai publishes no dedicated GLM prompting guide. Prompting GLM well is mostly ordinary prompting, plus a short list of real parameter-level differences covered below, each sourced directly from Z.ai's own docs.

If you searched "glm prompting" expecting a distinctive syntax the way Midjourney or Kling have one, the honest answer is: there isn't one. GLM is Z.ai's large language model family (the company most people still know as Zhipu AI), and it takes ordinary chat-formatted prompts through an OpenAI-compatible API. What actually changes when you switch to GLM is a handful of documented parameters: how reasoning is forced or toggled, what sampling defaults Z.ai recommends, and a couple of API constraints that will surprise you if you're used to OpenAI's or Anthropic's equivalents. This page covers those, corrects a version assumption worth catching before you write anything else about GLM, and is honest about where Z.ai's own documentation stops.

What is GLM, and who makes it?

GLM stands for General Language Model, and it's built by Z.ai, the renamed and rebranded continuation of Zhipu AI. The company's own developer platform, docs.z.ai, and its Hugging Face organization both publish under the zai-org / Z.ai name today, with the open-weight repos still carrying the model family's original THUDM lineage in their history. If your source material still says "Zhipu AI" without qualification, that's not wrong, just dated branding. The current developer-facing name is Z.ai.

The current lineup, per Z.ai's own model overview page, checked 3 September 2026:

ModelPositioningContext windowReleased
GLM-5.3Flagship, coding + agent focus1M tokens18 Aug 2026
GLM-5.3-FlashNative multimodal, lower cost1M tokens26 Aug 2026
GLM-5.2Prior flagship, still documented1M tokens16 Jun 2026
GLM-5.1Long-horizon focus, 200K context200K tokens7 Apr 2026

The model IDs you actually pass to the API are lowercase: glm-5.3, glm-5.3-flash, glm-5.2, and so on, confirmed straight from Z.ai's own quick-start code samples, not inferred from the marketing names.

Does Z.ai publish an official GLM prompting guide?

Not a dedicated one, and this is worth saying plainly rather than papering over. Z.ai's full documentation index lists guides for every API parameter, every model, and every capability (thinking mode, function calling, structured output, context caching), but the closest thing to prompting advice, anywhere in that index, is a page titled "Best Practice", subtitled "Best Practices for Coding Agents: Managing Prompts, Plans, Skills, and Workflows".

Read that page and it turns out to be genuinely useful, but it is not GLM-specific. It opens with a framework for structuring any coding-agent task into four parts (goal, context, constraints, and "done when") and its own worked example of the pattern cites Claude Code by name as an illustration of planning before execution. It would apply just as well to Codex, Cursor, or any other agentic coding tool. Z.ai's honest position, read from its own docs rather than assumed, is that the model-specific advice lives in the API reference (how reasoning, sampling and tool calls behave), and everything above that layer is the same agentic-workflow advice you'd get anywhere.

That four-part structure is genuinely worth copying, regardless of which model you point it at:

Goal:        What needs to change, in one sentence.
Context:     The files, error messages, or examples that matter.
Constraints: Standards, architecture rules, or dependencies to respect.
Done when:   The test, behavior, or check that proves it's finished.

What actually changes when you prompt GLM instead of a generic model?

Three things, all parameter-level rather than stylistic, and all confirmed directly from Z.ai's API docs.

Reasoning is forced on GLM-5.3, and cannot be disabled. Z.ai's own migration guide is direct about this: GLM-5.3 always operates with reasoning enabled, with three effort levels (low, high, max), and "Disabling reasoning is no longer supported." That's a change from GLM-5.2, GLM-5.1 and GLM-5, which auto-decide whether to think and can still be set to disabled. If your workflow depends on a model that skips reasoning entirely for simple turns, GLM-5.3 will error on that request; GLM-5.2 is the one that still supports it.

tool_choice accepts only auto. Z.ai's chat completion reference documents the parameter as controlling "how the model selects which function to call." Its description states plainly that the default value is auto, and only auto is supported. There's no none to suppress tool use for one turn and no way to force a specific named function the way OpenAI's or Anthropic's APIs allow. If you need GLM to call one particular tool, the documented approach is to say so directly in the prompt, not to constrain it through the parameter.

Context caching is automatic, with nothing to mark in the prompt. Z.ai's own feature list, under the heading Automatic Cache Recognition, describes it as "Implicit caching that intelligently identifies repeated context content without manual configuration". A repeated system prompt or conversation history gets cached and billed at a lower rate without you doing anything, which is a real difference from Anthropic's API, where you place explicit cache_control breakpoints yourself.

Past those three, ordinary prompting rules apply: clear instructions, explicit output format, examples when the task is genuinely ambiguous. Z.ai's own function-calling best practices are generic advice any vendor would give (single-responsibility functions, clear naming, detailed parameter descriptions), not a GLM-specific technique.

How do you control GLM's reasoning depth?

Through two parameters that interact, and the accepted values differ by model generation. Z.ai's core-parameters reference lays it out:

ParameterGLM-5.3 / GLM-5.3-FlashGLM-5.2 and earlier
thinking.typeenabled only; disabled errorsenabled (default) or disabled
reasoning_effort valueslow, high, maxmax, xhigh, high, medium, low, minimal, none
Defaultmaxmax

On GLM-5.2, passing none or minimal for reasoning_effort skips thinking entirely, while low and medium both get mapped up to high, and xhigh maps to max, so of the seven documented values, only three actually produce distinct behavior. On GLM-5.3 the parameter was simplified to exactly those three real levels. For anything you'd call complex (multi-file coding, long-horizon planning), Z.ai's own guidance recommends max; reach for low deliberately when you want a faster, lighter-touch answer and can tolerate the drop in depth.

A basic call with reasoning forced to maximum:

curl -X POST "https://api.z.ai/api/paas/v4/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "glm-5.3",
    "messages": [
      {"role": "system", "content": "You are a senior backend engineer."},
      {"role": "user", "content": "Design a rate limiter for a multi-tenant API."}
    ],
    "thinking": {"type": "enabled"},
    "reasoning_effort": "max",
    "temperature": 1.0
  }'

If you're building a tool-calling agent, one more mechanic matters: GLM supports interleaved thinking between tool calls by default, and Z.ai's docs are explicit that when you do this, "thinking blocks should be explicitly preserved and returned together with the tool results" in your next request. Reordering or editing the returned reasoning_content can degrade both accuracy and cache hit rate. That's an implementation detail for whoever's writing the agent loop, not the prompt itself, but it will silently break your results if the harness drops it.

What sampling settings does Z.ai actually recommend?

Z.ai's migration guide gives one clear rule: temperature defaults to 1.0, top_p defaults to 0.95, and the documented advice is to tune only one of the two, not both at once. Lower temperature for factual, deterministic output; higher for creative or exploratory generation, standard guidance rather than a GLM-specific override. For how that compares across other vendors task by task, see AI Temperature Settings by Task.

max_tokens limits vary by model rather than following one flat number. Z.ai's parameter reference lists a default of 65,536 and a hard ceiling of 131,072 for every model in the current GLM-5.x line (5.3, 5.3-Flash, 5.2, 5.1, 5), while older GLM-4.5-series models cap lower, at 98,304. If you're porting a prompt or an integration from an older model, check the ceiling for the specific model ID rather than assuming it carries over.

One more constraint worth knowing before you rely on it: Z.ai's own API reference describes stop as a word list, but its description states plainly that "only one stop word is supported". If your prompting relies on multiple stop sequences the way OpenAI's four-sequence limit allows, GLM's documented behavior is narrower.

Can you get valid, structured JSON out of GLM?

Yes, through response_format set to {"type": "json_object"}, on models Z.ai lists as GLM-5, GLM-4.7, GLM-4.6 and GLM-4.5. Unlike the strict json_schema mode some other vendors document, Z.ai's structured-output guide shows the schema defined inside the system message itself, in prose or example form, rather than passed as a separate enforced schema object. Its own advice: start with a simple structure and add complexity gradually, and give key fields descriptions and examples so the model has something concrete to match.

{
  "response_format": { "type": "json_object" },
  "messages": [
    {
      "role": "system",
      "content": "Return JSON only, matching: {\"sentiment\": \"positive|negative|neutral\", \"confidence\": 0.0-1.0, \"summary\": \"string\"}"
    },
    { "role": "user", "content": "The onboarding flow confused three testers in a row." }
  ]
}

Z.ai's own warning on this feature is worth repeating rather than glossing over: forcing JSON mode "may affect the naturalness of responses" in complex scenarios, so it's worth testing whether a plain-prose answer with a follow-up parse step actually serves you better than forcing structure on every call.

Does the SWE-bench Pro score you've seen still apply?

Only to GLM-5.2, and it's worth being precise about that. Z.ai's own GLM-5.2 page states the model reaches "62.1 vs. 58.4 on SWE-bench Pro" against GLM-5.1, a real, first-party number dated to GLM-5.2's 16 June 2026 release. GLM-5.3's own model page, by contrast, does not repeat a SWE-bench Pro figure at all. Its coding claims are reported on a different set (a 50% gain over GLM-5.2 on Z.ai's in-house Z.ai Code Bench, plus Terminal-Bench 3.0 and DeepSWE v1.1), none of which are directly comparable to the SWE-bench Pro number. If you're citing GLM's 62.1% SWE-bench Pro figure, attribute it to GLM-5.2 specifically, not to the GLM family generically, since the current flagship's own page doesn't make the same claim.

Free Chrome Extension

Stop rewriting prompts. Start shipping.

Works with ChatGPT, Claude, Gemini, Grok, Midjourney, Ideogram, Veo3 & Kling. 4.8★ on the Chrome Web Store.

Create An Account

Is GLM open source, and can you self-host it?

Partly, and the license is worth reading rather than assuming. GLM-5.3 and GLM-5.2 are both published as open weights on Hugging Face under a license Z.ai wrote itself, not Apache 2.0 or MIT. It permits commercial use, modification and redistribution broadly, with one carve-out: a licensee running a "Model as a Service" business only needs to pass a Z.ai security review once its own Model-as-a-Service revenue, combined with its affiliates', exceeds $10 billion in any consecutive 12 months. For nearly everyone reading this, that threshold is irrelevant; it exists to cover the largest cloud providers reselling the weights, not an individual developer or a small team self-hosting for internal use.

Z.ai's own documentation lists several serving frameworks with published support for GLM-5.3: SGLang, vLLM, Transformers, KTransformers and Unsloth, plus Ascend NPU support through vLLM-Ascend and xLLM. One self-hosting detail differs from the hosted API's default and is easy to miss: in the open-weight chat template, clear_thinking defaults to false, meaning reasoning content from prior turns is preserved by default. For ordinary chat use rather than benchmark reproduction, Z.ai's own model card recommends explicitly passing clear_thinking=true instead.

How do you compare GLM prompting to what Claude or Qwen document?

If you've read how Claude or Qwen handle this, covered in How to Prompt Qwen Models, the pattern with GLM is closer to Qwen than it is to a vendor with a distinct prompting philosophy. Neither Chinese lab publishes an invented syntax; both publish parameter-level guidance (thinking-mode switches, sampling defaults) and expect ordinary structured prompting to carry the rest. DeepSeek, covered separately in DeepSeek Prompt Templates, fits the same pattern: no distinct syntax, just parameter-level guidance. Where GLM differs from Qwen specifically: Qwen still lets you disable thinking on its current flagship, while GLM-5.3 forces it on, and Qwen documents a prompt-level /no_think toggle that GLM does not have an equivalent for.

The reasoning-versus-chat distinction itself (when a "thinking" model needs a different prompt than a plain chat model, and what happens to sampling parameters when you switch) is covered vendor-by-vendor, GLM included, in Reasoning Models vs Chat Models: Prompt Them Differently.

One more genuinely useful, and underused, GLM-specific option: Z.ai documents an Anthropic Message Protocol endpoint (api.z.ai/api/anthropic) alongside its OpenAI-compatible one. Z.ai's own GLM-5.3 benchmark methodology runs its coding evaluations inside Claude Code itself, pointed at GLM through that endpoint. That's proof the compatibility layer is real, not just documented and untested.

Does Prompt Architects support GLM?

Not as a named integration, as of 3 September 2026. Our own /integrations page lists ChatGPT, Gemini, Claude, Grok, Perplexity, Kimi, Merlin, DeepSeek, V0.Dev, Bolt, Lovable, Base44 and our MCP server. GLM and Z.ai are not on it. What that means in practice: the in-page enhance menu that appears on the platforms above won't appear on Z.ai's own chat surface or a self-hosted GLM deployment's UI. Prompts built with our generator are plain text either way, so they carry over by copy-paste; if GLM support is something you'd use, that's a feature request rather than a gap we're pretending doesn't exist. Our free plan remains 5 prompt enhancements per day, forever, per the FAQ page, checked the same day.

The short version

GLM prompting is ordinary prompting, with three real parameter-level differences worth remembering: GLM-5.3 forces reasoning on and only exposes three effort levels, tool_choice supports nothing but auto, and caching is automatic rather than something you mark in the prompt. Z.ai does not publish a distinct prompting philosophy the way some vendors claim to. Its own closest document on how to prompt is generic coding-agent advice that name-checks Claude Code. And the version matters more than the technique here: GLM-5.2, the model most existing content still describes, was superseded by GLM-5.3 in mid-August 2026, with the same base model and only post-training separating them.

Frequently asked questions

Free Chrome Extension

Stop rewriting prompts. Start shipping.

Works with ChatGPT, Claude, Gemini, Grok, Midjourney, Ideogram, Veo3 & Kling. 4.8★ on the Chrome Web Store.

Create An Account