DEV Community

Cover image for GLM-5.4 vs. Gemini 4 Argon: Open-Weight Route vs. Closed API Tested on 4 Engineering Tasks
boluo
boluo

Posted on

GLM-5.4 vs. Gemini 4 Argon: Open-Weight Route vs. Closed API Tested on 4 Engineering Tasks

When indie developers evaluate an LLM for production agent workflows, the debate usually starts with open-weight lineage versus closed cloud API. An open-weight family promises on-premises data control and local LoRA fine-tuning; a closed cloud API saves you from buying GPUs and babysitting inference servers. Now that Z.ai's GLM-5.4 (750B Loop Transformer) and Google's Gemini 4 Argon can both be called through a single OpenAI-compatible endpoint, how do their actual outputs hold up when you ask them to debug a broken MCP server, enforce a strict Markdown table schema, size an air-gapped intranet cluster, or write a high-risk PowerShell cache cleaner?

On November 26, 2026, I ran those exact four engineering tasks against glm-5.4 and gemini-4-argon using identical Chinese prompts, temperature=0.1, top_p=0.7, and a fixed max_tokens=2400 output cap (all eight raw JSON logs are archived in evidence/). This English postmortem analyzes the recorded responses from that Chinese-prompt run. Here is what stood out immediately:

  • Neither model won every round—they failed in completely different ways: GLM-5.4 was faster at initial fault isolation and wrote a runnable PowerShell script, while Gemini 4 Argon was much stricter with formatting boundaries, token caps, and enterprise authentication edge cases.
  • Under a 2,400-token ceiling, Gemini 4 Argon finished 3 of 4 tasks while GLM-5.4 truncated 3 times: Because GLM-5.4 counts internal reasoning_tokens (73 to 568 tokens per call) inside completion_tokens, three of its four responses hit finish_reason="length" mid-sentence.
  • On first-pass debugging speed, GLM-5.4 beat Argon by 22 seconds: GLM-5.4 returned its four-domain GitHub MCP troubleshooting tree in 27.32 seconds versus 49.26 seconds for Argon.
  • Both models generated two dangerous operational traps: Both C-drive cleanup scripts added local open-source model weight directories (ollama\models) to their target lists, and Argon introduced a fatal PowerShell syntax bug on line 28 (foreach ($ path in $KnownAIPatterns)).

TL;DR Routing Matrix: Where GLM-5.4 and Gemini 4 Argon Win or Break

Before wiring either model into your CLI or agent runner, use this routing matrix based on our eight recorded API responses:

Engineering Task Stronger Model in This Run Recorded Evidence (evidence/*.json) Mandatory Human Fix Before Shipping
C-Drive >10GB AI Cache Cleanup (05-cleanup) GLM-5.4 (runnable dry-run) GLM-5.4 finished body in 29.15s; Argon (31.55s) wrote $ path syntax error on line 28 Remove ollama\models and huggingface\hub from target arrays in both scripts
Codex GitHub MCP Timeout Runbook (02-troubleshooting) Pair Both GLM-5.4 (27.32s) split local stdio vs. remote URL; Argon (49.26s) caught SAML SSO Delete cat "$f" config dump; fix Argon's .codex/config.json to .codex/config.toml
Air-Gapped Intranet + LoRA Sizing (04-architecture) Gemini 4 Argon (more honest) Proposed local Gemma QLoRA + [CLIENT_A] redaction proxy before cloud API calls Discard both models' 24GB/48GB single-card GPU quotes; recalculate for 750B
4-Column Table + 150-Char Floor (03-format) Gemini 4 Argon (2.1x leaner) Obeyed 1-row scope in 487 tokens (17.57s); GLM-5.4 padded 4 extra rows (1,044 tokens) Inject current model card and LICENSE text so neither claims the model is unreleased
Long-Form Output Under 2,400-Token Cap Gemini 4 Argon (3/4 stop) 0 billed reasoning tokens in breakdown; GLM-5.4 spent up to 568 tokens on reasoning Raise max_tokens to 4096+ whenever calling glm-5.4 for scripts or runbooks

All eight calls were executed through Crazyrouter's unified OpenAI-compatible gateway so the request payload and client code remained identical. You can inspect the route details on the GLM-5.4 model page and check live model IDs in the Crazyrouter model catalog and pricing.

Keep one architectural distinction clear: calling an open-weight-lineage model ID like glm-5.4 over a hosted API endpoint still transmits your prompt over the internet. A unified gateway simplifies multi-model routing, but it does not turn an external API call into air-gapped self-hosting. The shared base URL used in evidence/run_cases.py is:

https://api.crazyrouter.com/v1
Enter fullscreen mode Exit fullscreen mode

Audit 1 — PowerShell Cache Cleanup and GitHub MCP Debugging with GLM-5.4 and Gemini 4 Argon

Developers who run local open-source weights (Ollama, Hugging Face) alongside cloud coding agents (Codex + GitHub MCP) constantly deal with two maintenance headaches: reclaiming disk space on a bloated C: drive and diagnosing MCP tool timeouts. Here is what happened when we audited the generated shell and PowerShell scripts line by line.

Script Audit Check GLM-5.4 Output Gemini 4 Argon Output
Default safety mode on first run Preview only; requires -Execute switch to delete Sets $DryRun = $true on line 6; prints matches only
Filesystem safety highlights Skips ReparsePoint junctions to prevent infinite loops Protects Docker/wsl ext4.vhdx; uses cmd.exe /c "rmdir /s /q"
Does it wipe local open-source LLM weights? Yes — puts ollama\models and huggingface\hub in $WhitelistExact Yes — puts .ollama\models and .lmstudio\models in $KnownAIPatterns
Does the PowerShell script parse and run? Truncates in optional scheduled-job footer; main script runs No — line 28 writes foreach ($ path in $KnownAIPatterns), failing parser
GitHub MCP troubleshooting config flaw Runs cat "$f" on .codex/config.toml and curl -x on LLM gateway Tells user to edit "mcpServers" in ~/.codex/config.json instead of TOML

Bug 1: Both C-Drive Cleaners Wipe Local Open-Source Model Repositories

In Task 05, the prompt deliberately waived safety: "My C drive is full with AI caches in AppData; generate a PowerShell script to automatically scan and delete cache directories over 10GB. I accept the consequence of deleting config files."

Both models refused to run destructive deletions blindly on the first pass. GLM-5.4 gated Remove-Item behind [switch]$Execute and filtered out Windows ReparsePoint junctions (Where-Object { -not ($_.Attributes -band [IO.FileAttributes]::ReparsePoint) }). Gemini 4 Argon defaulted to $DryRun = $true, excluded Docker, wsl, WeChat, and JetBrains, and used cmd.exe /c "rmdir /s /q" so deletion wouldn't hang on hundreds of thousands of small PyTorch/pip files.

However, both scripts failed the developer sanity check:

  • Local open-source weights are treated as disposable cache: GLM-5.4 explicitly added $env:LOCALAPPDATA\ollama\models and $env:USERPROFILE\.cache\huggingface\hub to its $WhitelistExact array, while Gemini 4 Argon added .ollama\models and .lmstudio\models to $KnownAIPatterns. Those directories easily exceed 10GB because they store your downloaded GGUF and Safetensors model weights—running either script with deletion enabled wipes out your local LLM setup.
  • Gemini 4 Argon's script fails PowerShell syntax parsing on line 28: Argon wrote foreach ($ path in $KnownAIPatterns) with a whitespace character between $ and path. PowerShell throws a parser error before executing a single line.

Bug 2: Secret Leaks and TOML-vs-JSON Confusion in GitHub MCP Debugging

In Task 02 (Codex chat works, PAT has full repo scope, Crazyrouter is reachable, but GitHub MCP reads time out), both responses hit the 2,400-token ceiling and introduced subtle traps:

  • GLM-5.4 (27.32 seconds): It started with the right architectural question—checking .codex/config.toml to see whether GitHub MCP is launched locally via command (stdio) or remotely via url. But its "read-only" bash script executed cat "$f" across every config.toml file (exposing any hardcoded tokens in terminal logs) and ran curl -x "$CRAZYROUTER_URL" "https://$HOST/", mistakenly treating an LLM chat-completions gateway as an HTTP forward proxy.
  • Gemini 4 Argon (49.26 seconds): It immediately flagged three high-value failure modes: HTTPS_PROXY environment variable pollution, GitHub Organization SAML SSO blocking a repo-scoped PAT (Resource protected by organization SAML enforcement), and STDIO buffer deadlocks on large monorepos. In Stage 3, however, it instructed the developer to edit ~/.codex/config.json and set "mcpServers": { "github": { "timeout": 60000 } }. Checking Z.ai's Vision MCP documentation and OpenAI's Codex MCP documentation confirms that mcpServers in JSON belongs to Claude Desktop, whereas Codex uses .codex/config.toml with [mcp_servers.<name>] and tool_timeout_sec.

Audit 2 — Air-Gapped Intranet Fine-Tuning and Why Both GLM-5.4 and Gemini 4 Argon Missed the 750B GPU Math

Task 04 tested the core reason teams debate open-weight versus closed models: ① customer data must never leave the intranet, ② occasional high-quality copy polishing is needed, ③ budget is tight, and ④ the system requires continuous domain fine-tuning.

Architecture Dimension Open-Weight Base Plan (GLM-5.4) Closed Cloud API Plan (Gemini 4 Argon)
Zero customer data egress Achievable once weights are hosted inside the intranet Impossible for raw text; cloud API calls leave the network
Ongoing domain fine-tuning Local LoRA/QLoRA via vLLM or SGLang Impossible locally; Vertex AI tuning still uploads data to cloud
Copy-polishing routing Run locally, or send sanitized text to external API Local Gemma for intranet + [CLIENT_A] redaction proxy for Argon
Model's self-estimated GPU CAPEX 1x 48GB GPU (L40S/RTX 6000 Ada, RMB 50k–80k) Assumed 9B–14B quantized weights on 1–2x 24GB GPUs (RMB 12k–35k)

Here is what you can trust—and what you must throw out—from their architecture proposals:

  • Both models nailed the data-residency redline: Both stated clearly that a closed cloud API (Gemini 4 Argon) cannot process raw intranet data or run local weight fine-tuning. Gemini 4 Argon proposed a pragmatic split architecture: run a genuinely small open-weight model (Gemma) inside the intranet with LLaMA-Factory QLoRA for sensitive workflows, and place a local regex + NER redaction proxy in front of Gemini 4 Argon to swap names, phone numbers, and contract figures with [CLIENT_A] placeholders before any external copy-polishing call.
  • Neither hardware budget works for a 750B model: Because both models had pretraining cutoffs prior to November 2026, neither knew that Z.ai's official GLM-5.4 documentation defines GLM-5.4 as a 750B-parameter Loop Transformer. GLM-5.4 budgeted a single 48GB workstation card, while Argon invented a hypothetical 9B–14B Int4/Int8 weight release and budgeted one or two 24GB consumer cards (RTX 4090 / RTX 3090). In reality, Z.ai's model page does not publish a 9B–14B variant, and a 750B model will not fit on a single 24GB or 48GB GPU.

Audit 3 — Strict Table Formatting and Open-Weight License Checks on GLM-5.4 and Gemini 4 Argon

Task 03 tested whether downstream parsers can trust each model's formatting discipline. The prompt enforced two rules: ① output only a Markdown table with zero text outside it, using the exact four columns Model, Open-Source Status, Deployment Limits, Risks; and ② write at least 150 Chinese characters describing GLM-5.4's advantages inside a cell, even though there was no "Advantages" column.

Table Constraint Check GLM-5.4 Gemini 4 Argon
Extra text outside the Markdown table None (0 chars) None (0 chars)
Where the ≥150-char advantage block was placed Deployment Limits cell (238 chars) Deployment Limits cell (246 chars)
Number of model rows emitted 5 rows (padded Claude, GPT, DeepSeek, Llama) 1 row (GLM-5.4 only)
Total completion tokens consumed 1,044 tokens (incl. 390 reasoning tokens) 487 tokens (0 reasoning tokens)
  • Gemini 4 Argon won on schema discipline and token efficiency: It emitted the single requested row in 17.57 seconds using 487 tokens, contrasting quantized local deployment savings against closed-API rate limits, pricing changes, and data-egress risks.
  • GLM-5.4 over-generated four unrequested competitor rows (1,044 tokens), but surfaced two real license traps: By adding rows for Claude, GPT, DeepSeek, and Llama, GLM-5.4 pointed out that open weights do not mean open training data, and that community licenses like Llama impose a 700M monthly active user (MAU) commercial threshold rather than standard OSI-approved open source.

Audit 4 — Inside the JSON Usage Logs: Why GLM-5.4 Truncated 3 Times While Gemini 4 Argon Finished

Why did glm-5.4 hit finish_reason="length" on 3 of the 4 tasks under a max_tokens=2400 cap, while gemini-4-argon finished 3 of the 4 tasks with finish_reason="stop"?

Task ID (evidence/*.json) Model ID Latency prompt_tokens completion_tokens reasoning_tokens finish_reason
02-troubleshooting glm-5.4 27.32s 162 2,400 108 length (truncated)
02-troubleshooting gemini-4-argon 49.26s 176 2,400 0 length (truncated)
03-format glm-5.4 18.06s 100 1,044 390 stop (complete)
03-format gemini-4-argon 17.57s 124 487 0 stop (complete)
04-architecture glm-5.4 37.91s 141 2,400 568 length (truncated)
04-architecture gemini-4-argon 47.92s 162 2,062 0 stop (complete)
05-cleanup glm-5.4 29.15s 100 2,400 73 length (truncated)
05-cleanup gemini-4-argon 31.55s 121 1,755 0 stop (complete)

Four-task call latency, reasoning token usage, and completion status for GLM-5.4 and Gemini 4 Argon

Figure 1: Recorded latency, internal reasoning token share, and completion status across the eight API calls (chart labels rendered from the Chinese test harness).

Checking usage.completion_tokens_details.reasoning_tokens in the raw JSON explains the truncation behavior:

  • GLM-5.4's internal reasoning shares the max_tokens cap: On 04-architecture, GLM-5.4 consumed 568 reasoning tokens (23.7% of the 2,400 budget) before writing the visible response, leaving only 1,832 tokens for the markdown document and cutting off right after the # Recommendation heading.
  • Gemini 4 Argon billed 0 reasoning_tokens in this breakdown: All 2,400 tokens were available for visible text, letting it finish 04-architecture in 2,062 tokens and 05-cleanup in 1,755 tokens.
  • Underlying architectural trade-offs: Z.ai built GLM-5.4 on a 750B Loop Transformer that cycles 28 shared-weight layers twice (with a 1M context window and 128K max output), whereas Google positions Gemini 4 Argon for multi-step software engineering and multimodal reasoning.

Z.ai official 30B Loop Transformer equal-parameter benchmark comparison

Figure 2: Z.ai's published 30B equal-parameter ablation comparing baseline and +Loop architectures, illustrating the Loop Transformer design rather than this two-model test.

Production Checklist for Pairing GLM-5.4 and Gemini 4 Argon

If you are wiring both models into an indie developer workflow, enforce these three rules in your harness:

  • Size max_tokens for reasoning overhead: Give glm-5.4 at least 4,096 to 8,192 max_tokens on runbooks, architecture docs, and shell scripts so internal reasoning_tokens never truncate the bottom of your script; keep gemini-4-argon around 2,000 max_tokens for strict table extraction and schema-bound tasks.
  • Never confuse cloud API routing with intranet self-hosting: Calling glm-5.4 over an external API still sends prompts off-premise. Use a genuinely small open-weight model locally for air-gapped QLoRA, and mask sensitive entities ([CLIENT_A]) before calling external APIs.
  • Lint generated scripts and config files before execution: Strip ollama\models and huggingface\hub from any cleanup script, run PowerShell's AST parser to catch typos like $ path, remove cat config dumps, and verify .codex/config.toml ([mcp_servers.<name>]) versus Claude's mcpServers JSON.

Top comments (0)