A note on how this was written: I drafted this from my own run logs and the harness is reproducible. The prose was edited with AI assistance, per dev.to's guidance on AI-assisted articles. The measurements, the failures, and the judgment calls are mine.
Engineers have a reflex about slow APIs, and I have it too: latency compounds, retries stack, CI sits blocked. So when GLM-5.4 answered in 176.4 seconds against DeepSeek V4.1 Flash at 77.6 on an identical prompt, the reflex said close the tab.
The reflex answers the wrong question. Latency is only waste if the slower call returns the same thing. If it returns something that would have cost three follow-up rounds to fix, two minutes are cheap. Everything below hangs off one decision: I would not trust my own eyes on that trade-off, so I built a grader first and let it decide.
Why eyeballing generated pages does not work
My first attempt at this comparison was worthless, and the reason is worth two paragraphs. I generated pages, opened them, screenshotted them, and judged. All of them looked fine. When I reopened a few days later, half the interactions were dead: the click handler existed but wrote into an element that had been renamed during generation. The page still rendered, still passed a glance, still failed a user.
Screenshots answer "does this look finished," which is not the question. The question is whether the thing keeps working when a stranger touches it. That is measurable, so measure it.
Both tasks below produce one HTML file with no external images, three.js as the only dependency. During load I abort every outbound request that is not three.js, so a page cannot pass on borrowed assets.
- Task one, inventory room. Floor, two rows of shelving, crates that lift and relabel a HUD on click, a light tracking the mouse, a rotating indicator sphere, drag to orbit, wheel to zoom, no horizontal overflow below 500px.
- Task two, incline. Block on a 30-degree slope, g 9.8, μ 0.3, acceleration computed live as g(sinθ − μcosθ), panel showing t, s, a, plus a restart button.
The four checks, and why each threshold sits where it does
Each check exists because a specific class of broken page defeats the check before it.
- Rendered. Non-background pixel share above 2%. Catches the blank canvas that still reports success, which is the most common false positive in generated frontends.
- Click bound. Click a fixed screen coordinate, read the HUD, require the text to change. Catches handlers wired to elements that no longer exist.
- Camera live. Drag once, require the frame delta to exceed twice the idle delta. Catches a canvas that renders but has no camera control, and catches a camera that moved once on load and then froze.
- Loop running. Sample ten times, require three distinct value combinations. Catches animation that runs one frame.
The double-the-idle threshold is not arbitrary. A rotating indicator sphere produces a nonzero idle delta, so requiring "some change" would pass a frozen camera. Requiring twice the idle delta means the drag has to do more than the animation already does on its own.
Task two adds an arithmetic assertion. Thirty degrees, g 9.8, μ 0.3 gives a = g(sinθ − μcosθ) = 2.354 m/s², hand-calculated. The panel shows 2.35 or it does not. Numeric answers are the one place a model fails in a way no screenshot reveals, and there is no partial credit.
The harness, trimmed to what matters
Python with Playwright against local Chrome. The frame-difference function is the whole trick, and it is deliberately dumb: downscale both grabs, count shifted pixels, divide by total. It has no opinion about aesthetics, which means two people running it get the same number.
from playwright.sync_api import sync_playwright from PIL import Image import io def diff(a, b): ia = Image.open(io.BytesIO(a)).convert("RGB").resize((200, 140)) ib = Image.open(io.BytesIO(b)).convert("RGB").resize((200, 140)) pa, pb = list(ia.getdata()), list(ib.getdata()) changed = sum(1 for x, y in zip(pa, pb) if abs(x[0]-y[0]) + abs(x[1]-y[1]) + abs(x[2]-y[2]) > 24) return round(changed / len(pa), 4) with sync_playwright() as p: b = p.chromium.launch(executable_path=CHROME) pg = b.new_page(viewport={"width": 1200, "height": 800}) pg.route("**/*", lambda r: r.continue_() if r.request.url.startswith("file:") else r.abort()) pg.goto("file:///" + html_path, wait_until="load") pg.wait_for_timeout(3500) shot = lambda: pg.screenshot() idle = diff(shot(), shot()) # baseline for a still frame pg.mouse.move(600, 420); pg.mouse.down() pg.mouse.move(900, 420, steps=18); pg.mouse.up() pg.wait_for_timeout(500) drag = diff(shot(), shot()) # camera actually moved? print("idle", idle, "drag", drag, "camera_live", drag > max(0.05, idle * 2)) I verified this logic against my own saved frames: comparing a screenshot with itself returns 0.0, and comparing a pre-drag frame with a post-drag frame returns 0.1381. That is the shape of a working check — zero on identical input, a clear signal on real motion.
What the grader reported
Three models, one endpoint, one messages array, only the model field changed. Temperature 1 across all three; caps of 32000, 24000 and 16384 for GLM-5.4, DeepSeek and Kimi respectively.
| Metric | Task | GLM-5.4 | DeepSeek V4.1 Flash | Kimi K3.1 Pro |
|---|---|---|---|---|
| Wait | inventory | 187.6s | 79.1s | did not finish |
| Wait | incline | 176.4s | 77.6s | 201.5s |
| Output tokens | inventory | 12914 | 18835 | — |
| Output tokens | incline | 13272 | 18184 | 12174 |
| Reasoning tokens | incline | 8626 (65%) | 15656 (86%) | 8684 (71%) |
| Decode speed | incline | 75.2 tok/s | 234.3 tok/s | 60.4 tok/s |
| Cost at list price | incline | ¥0.374 | ¥0.146 | ¥0.832 |
| Passed both | — | yes | yes | one of two |
Both GLM-5.4 pages passed on the first attempt, 14412 and 13618 characters, zero page errors, no missing canvas, no external request slipping through.
The part that reframes the whole comparison
Here is where the grader earned its keep, because the result contradicts the story I expected to write. Three explanations were on the table before I ran anything, and the numbers kill two of them outright.
| Explanation | What it predicts | What the run shows |
|---|---|---|
| It thinks harder on hard tasks | Reasoning share rises, so wall time rises | 65% reasoning share against 86%; it reasoned less |
| It writes more code | Output tokens exceed the competitor's | 12914 against 18835, a third fewer |
| The architecture is expensive per token | Throughput falls while token counts stay comparable | Consistent, but inseparable from queueing in this data |
The first two are the ones people repeat. Both are backwards here. GLM-5.4 produced a shorter answer, spent a smaller share of it reasoning, and still occupied 187.6 seconds where DeepSeek finished in 79.1. Tokens over seconds gives 68.8 against 238.1, a gap that stays roughly constant across both tasks (75.2 against 234.3 on the incline).
That leaves throughput as the mechanism and takes the moral content out of the number. A 2.3x wait is not a sign of deeper thought, and assuming it is leads directly to the wrong purchasing decision: you pay for deliberation you are not getting.
The architecture story is real but incomplete. GLM-5.4 runs a Loop Transformer, 78 layers of weights with layers 27 through 54 repeating as a 28-layer block, so a token traverses 106 layers while storage stays at the 78-layer figure of roughly 750B. More compute per token, yes. Whether that accounts for all of the gap, none of it, or something in between is not answerable from three API calls — queue depth, time to first token and backend load all land in the same wall-clock number, and I made no attempt to separate them.
The cap that cost more than the latency
Before the passing run, the incline task failed once, and this is the failure worth designing against.
At max_tokens 16000, GLM-5.4 spent 14178 tokens on reasoning, consumed 89% of the ceiling, and hard-stopped at 5268 characters. No canvas. Nothing rendered.
At 32000, same model, same prompt: 8626 reasoning tokens, 13618 characters, every check green.
Two failure shapes exist, and only one is expensive.
- Slow. You wait longer and get a working page. Cost: two minutes.
- Truncated. You wait, get a page with no canvas, find out when you open it. Cost: a rerun plus the detection time, and the broken version reads as plausible in a diff.
Reasoning-heavy models do not fail by answering wrongly; they fail by running out of room mid-answer. A tight cap yields half an answer, not a concise one. In any pipeline, read finish_reason before you read content: stop means the model finished, length means it was truncated and the artifact is probably unusable.
Cost at volume, and why it is the smaller issue
Two runs do not scale, so multiply by a hundred pages using list prices only.
- GLM-5.4. About ¥37.4, about 4.9 hours of wall clock.
- DeepSeek V4.1 Flash. About ¥14.6, about 2.2 hours.
- Delta. ¥22.8 and roughly 2.7 hours per hundred pages.
The money is not the problem. The time is. In an agent loop that fires a dozen calls per request, 2.7 hours per hundred pages turns into the difference between a coffee break and a lost afternoon.
The per-page arithmetic is repeatable, which is the only reason to trust it. The incline run: 13272 output tokens at ¥28 per million plus 292 input tokens at ¥8 per million, giving ¥0.374. No gateway billing data, no discounts.
One real advantage exists on the input side. Cache hits bill at ¥2 per million against ¥8 uncached, and agent workloads re-read the same files constantly. If your input is mostly repeated context, that gap narrows sharply. Output pricing does not move.
The same prompt, twice
Both cleared the grader; the differences are still measurable.
Non-background pixel share came out at 0.636 against 0.905. Drag delta: 0.1432 against 0.3496, with idle deltas of 0.0086 and 0.0049 — so both cameras genuinely engaged, and DeepSeek moved the view further per drag.
Neither figure grades quality. Low pixel share can be intentional negative space; high can be a camera pushed too close.
Where the grader goes blind is layout on a narrow screen. I detect horizontal overflow, and nothing else: not overlapping elements, not text too small, not a target outside thumb reach. Mobile still needs eyes.
Three things the grader got wrong
A grader that only confirms what you expect is decoration. Mine failed in three places, and the failures taught me more than the passes.
It cannot see taste. The inventory room passed every check with a pixel share of 0.636 while the DeepSeek version sat at 0.905. My instinct was to read that as the DeepSeek page being fuller and therefore better. It is not a quality signal: a page can hit 0.9 by filling the frame with grey boxes, and a page can sit at 0.6 because the model chose negative space. The number rules out a blank canvas. It says nothing about whether the composition works.
It cannot see a narrow screen. The only mobile check is horizontal overflow, and the threshold is two pixels. A layout where the HUD overlaps the canvas, or where the restart button lands under the browser chrome, passes. This is the gap I would close first if I were running this for real: a screenshot at 390×844 compared against a hand-labelled baseline would catch most of it.
It cannot see a lie that renders. A page that draws a convincing scene but computes acceleration wrongly looks perfect to every visual check. That is why task two carries the arithmetic assertion, and why one numeric question is worth more than four visual ones. The 2.354 m/s² target is the only check in the whole set that can be failed by a model that produced a beautiful artifact.
If I rebuilt this harness for a team, the fixes are short and none of them need a model to run:
- A 390×844 screenshot per task, paired with a hand-labelled baseline image, compared at the same 200×140 resolution the motion check already uses. That closes the mobile gap with the machinery already in the file.
- A DOM bounding-box pass that flags any element whose rect overlaps the canvas rect by more than 30%. Overlapping HUD panels are the single most common failure in generated Three.js, and they are trivially detectable.
- A human score recorded once per task, kept next to the automated numbers, so the gap between "passed" and "good" is visible in the report instead of living in someone's head.
The lesson generalizes past this model. If you are evaluating generated frontends at work, the checks that pay for themselves are the ones a stranger can run: a frame delta, a pixel count, a formula. Everything requiring you to look at it and judge is a check you cannot hand to a teammate or rerun against next month's model.
What volume does to the decision
The single-call comparison understates the cost, and the reason is agent loops rather than unit price.
- One call. 176.4 seconds against 77.6, a difference of 98.8 seconds. Nobody cares.
- Fifteen calls. The same ratio becomes 44 minutes against 19. This is where it starts to matter.
- A hundred pages. About 4.9 hours against 2.2, and roughly ¥37.4 against ¥14.6.
Notice that the money moves less than the time does. A ¥22.8 difference across a hundred pages is not a budget conversation; a 2.7-hour difference is a scheduling one, and scheduling is where teams actually feel it.
There is one place the pricing works in GLM-5.4's favour, and it is easy to miss. Cache hits bill at ¥2 per million against ¥8 for uncached input. Agent workloads re-read the same files over and over, so input is where repeated context piles up. If your pipeline is context-heavy and output-light, the input side of the gap largely disappears. Output pricing, where GLM-5.4 charges ¥28 against DeepSeek's ¥8, does not move at all.
That asymmetry produces a specific recommendation. Heavy context, short answers: the price difference is negligible and you should decide on latency and quality alone. Light context, long answers: you are paying the full 3.5x output premium on every call.
Wiring it up, and the one ID worth verifying
Direct and routed calls run the same code. Direct: register with the vendor, create a key, hit the OpenAI-compatible endpoint. Routed: change two strings.
I ran everything through one gateway so three models shared an endpoint, key and messages array — one fewer variable in the comparison, two fewer credential sets on my machine.
The one thing to verify is the model ID. GLM-5.4 is glm-5.4 on both sides, which is not universal: DeepSeek's line is deepseek-v4.1-flash on the gateway and named differently in vendor docs. Query /v1/models before writing the request instead of copying an ID from documentation describing a different surface.
This block is the one I actually executed; it returned stop with 718 completion tokens on a minimal task, which is how I confirmed the path before trusting it here.
import json, os, pathlib, urllib.request key = os.environ["CRAZYROUTER_API_KEY"] payload = { "model": "glm-5.4", "messages": [{"role": "user", "content": "Output only a single-file HTML page with one canvas and an h1 reading Inventory."}], "max_tokens": 32000, "temperature": 1, } req = urllib.request.Request( "https://api.crazyrouter.com/v1/chat/completions", data=json.dumps(payload).encode(), headers={"Authorization": "Bearer " + key, "Content-Type": "application/json"}, ) res = json.load(urllib.request.urlopen(req, timeout=600)) choice = res["choices"][0] print(choice["finish_reason"], res["usage"]["completion_tokens"]) pathlib.Path("scene.html").write_text(choice["message"]["content"], encoding="utf-8") Current models, context limits and per-item pricing are on the GLM-5 pricing and model page, and a catalog of coding models with context specs is on the AI coding models page. For reasoning controls and output limits, the vendor's own GLM-5.4 API documentation is primary.
Where this fits in a workflow
Three conditions, and together they are narrower than the marketing implies.
- Heavy tasks. A complete interactive scene in one pass, where rework is expensive, justifies two extra minutes. Button additions, style changes, form validators: rework is nearly free there and a slow model is pure cost.
- Low call count. 176.4 against 77.6 is 98.8 seconds once. Fifteen calls in a loop turns it into 44 minutes against 19.
- Rework must actually drop. The honest test is whether the first artifact opens and runs. All three models opened and ran here, so on this evidence GLM-5.4 saved nothing and spent time. Its self-check loop pays off on long multi-round builds, which this test does not cover.
My split: DeepSeek V4.1 Flash for plumbing, debugging, endpoint checks and bulk variants; GLM-5.4 for the single complete generation before shipping; Kimi K3.1 Pro only when the visual bar makes the difference visible, at ¥0.832 a page.
What I did not verify
Eight artifacts stand behind this article: five from the public write-up, three from community authors. Three screenshots and six data groups are mine, and that mix bounds every claim.
- Supported. Two tasks passed automated acceptance first try; the incline arithmetic matched hand calculation; 2.3x slower than DeepSeek behind the same interface; reasoning share lower than DeepSeek's.
- Not supported. All frontend tasks passing first time, generally stronger physics, slower everywhere, or a compute-efficiency advantage from the Loop design.
- Not my measurement. The 78-layer structure, the 28-layer repeat and the 106-layer path come from the vendor's technical note.
Passing the grader is not delivery. Accessibility, keyboard operation, touch gestures, memory use and first paint went untested. Kimi's inventory run produced no valid artifact and is recorded as unfinished rather than estimated. Prices are vendor list rates times actual tokens, with no gateway billing data and no discounts. Measurements ran 16:30–17:15 Beijing time, inside DeepSeek's defined peak window, so its cost uses peak rates; off-peak would roughly halve that column.
References
- 阿枫科技, "GLM-5.4杀回国模第一,它变慢了,也变强了", 2026-12-03. Source of the five builds and three community projects.
- Zhipu, GLM-5.4 technical note, 2026-11-23. Loop Transformer layers, gated updates, hybrid KV cache, sparse index reuse.
- Zhipu Open Platform, GLM-5.4 pricing and model docs, checked 2026-12-04. ¥8 input, ¥28 output, ¥2 cache hit per million; 1M context, 128K max output.
- DeepSeek, model and pricing page, checked 2026-12-04. V4.1 Flash ¥2 input, ¥8 output at peak; half off off-peak.
- Kimi Open Platform, inference pricing, checked 2026-12-04. kimi-k3.1-pro ¥13 input, ¥68 output, ¥1.3 cache hit.


