Blog

GLM-5.2 Catches Up with Claude Opus 4.8: The Open Model Costs 5 Times Less

Markdown

GLM-5.2 from Z.ai codes almost as well as Claude Opus 4.8, but costs many times less. I examine the tests, prices, and how to connect the open model to Claude Code in 5 minutes.

Read full article

The essentials

Updated in September 2026: GLM-5.3 (August 14) followed GLM-5.2, and all the figures below are now about it. GLM from China's Z.ai codes at the level of Claude Opus 4.8, and in some areas even surpasses it, while costing many times less and being openly available. For routine work, frontend tasks, and medium-sized edits, it replaces Opus at one-fifth the price. Opus is still more reliable on the longest autonomous tasks, although the SWE-Marathon gap in Z.ai’s table fell from 29.4 to 6.3 percentage points. Below are the honest figures and how to connect GLM to Claude Code in 5 minutes.

Ailoot documentation — reference materials on using the service.

What Is GLM-5.2, and Why Is Everyone Talking About It?

The essentials

GLM-5.2 is a model from Beijing-based Z.ai (formerly Zhipu), released on June 13, 2026, the day after the US government forced Anthropic to disable its top models, Fable 5 and Mythos 5. The current version of the lineup is GLM-5.3 (August 14, 2026). The family's main feature: code quality close to Opus, with open weights and a price many times lower.

Two weeks ago, something rare happened in the coding community: an open model from China pulled level with the most expensive Claude.

Here's the gist. GLM is a huge model: 753 billion parameters, but only a small portion (about 40 billion) is activated for each request, so it's fast and cheap despite its size. Its context window is 1 million tokens, roughly a 700-page book in one go. It was developed by Z.ai, a Beijing-based company that grew out of Tsinghua University. The key point: the model is openly available. GLM-5.2 has an MIT license; GLM-5.3 has its own GLM-5.3 License, similarly permissive in spirit: take it and use it. The only restriction applies to giants—services with annual revenue of $10 billion or more must pass Z.ai's security review. The scenario described has no regional blocks, unlike Claude.

The timing worked in its favor. The day before its release, a US government directive forced Anthropic to urgently shut down two top models.

We received a directive from the government today at 5:21 p.m. Eastern Time. To comply with its requirements, we have to abruptly disable Fable 5 and Mythos 5 for all our customers.

— Anthropic, https://www.anthropic.com/news/fable-mythos-access

GLM-5.2 came out the next day—open, without locks, and cheap.

For an entrepreneur, that means one thing: a strong Claude competitor has arrived at the price of a cup of coffee.

Then the lineups went wild. On July 24, Anthropic released Opus 5 at the same price—$5 and $25 per million tokens. GLM-5.3 followed on August 14: the same 753 billion parameters and million-token context, but noticeably better at coding—50% higher than GLM-5.2 on Z.ai's internal test. On September 1, Anthropic unveiled Fable 5.1 and Mythos 5.1. So from here on, the figures in this article are for the current version, GLM-5.3.

Has GLM-5.2 Really Caught Up with Claude at Coding?

The essentials

With the release of GLM-5.3, the picture changed. In Z.ai's official table, it beats Opus 4.8 on five of seven tests and has nearly closed GLM-5.2's main weakness—multi-hour tasks (SWE-Marathon: GLM-5.2 19.4, GLM-5.3 42.5, and Opus 4.8 48.8 in the same reported table). Opus 5 isn't included in this table, and there are no independent measurements of “GLM-5.3 versus Opus 5” yet. The honest answer is this: GLM-5.3 is now ahead of Opus 4.8; against Opus 5, we don't know.

The figures below come from GLM-5.3's official HuggingFace model card. Z.ai compares its model with Opus 4.8, not Opus 5—keep in mind that this is their table.

TestGLM-5.3GLM-5.2Opus 4.8What it shows
Terminal-Bench 2.1 (terminal work)88.281.085.0GLM-5.3 is ahead
Terminal-Bench 3.028.34.621.1A sixfold leap; Opus 4.8 is behind
DeepSWE (real tasks from repositories)66.946.258.0GLM-5.3 is ahead
FrontierSWE (medium-sized tasks)78.167.566.5GLM-5.3 is ahead
NL2Repo (edits in a large project)58.048.969.7Opus is still better
SWE-Marathon (multi-hour tasks)42.519.448.8Gap falls from 29.4 to 6.3 percentage points
CyberGym (finding vulnerabilities)84.577.278.1GLM is the best

The picture is this: GLM-5.3 beats Opus 4.8 almost everywhere and falls behind where the task is to rewrite a whole section of a large project or keep track of a multi-hour task without losing the thread. On this multi-hour benchmark, the reported gap narrows by 23.1 percentage points: (48.8 − 19.4) − (48.8 − 42.5) = 23.1. That is about a 79% reduction in the gap, not a halving; it describes this table rather than a measured reliability rate on your project. Long autonomous work is the last frontier where Opus still holds firm.

The takeaway from the tests: GLM-5.3 has caught up with and surpassed Opus 4.8 on everyday coding, and is almost level on the hardest tasks. We'll say how it compares with Opus 5 when independent measurements appear. For most entrepreneur tasks, the current lead is enough.

How Much Cheaper Is GLM-5.2 Than Claude?

The essentials

Per token, GLM-5.3 is 3.5 times cheaper than Opus 5 on input and nearly 6 times cheaper on output—the prices haven't changed for either side since the previous generation. On a monthly bill under a typical workload, the difference comes to about 5 times. There's a catch, though: GLM burns more tokens on the same task, so the actual savings on a specific task range from 2 to 7 times.

Here's what this is all about. Let's compare the prices per million tokens.

ModelInput ($/1M)Output ($/1M)
GLM-5.3 (directly from Z.ai)$1.40$4.40
Claude Sonnet 5$2.00$10.00
Claude Opus 5$5.00$25.00
Claude Mythos 5.1 (the most expensive Claude)$10.00$50.00

The price difference is enormous: GLM's output is 6–8 times cheaper.

But here's the catch, honestly. GLM is configured to double-check itself before submitting, so it uses noticeably more tokens for the same task (GLM-5.3's reasoning mode is always on and can't be turned off).

So the actual savings on a specific task are somewhere between 2 and 7 times, depending on how much GLM has to double-check itself. That's less than the “5 times” promised by the price, but it's still money left in your pocket. GLM is one way to pay less; I have separate breakdowns of DeepSeek and other cheap models for coding.

Saving on one model is only the beginning. It's much more important to build a system where Claude stops hallucinating with any model. The model you choose is the engine. What you put into the context makes the car.

How to Connect GLM-5.2 to Claude Code in 5 Minutes

The essentials

There's nothing to download—GLM connects to your regular Claude Code through environment variables. The way described here is a Z.ai subscription (from $18 a month, simplest for daily work). Below are the exact steps; copy and paste.

The best part: you don't change tools. Claude Code stays, and only the model answering under the hood changes. Connecting it takes a couple of lines in the settings.

Option 1 - Z.ai subscription (for daily work)

Z.ai offers a special GLM Coding Plan subscription tailored to coding tools. The price is fixed, and the API endpoint speaks Claude Code's native language.

  1. Subscribe

    Go to z.ai/subscribe and choose a plan. Lite starts at $18 a month (enough for a full day of intensive work); there are more expensive plans for those who code all day.

  2. Create a key

    On z.ai, go to API Keys, click “Create a new API key,” and copy it.

  3. Set the configuration

    Open the file ~/.claude/settings.json and paste the block below, replacing the placeholder with your key.

  4. Restart the terminal

    Open a new terminal, run claude, and enter /status to check.

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your_z_ai_key",
    "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-flash[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.3[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.3[1m]",
    "API_TIMEOUT_MS": "3000000"
  }
}

Warning

Two common mistakes in other guides. First: the variable is called ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY. Second: the address for Claude Code is specifically https://api.z.ai/api/anthropic (Anthropic format). The bare /api/paas/v4 won't work with the subscription.

After this, Claude Code will show the names “Opus” and “Sonnet” but run GLM under the hood—Z.ai swaps out the model on its side. If you still have glm-5.2 set in your configuration, that's fine: Z.ai itself routes requests for GLM-5.2 and 5.1 to GLM-5.3, and requests for GLM-4.7 to GLM-5.3-Flash.

Running Locally at Home - Honestly, It's Unrealistic

Since the weights are open, the obvious question is: can you download it and run it for free yourself? For an entrepreneur without their own server, no.

GLM-5.3, with the same 753 billion parameters, requires a server on the scale of eight H200 graphics cards (that's more than a terabyte of video memory and hardware costing hundreds of thousands of dollars). Even on a top-tier laptop, it simply won't run. The open license is about something else: price competition and the absence of blocks. You'll still use it through an API.

When Should You Use GLM-5.2, and When Should You Keep Claude Opus?

The essentials

The simple rule: GLM is a cheap workhorse for 80% of coding; Opus is an expensive, reliable specialist for hard tasks. Use GLM for drafts, iterations, frontend work, and routine tasks where redoing the work isn't a big deal. Keep Opus for final, complex architecture, long multi-step tasks, and critical logic where getting it “right the first time” matters.

You don't need to choose one model forever. Smart vibe coders keep both and switch based on the task. Here's a practical rule based on practitioners' feedback.

Use GLM when:

  1. Drafting and iterating—sketch something out, review it, redo it.
  2. Frontend, layout, and standard database code.
  3. A large volume of cheap routine work where redoing it is fine.
  4. You need a large context window for pennies.
  5. You simply want to pay less for the 80% of tasks that are easier.

Keep Opus when:

  1. Writing final, complex architectural code.
  2. A long, multi-step task where the agent mustn't get stuck.
  3. Critical logic where the cost of an error is high.
  4. You need it right the first time—Opus needs half as many corrections.

GLM-5.2 had a documented weakness: on long, multi-step tasks, it sometimes got stuck in loops, repeating the same actions. In Z.ai’s reported SWE-Marathon table, GLM-5.3 narrows the gap to Opus 4.8 from 29.4 to 6.3 percentage points (42.5 versus 48.8). Opus still scores higher on that test, but this does not by itself measure reliability on your own long autonomous tasks.

And here's the trap: the cheapest tool doesn't always lead to the cheapest work. If GLM does a poor job three times and you have to finish by hand, the cheap model ends up costing more than Opus, which would have got it right the first time. Count the cost of a finished result, not the price per token. And if you stick with Claude—which model to choose for the task, Sonnet or Opus, is something I cover separately.

What Access and Payment Conditions Should You Consider?

The essentials

The source material describes one payment option: a Z.ai subscription.

Tip

If you need a fixed subscription for Claude Code and have a card accepted by the payment gateway, Z.ai Coding Plan is the option to consider.

What Are the Risks and Pitfalls?

The essentials

Three downsides. Privacy: this is a Chinese model, and data goes to Z.ai's servers (the legal entity is in Singapore; its policy promises not to store or train on your code, but there's no independent audit). Stability: GLM's API was down for a couple of days in June because of overload. And there's the general risk of any third-party AI—never send it secrets or customer data.

Low cost doesn't mean completely free. Here's what you need to know in advance.

Privacy. The international Z.ai service is registered to a Singaporean company, and its policy for API access looks decent: it says materials aren't stored or used to train models without your explicit consent. But these are policy promises, not audited guarantees—there's no public security certificate. The parent company is Chinese, and Chinese law could theoretically require access to data. Also, in January 2025, Zhipu was added to the US export control list. That limits what the company can buy from the US; it doesn't ban the use of its models, but it's a signal to keep in mind.

Stability—the most tangible downside. In mid-June, when GLM-5.2 launched, the API was down for a couple of days because of strict load limits: during peak hours, as many as half of requests were rejected. For production work, that means keeping Claude as a fallback and not depending entirely on a single model.

General security advice. This applies to any third-party AI, and deserves twice the attention with a Chinese one. Never put secrets or personal data in a prompt: API keys, the contents of a password file, real customer emails and phone numbers, or production database dumps. Policies are promises, not cryptographic locks. I cover project security in more detail in the guide to vibe coding security.

Should You Switch to GLM-5.2?

The essentials

If Claude's cost is a constraint for you—yes, try it right now; setup takes 5 minutes. Keep GLM for routine work and Opus for hard tasks, and pay less for the 80% of easier tasks. But remember the main point: 80% of the result depends on what you put into the context. A cheap model without a well-configured context produces garbage.

As of the source material's update on October 1, 2026, the stakes have risen with the release of GLM-5.3: the open model is once again many times cheaper, and now it is ahead of Opus 4.8 in Z.ai's table. For an entrepreneur worried about burning through the entire budget on Claude limits, this is a direct answer.

But I'd warn against the illusion that it's only about choosing a model. Practitioners all say the same thing: vibe coding most often breaks for one reason—the model wasn't given context. I've seen people choose cheap GLM, fail to configure context engineering, and get garbage—then blame the model.

So my advice is simple. Connect GLM today, try it on your own tasks for a week, and keep Opus for the hard ones. At the same time, work on what really makes the difference—context management. Then even a cheap model will give you a stable result.

Additional materials are available on Ailoot.

More details

Questions about GLM-5.2 Catches Up with Claude Opus 4.8: The Open Model Costs 5 Times Less

How much did the reported SWE-Marathon gap actually shrink?

Using the same table, Opus 4.8 minus GLM-5.2 is 48.8 − 19.4 = 29.4 percentage points; Opus minus GLM-5.3 is 48.8 − 42.5 = 6.3 points. The gap shrinks by 23.1 points, about 79 percent, in that vendor-reported comparison.

Does a lower token price guarantee a cheaper completed task?

No. Record total input and output usage, failed attempts, and accepted results on your own tasks. Extra iterations or unfinished work can outweigh the lower per-token price, so compare cost per finished result rather than the price list alone.

All articles