GLM-5.4 vs GPT-6.2 Astra for Coding

Z.AI’s new coding model, GLM-5.4, matched Claude Opus 5.5 on a broken booking app in our last comparison: both fixed the failing test and made the booking button usable on a phone. This time we put GLM up against OpenAI’s GPT-6.2 Astra to see what the extra money buys when you ask a model to change code it just wrote.
We gave both models two jobs a developer might get on the same app: add a feature, then revise it without breaking what already works. The first job was to build a paint bucket that fills only the area you click. For the second, each model got its own code back and had to make Undo reverse an entire fill while preserving the previous edit. We used a tiny pixel-art robot so you can judge both versions with the same click instead of reading two pages of code.
TL;DR
- GLM-5.4 accepts code and screenshots and has a 1-million-token context window. You can give it source files and a picture of the bug in the same request.
- Both models added a second feature without breaking the first. Astra returned HTML ready to save on both attempts. GLM wrapped its first file in Markdown, an extra step if your build expects plain HTML.
- AI/ML API lists GLM at $1.19 per million input tokens and $3.74 per million output tokens. Astra is $8 and $40, respectively. GLM used more tokens on the revision, yet the same change prices out to 1.93¢ with GLM and 9.55¢ with Astra.
GLM vs GPT: coding results at a glance
| What we checked | GLM-5.4 | GPT-6.2 Astra |
|---|---|---|
| Paint bucket, first delivery | 6/6 behavior checks; 42.1 s | 6/6 behavior checks; 40.0 s |
| Undo revision, including the original checks | 10/10 | 10/10; 41.7 s |
| Final PNG after Undo | 8×8; 0 wrong pixels | 8×8; 0 wrong pixels |
| Delivered plain HTML as requested | First answer fenced; second plain HTML | Both answers plain HTML |
| Paint bucket: tokens | 1,888 in + 2,780 out = 4,668 | 1,896 in + 1,875 out = 3,771 |
| Paint bucket: cost at API rates | $0.0126 | $0.0902 |
| Undo: tokens | 2,156 in + 4,465 out = 6,621 | 2,155 in + 1,956 out = 4,111 |
| Undo: cost at API rates | $0.0193 | $0.0955 |
Both models got the same pixel editor, the same first task and the same high reasoning setting. First they had to add a paint bucket. Then each got its own code back: make one click undo a whole fill without losing the edit before it. Both passed all ten checks. The difference showed up in how much they wrote, what you could save straight to a file and what the revision costs at API rates.
The dollar rows apply GLM-5.4 and GPT-6.2 Astra pricing on AI/ML API to each run’s input and output tokens, using the uncached input rate.
We gave each model one attempt per task, a fresh session and ten minutes to return a file. GLM ran in OpenCode through the Z.AI Coding Plan; Astra ran in Codex. Both received the high reasoning setting and neither could call tools.
The one-click test: change one eye, leave the other white
Change one eye, leave the other white.
Tap the left eye to fill it in both editors, or choose any pixel.
In the recorded test, both editors filled the left eye and left the right eye white.
GLM-5.4
2 pixels changed
GPT-6.2 Astra
2 pixels changed
A bucket should follow a color through shared edges, not across a corner. Both implementations did exactly that. In the diagonal example, they filled the connected pair and left the third magenta pixel alone. You can pick a different starting pixel to test a different region.
Astra returned HTML ready to save. GLM enclosed its first file in a Markdown code fence. Its code passed all six browser checks; we removed the fence before saving the demo and sending the file back for the Undo revision.
The Undo test: which edit survives?
Undo the last edit. Will the cyan eye survive?
First, a cyan bucket fill in the left eye. Then, a stray magenta pencil mark on the antenna.
GLM-5.4
1 pixel changed at (3, 0)
GPT-6.2 Astra
1 pixel changed at (3, 0)
Both models saved a copy of the pixel grid immediately before a real edit. One snapshot is enough for this ticket: a bucket can touch several pixels, but restoring the snapshot reverses the entire action. Both discarded the snapshot after Undo and cleared it on Reset. They also preserved it when a click changed nothing. That last detail prevents a frustrating bug: touching an already-cyan eye should not make the previous genuine edit irreversible.
There was a small difference in their fill code. GLM kept a separate set of visited cells. Astra recolored each matching neighbor before adding it to the worklist, so the new color also marked the cell as visited. Neither approach produced a different picture. On a 64-pixel canvas, we would not choose between them on performance grounds; we measured delivery time, not algorithm speed.
The download test: did the discarded pixel come back?
The original editor already knew how to export. The question was whether that feature survived two changes. We captured the visible canvas, clicked the real download button, decoded the resulting PNG and compared both images separately against an expected grid. Comparing only the screenshot to the download would have let two identically wrong images pass.

Both downloads matched all 64 expected pixels, and the same check caught the broken editor that showed a black antenna on screen but saved one magenta pixel at (3, 0).
Can you read an 8-pixel wink?
The PNG that survived Undo became the next brief: make this robot wink once, then return to its original expression. Both models received the same image. Which wink can you spot at the size of a chat reaction?
Watch the white eye on the right. Astra draws the closed lid on the lower row, then reopens it in two steps. GLM draws the lid one row higher, holds it for 300 milliseconds and snaps straight back to open. Astra uses five frames over 1.28 seconds; GLM uses four over one second. Both GIFs play once and finish on the exact starting PNG.
How the GIFs were made
Each model supplied its own pixel grids and frame timings with high reasoning requested. We encoded those instructions as GIFs using the same encoder. Astra’s first response was not captured because our local reader rejected its response format; its animation comes from a separate run of the same brief. GLM’s comes from its first submission. We did not compare generation times for this exercise. The chat plays the saved results locally.
GLM-5.4 coding benchmarks: what has Z.AI published?
As of December 1, 2026, we couldn’t verify a public coding benchmark that tested both GLM-5.4 and GPT-6.2 Astra under the same conditions. Z.AI’s GLM-5.4 comparison chart reports a 51.1% win rate against GLM-5.3, 41.8% against Kimi K3.1 Pro and 36.6% against DeepSeek-V4.1-Flash-1017. It names no coding suite and does not include Astra. The separate benchmark table in the release article covers a 30B research model. Our ten browser checks answer a narrower question: could each flagship revise this editor without breaking its existing tools or its PNG export? Both did.
Which model fits your coding workflow?
For a queue of small edits with clear acceptance tests, we’d start with GLM-5.4. At AI/ML API rates, its revision comes to 1.93¢ and passes the same ten checks as Astra’s. If your pipeline saves answers directly to disk, check for Markdown fences first.
For a developer waiting on a revision, we’d try Astra first. It delivered working Undo in 41.7 seconds and returned plain HTML on both tickets. The first feature was much closer: Astra took 40.0 seconds and GLM took 42.1. Those are single runs on the two subscription routes.
To repeat the comparison on your own models, start with the original HTML, keep the second ticket hidden until the first answer is saved, and grade the exported file as well as the screen. The evidence download includes the editor tickets, browser checks and both GIFs.
Frequently asked questions
Can I use GLM-5.4 on the Coding Plan, or do I need the API?
All GLM Coding Plan tiers include GLM-5.4 in supported coding tools. Use the Coding Plan for interactive work in OpenCode. For an application that sends requests by token, see the GLM-5.4 API model card for the model ID and pricing.
What happens when I reach the GLM Coding Plan limit?
Supported tools draw from the same subscription quota. When you reach the five-hour limit, calls do not automatically switch to your cash balance. A separate weekly limit resets on a seven-day cycle. Check your allowance in the subscription dashboard or see Z.AI’s quota rules.
How much would GLM-5.4 and GPT-6.2 Astra cost for the same coding task?
At AI/ML API’s uncached rates, adding the paint bucket comes to $0.0126 with GLM-5.4 and $0.0902 with GPT-6.2 Astra. Adding Undo comes to $0.0193 and $0.0955, respectively. GLM used 4,465 output tokens for Undo versus Astra’s 1,956; its lower output rate more than covered the difference.



