cd /news/ai-agents/zcode-glm-5-4-wiring-a-third-party-a… · home › topics › ai-agents › article
[ARTICLE · art-176012] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

ZCode + GLM-5.4: Wiring a Third-Party API Into an Agent Environment

A developer wired Zhipu's GLM-5.4 into ZCode, Zhipu's agentic development environment, as a custom third-party provider by configuring four fields — Base URL, API format, API key, and model ID — and documented the four distinct failure modes each produces. In a small self-run comparison of three tasks (two rounds each, twelve requests), GLM-5.4 passed all six runs while GLM-5.3 failed both runs of a 120-character constrained-writing task, hitting the 1,200 max_tokens ceiling and returning empty content. The developer cautioned that the gap reflects behavior under a specific token ceiling rather than a general verdict, and that the tests involved no multi-file edits or tool calls.

recommendation

Set tight acceptance criteria and watch completion-token usage against max_tokens; GLM-5.3 returned empty content twice when reasoning consumed the full 1,200-token budget.

more in playbook: Evals and testing for LLM apps
by read11 min views1 publishedNov 25, 2026

I've been running GLM-5.4 inside ZCode through a custom provider rather than the official plan, and the setup turned out to be less about clicking the right buttons and more about understanding four fields and the four distinct failures they produce. This is the full walkthrough, including the measurements that changed how I use it.

Short version: create a custom provider, fill Base URL, API format, API key, and model ID. Ten minutes of clicking. The rest of this post is about the parts that cost me time — and one measurement that made me revise my initial judgment of the model.

ZCode is Zhipu's Agentic Development Environment. It reads and writes files, runs terminal commands, drives a browser, and supports sub-agents and a goal mode. None of that requires Zhipu's own model — the client accepts any Anthropic- or OpenAI-compatible endpoint, which the docs call a third-party provider.

So the value proposition has two halves. Model choice decouples from the client: swap models server-side, change one field locally. And billing consolidates: one endpoint, one key, multiple vendors behind it.

What it is not: a chat client. If your use case is asking questions in a browser tab, a desktop app is overkill. The payoff is on multi-step tasks where the model needs to touch files and run commands.

Released 2026-11-23. The headline change is Loop Transformer — a group of layers sharing weights and running repeatedly, adding depth without duplicating parameters. Zhipu's published version runs the 28 base layers twice, with the second pass continuing from the first's internal state. They describe validating up the ladder from 1B to 750B rather than training a fully-looped model from scratch.

The spec sheet, read from the crazyrouter catalog on 2026-11-25:

That last line is worth expanding. The launch material lists images and video as inputs, but that's Zhipu's own entry point. Through crazyrouter, glm-5.4 is text-only — I sent an image and got "I don't see any image" back. For vision you need glm-5v-turbo or glm-5.3-flash. Same model name, different capability envelope depending on where you call it.

The launch material includes an internal 200-scenario comparison: GLM-5.4 versus GLM-5.3 at 51.1% win, 25.7% tie, 23.1% loss. Zhipu's own evaluation, no published tasks or rubric, so I can't rerun it.

I wrote my own three tasks instead. Two rounds each, two models, twelve requests.

LRU cache class. Pass criteria: contains a class, uses Map or Object, calls delete. glm-5.4 passed 2/2 at 139 and 131 tokens. glm-5.3 passed 2/2 at 674 and 632.

Paragraph to JSON. Pass criteria: JSON.parse yields all three fields. glm-5.4 passed 2/2 at 52 and 35 tokens. glm-5.3 passed 2/2 at 717 and 712.

A 120-character explanation with three banned words. Pass criteria: under 200 characters, no banned words. glm-5.4 passed 2/2 at 79 and 79. glm-5.3 passed 0/2 — both runs truncated.

Nobody got the answers wrong. The gap was in consumption and reliability. glm-5.4 stayed under a hundred output tokens across all three; glm-5.3 needed six to seven hundred. On wall time the LRU task ran 6.1s and 4.8s versus 17.6s and 17.6s; the JSON task 4.1s and 2.6s versus 26.5s and 26.8s.

The third task is the interesting one. glm-5.3 hit the 1,200 max_tokens ceiling both times and returned nothing. The usage numbers say why: a few dozen prompt tokens, completion pinned at 1,200, content empty. The budget went into reasoning and the actual paragraph never started.

Now the caveats, which matter as much as the numbers. This shows glm-5.4 gets it right first try when acceptance criteria are tight. It does not show glm-5.4 is better on long tasks — none of these involved multi-file edits or tool calls. And glm-5.3's failure is a max_tokens artifact; an earlier run of the same script had it passing at 1,176 tokens. This is a difference under a specific ceiling, not a verdict.

Since ZCode is an agent environment, a model that can't call tools is useless no matter how clean its answers are. I sent an OpenAI tools request asking for Hangzhou weather.

**glm-5.4:** 15.5 seconds, called `get_weather`, args `{"city":"杭州"}`.

**glm-5.3:** 3.1 seconds, called `get_weather`, args `{"city": "杭州"}`.

**gpt-6.2-astra:** 3.3 seconds, called `get_weather`, args `{"city":"杭州"}`.

All three got the tool and argument right. But glm-5.4 took five times as long as the others — the opposite of its performance on the three short tasks.

I chased it with a streaming request on a trivia question, recording time to first byte and the length of the reasoning field.

glm-5.4 run 1: 3.5s to first byte, 4.2s total, 0 reasoning chars, 69 body chars.

glm-5.4 run 2: 2.8s to first byte, 3.6s total, 0 reasoning chars, 81 body chars.

glm-5.3 run 1: 1.9s to first byte, 9.9s total, 809 reasoning chars, 0 body chars.

glm-5.3 run 2: 1.6s to first byte, 16.1s total, 504 reasoning chars, 93 body chars.

A rerun matched. glm-5.4 emitted zero reasoning characters every time; glm-5.3 always streamed several hundred characters of chain-of-thought first.

That single fact explains both results. On a short task, silence is a feature — fewer tokens, less waiting. On a tool-call task needing multi-step judgment, silence means the model has to think without the scaffolding, and 15.5 seconds is the bill.

This is the part I'd carry into any agent setup. Benchmark scores from single-turn prompts will mislead you, because the same model can go in opposite directions on short and long tasks, and the pivot is whether it emits reasoning by default. ZCode exposes a reasoning level in the model menu; raising it amounts to forcing that step. Leave it default and your quick-prompt impression is probably wrong about the long task.

Three things.

The client. ZCode desktop for Windows, macOS, or Linux. No Node.js prerequisite — the runtime ships inside.

A key. sk--prefixed, created in the provider console. Not your login password.

A Base URL. https://api.crazyrouter.com/v1 here. Whether to include /v1 varies by vendor; don't pattern-match.

sk- string from the API Keys pagehttps://api.crazyrouter.com/v1 glm-5.4 No pre-validation happens client-side. A bad value surfaces on the first request, which is why the error table below earns its place.

Download for your OS, run the wizard, launch from the Start menu.

Two onboarding screens come before the workspace.

The first asks your primary work direction — twelve options from software development to legal work. It only tunes defaults; irrelevant to connecting your own endpoint. Click Skip, lower left.

The second is "Welcome to ZCode," asking you to connect an account with a provider dropdown and a key field. That key belongs to the built-in service and is useless here. Click Skip for now.

Skip both to reach the main interface. You lose account binding, not capability — file access and terminal calls are intact. What you don't have is a model channel, so the composer can't send anything until you add one.

In the browser this time.

Sign in to crazyrouter and open API Keys in the left column. The list breaks down by name, key, and status, with quota and available models on the same page.

Click Create API Key. Three fields matter:

zcode so you can identify it later. Cosmetic. The key shows masked — leading characters, asterisks, trailing characters.

Click copy for the real value, then paste into a scratch note and check both ends. Stray whitespace is the most common 401 cause, ahead of expired keys.

For the model ID, open the catalog and type glm. Copy from the card. Don't change casing — GLM-5.4 won't resolve, and the server won't guess for you.

Per-model pricing sits on the pricing page. Given glm-5.4 burned a fraction of glm-5.3's tokens in my tests, the invoice difference for identical work is easy to compute from that page.

Settings → Model settings → Add provider. You get a card screen in two groups: built-in providers under Zhipu on top, and under "Other" below, Create custom provider is first.

Built-in cards fix the address and protocol, so you supply only a key. Custom inverts that entirely. Not in the built-in list means this path.

Something recognizable — "team gateway." Display only. But the model menu groups by provider once you have several, and duplicate model names across groups is normal, so clear naming prevents mis-clicks.

https://api.crazyrouter.com/v1. Three traps:

Don't drop /v1. I tried an address without it and got a bare 404 reading Your base_url is missing /v1. Unrelated to your key; add the path.

Don't append the endpoint yourself. /chat/completions and /messages are chosen by the protocol dropdown. One layer from you plus one from the client equals another 404.

Address and protocol must match. Anthropic Messages appends /messages; Chat Completions appends /chat/completions. Change one, re-check the other.

Three options: Chat Completions, Responses, Anthropic Messages.

I used Anthropic Messages — requests go to /v1/messages. Chat Completions also worked, /v1/chat/completions returning 200. Different payload shapes, same result: content array versus choices.

Responses returns 400 for glm-5.4. Not your error — the model doesn't support that endpoint. Same address with gpt-6.2-astra returns 200. On a 400, check this dropdown first.

Paste, then click the eye icon. Extra leading space or a missing tail becomes a 401.

Stored locally, never echoed in plaintext. Don't paste it into a chat for someone to inspect, and don't drop it in a group — that's handing over the keys.

Add model, enter glm-5.4. No auto-fetch for custom providers; this is manual, unlike built-in cards.

Want glm-5.4 and glm-5.3-flash together? No second provider. Add another model under the same one — shared address and key, different ID.

Easiest step to botch. Close without saving and everything above is wasted. Some versions give each provider a separate toggle that must also be on. Confirm both, then save.

New session, open the model menu, find the provider group, select your model. Ask it to repeat one sentence. One acceptance criterion: a normal reply arrives. If it does, all four fields are correct. Security note: the key lands in ~/.zcode/v2/provider_config.json in plaintext. Don't commit that file.

Edit the config directly. Everything in settings writes to ~/.zcode/v2/provider_config.json. Custom providers go under providerConfigRules.providerRules, where api.type sets the protocol (anthropic-messages, openai-chat-completions, openai-responses) and api.baseUrl takes the full address. Good for bulk edits or replicating across machines.

Two gotchas. Broken JSON doesn't corrupt your file — the client neither modifies nor backs it up, just ignores your personal config temporarily while built-in providers keep working, and recovers when you fix it. And manualProviderModelRules demands every field; miss one and the entire personal config fails to load. For partial changes, use providerModelRules.

Enter from the login screen. First launch or after sign-out lands on the login screen with browser authorization and use-API-key options. The latter goes straight to provider config — same panel, two fewer detours.

One thing ZCode doesn't offer: reusing a built-in provider's route via an environment variable override, a trick some clients allow so you inherit the built-in model naming. Here, anything outside the built-in list needs its own custom entry with address and model ID entered correctly.

401, invalid token — pasted wrong, stray whitespace, or you used your login password. Re-copy and verify with the eye icon.

404, Your base_url is missing /v1 — add /v1, but don't also append /messages.

404, model_not_found — misspelled ID or missing model permission on this key. Copy from the catalog.

400, invalid_request_params — protocol set to Responses, unsupported by glm-5.4. Switch to Anthropic Messages or Chat Completions.

Image input fails — model isn't multimodal. glm-5.4 is text-only; switch to glm-5v-turbo. Empty or truncated reply — max_tokens ceiling, reasoning ate the budget. Raise it or choose a shorter-output model.

Five point at status codes. The last has no error — HTTP 200 — and only shows in usage: tiny prompt, completion at the ceiling, content empty.

Splitting 401 from 404 is mechanical. 401 is identity: wrong key, missing key, malformed key. 404 is path and model: missing address segment, wrong protocol, nonexistent ID. No overlap, so no trial and error.

Within 404s, the message distinguishes them. Bad address says base_url is missing /v1 or Invalid endpoint path. Bad model says model_not_found and points you to the catalog. The phrase tells you which field to edit.

Connection failures and endless spinners are network. The HTTP proxy in ZCode settings isn't global, and model requests route through it — turn it off first.

One case lives outside the table: config is right, composer won't use the model. Check whether the session is pointed at the new group. Adding a provider doesn't move the active session.

After switching, requests carry your key. Missing from the menu? Check the provider toggle, the model-row toggle, and whether the form saved. All fine and still missing — leave settings and re-enter to refresh.

The screenshot is glm-5.3; switching to glm-5.4 in the same provider means editing only the model ID field.

The durable lessons are few. Whether the Base URL carries /v1 comes from vendor docs. Protocol and address travel together. The model ID gets copied, not typed. The key gets checked at both ends. Four fields, four error types, and status codes that point at the field.

On model choice: my tests favor glm-5.4 for short work, but the tool-call result argues against extrapolating. Raise the reasoning level and re-measure before trusting a default-setting number on a long task. That's the one thing I'd have gotten wrong if I'd stopped at the benchmark table.

Field names drift between versions. In 3.16.3 it's "Base URL." Older builds may label it with a Chinese term for endpoint address, or split Anthropic and OpenAI into two inputs. Go by function, not by label.

ZCode official docs: zcode-ai.com/docs/configuration

API: crazyrouter.com/en/models and crazyrouter.com/en/pricing

── more in #ai-agents 4 stories · sorted by recency
── more on @zhipu 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/zcode-glm-5-4-wiring…] indexed:0 read:11min 2026-11-25 · —