Free guide

GLM-5.4: The Model That Runs Its Layers Twice (and How to Use It in Claude Code)

Z.ai made its new flagship smarter without making it bigger: it sends every token back through the same 28 layers a second time. What that means, how to switch Claude Code to it today, and the catch.

By Beau Johnson·
The Short this guide goes with: GLM-5.4: The Model That Runs Its Layers Twice (and How to Use It in Claude Code)

Quick answer

GLM-5.4 is Z.ai's (Zhipu AI's) new flagship model and its first Loop Transformer: it reuses 28 layers of the GLM-5 base model across two passes, so it reasons more deeply without adding parameters. Z.ai says it reaches intelligence levels comparable to 2T to 3T parameter models (its own claim; no independent tests yet). Right now you can only use it through the GLM Coding Plan (from $18 a month) inside supported tools like Claude Code; the regular API opens after a security review.

The short version

  • GLM-5.4 runs a block of 28 layers twice (two passes with shared weights) instead of adding new layers. Z.ai says it performs like a 2T to 3T parameter model.
  • It's live for every GLM Coding Plan tier (Lite, Pro, Max). Weekly-quota plans get 1.5x the GLM-5.3 quota for GLM-5.4. The model API and the open weights aren't out yet.
  • Z.ai's own known issue: it can get stuck in long 'marathon thinking'. The default effort is max, so drop it with /effort on quick jobs.

How it actually works

Origami, not a bigger sheet

A better paper crane doesn't need a bigger sheet of paper. It needs more folds. In a model, the sheet is the weights (the parameters) and the folds are the work done on each token. A normal Transformer runs each layer once. GLM-5.4 takes a group of 28 layers and runs them a second time, with the same weights, so the network is deeper without getting any bigger.

Pass one roughs it out, pass two sharpens it

Z.ai added a small gate for each pass that decides how much of the new result to write back. After training, the first pass learned to build the overall context and write carefully, and the second pass reuses that state and refines the output with full updates. On harder tokens the first pass writes more aggressively.

Why looping didn't win before

The idea isn't new: the 2018 Universal Transformer already shared weights across depth. But looped models trained from scratch kept falling behind normal models on the same training budget. Z.ai's move was to start from the already-trained GLM-5 base model and teach it to loop with continued training, which it says raised the ceiling for a small amount of extra compute.

Keeping the second pass cheap

A naive loop would need a full memory cache (KV cache) for every pass. GLM-5.4's second pass reuses the first pass's sparse cache and only keeps its own small sliding window, and it reuses the first pass's attention indices, so an extra loop costs about one sliding window of memory instead of a whole second context. Z.ai says that keeps the extra running cost over GLM-5.3 under control, even at 1M tokens of context.

How to set it up

  1. 1.Pick a GLM Coding Plan

    GLM-5.4 is in every plan: Lite, Pro and Max. Plans start at $18 a month. Each plan has a 5-hour limit and a weekly limit (Lite: 2,000 credits per 5 hours, 10,000 per week). Off-peak use costs half the credits.

    https://z.ai/subscribe?plantype=individual
  2. 2.Create your Coding Plan API key

    In the Z.ai platform go to Personal Coding Plan > Plan Overview and create a key. Coding Plan keys, Team Plan keys and normal API keys are separate and don't work for each other.

  3. 3.Install Claude Code (or let Z.ai's helper do it)

    You need Node.js 18 or newer. Z.ai's Coding Tool Helper can install the tool and set the plan up for you.

    npm install -g @anthropic-ai/claude-code
    # or
    npx @z_ai/coding-helper
  4. 4.Point Claude Code at GLM-5.4

    Add these keys to the env block in ~/.claude/settings.json (don't replace the whole file if it already has other settings). This follows Z.ai's model-switching page; its older Claude Code page puts glm-5.3-flash[1m] in the Haiku slot instead, which also works. The [1m] suffix turns on the 1M token context. Open a new terminal afterwards.

    {
      "env": {
        "ANTHROPIC_AUTH_TOKEN": "your_zai_api_key",
        "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
        "API_TIMEOUT_MS": "3000000",
        "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.4[1m]",
        "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.4[1m]",
        "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4[1m]"
      }
    }
  5. 5.Check it switched

    Start Claude Code in your project and run /status. The model line should say glm-5.4 or glm-5.4[1m]. If it says the [1m] model doesn't exist, update Claude Code and try again.

    cd your-project
    claude
    /status
  6. 6.Set the effort for the job

    Type /effort to change how hard it thinks. The default is max, and Z.ai recommends max for coding tasks. My take: for quick edits and questions, try a lower level so you don't wait on the long 'marathon thinking' runs Z.ai warns about.

    /effort

The fine print

  • Price: Z.ai's docs say plans start at 18 USD a month. Check z.ai/subscribe for the live price and billing period before you buy.
  • GLM-5.4 is only on the GLM Coding Plan for now. Z.ai says the model API opens after its security assessment, and the weights will be released 'responsibly' (no date).
  • The Coding Plan only works inside officially supported tools (Claude Code, Codex, Cline, OpenCode, Kilo Code, Roo Code, Crush, Goose, Cursor and others). It isn't a general API key.
  • 'Comparable to 2T to 3T parameter models' and the win-rate chart are Z.ai's own numbers. There's no independent benchmark yet.
  • Known issue from Z.ai: it tends to get caught in overly long 'marathon thinking' loops. Z.ai says the extra reflection does improve accuracy, so it's a speed and quota trade-off.
  • Speed: up to 200 tokens per second off-peak and 70 to 80 at peak, per Z.ai. Peak hours are Monday to Friday, 14:00 to 18:00 Singapore time.

FAQ

What is a Loop Transformer?

A model that runs a group of layers more than once with the same weights. GLM-5.4 reuses 28 layers of the GLM-5 base model for two passes, so it gets a deeper network without adding parameters.

Can I use GLM-5.4 through the API?

Not yet. Z.ai says the model API will open after its security assessment. Today it's only available on the GLM Coding Plan inside supported coding tools.

How much does the GLM Coding Plan cost?

Plans start at $18 a month (Lite), with Pro and Max for heavier use. All three include GLM-5.4, GLM-5.3 and GLM-5.3-Flash.

Is GLM-5.4 open source?

Not yet. Z.ai's launch post says the weights 'will be released responsibly' but gives no date.

Why does GLM-5.4 think for so long?

Z.ai lists it as a known limitation: it tends to get caught in long 'marathon thinking' loops, though Z.ai says the extra reflection improves accuracy. In Claude Code you can change the level with /effort (the default is max).

Sources

Facts checked 2026-11-23 against Z.ai's GLM-5.4 docs page, the GLM Coding Plan overview, quick start, Claude Code and latest-model pages on docs.z.ai, and the @Zai_org launch post (11,309 likes when checked).

Want help building with tools like this?

Join the Shipping Skool community free. Paid members get live bootcamp calls every week and weekly-updated courses.

Join Shipping Skool

More free guides