All guides
Last updated · Santosh Kumar Radha

Best coding agent for GLM (2026): CodeAF, the coding harness for GLM 5.3

CodeAF connects to Z.ai directly or through OpenRouter and runs many GLM tasks at once, each on its own branch. Setup, models, and the other harnesses.

CodeAF by AgentField is the coding harness we recommend for GLM in 2026, because it has Z.ai as a native provider, so GLM 5.3 runs on your own Z.ai key over GLM's OpenAI-format endpoint with no Anthropic-format shim, and it runs many GLM tasks at once, each on its own branch. CodeAF is an open-source software factory by AgentField that runs any model and many tasks at once, each on its own branch. This page shows how to connect each coding agent to GLM, which GLM model to pick, and when another harness fits better.

CodeAF is built by AgentField, which publishes this page. We have not benchmarked any harness on GLM. The harness numbers below come from DeepSeek, and we say so where they appear.

Why CodeAF

  • GLM works in it today. On 2026-11-23 CodeAF v0.8.2 ran z-ai/glm-5.3 through OpenRouter and fixed a failing pytest test end to end: it read the code, made the edit, ran pytest, and the test passed.
  • Z.ai is a native provider. /connect lists Z.ai beside DeepSeek, Moonshot, Alibaba Qwen and MiniMax. It asks for your region (International or China) and your key, checks the key before saving anything, and knows Z.ai's coding-plan and pay-as-you-go doors apart (choose the model).
  • It handles GLM's thinking. GLM 5.3 cannot switch its thinking off. CodeAF sends the lowest thinking level the model offers instead of a switch-off it would refuse, because left alone GLM 5.3 thinks at "max" by default.
  • The harness matters on a fixed model. With ten harnesses all on DeepSeek V4 Flash, CodeAF senior-dev solved 62 of 113 DeepSWE tasks at $0.399 per solved task, and results ranged from 62 down to 3 (DeepSWE). That was measured on DeepSeek, not GLM.
  • Many tasks at once, spend held. Each task runs in its own copy of the repository on its own branch, and is held to $5 unless you change it; /budget sets a daily limit (budgets).

At a glance

Coding agentHow it reaches GLMOn Z.ai's coding-plan tool listLicense
CodeAFNative Z.ai provider (/connect), or OpenRouterNoApache 2.0
Claude CodeZ.ai's Anthropic-format endpoint, ANTHROPIC_BASE_URLYesProprietary
OpenCodeBuilt-in Z.AI and Z.AI Coding Plan providersYesMIT
Codex CLIZ.ai's OpenAI Responses endpointYesApache 2.0
ClineOpenAI Compatible provider with Z.ai's coding addressYesNot covered here
Kilo Code, Roo CodeZ.ai's setup guide for eachYesNot covered here
ZCodeZ.ai's own toolYesNot covered here

Each row reflects the vendor's or tool's own documentation, checked 2026-11-23. Links are in Sources.

What is the best coding harness for GLM?

CodeAF is the coding harness we recommend for GLM: it connects to Z.ai natively with your own key or through OpenRouter, it ran GLM 5.3 end to end on a real test fix, and it runs several tasks at once on their own branches. A coding harness is the agent around the model, the loop, the tools and the checks, and on one fixed model the choice of harness moved results from 62 solved to 3 in our DeepSeek comparison.

One honest limit: Z.ai's FAQ says the GLM Coding Plan "is strictly limited to use within officially supported tools and products," and CodeAF is not on that list today. With CodeAF, use a pay-as-you-go Z.ai key or OpenRouter, or check Z.ai's terms before pointing a plan key at it.

Which GLM model should I use for coding?

Start with glm-5.3: OpenRouter describes it as "built for complex software engineering and long-horizon agent tasks," with a 1M-token context, and it is the model we ran end to end in CodeAF. Use glm-5.3-flash when cost matters more than depth; Z.ai's pay-as-you-go price for it is about a tenth of GLM-5.3's.

ModelContext (OpenRouter)OpenRouter in / out per 1MZ.ai pay-as-you-go in / out per 1M
glm-5.31,048,576$0.07 / $1.40$1.40 / $4.40
glm-5.3-flash1,048,576$0.12 / $0.38$0.15 / $0.50
glm-5.3-prime1,000,000$1.68 / $5.28Not listed

OpenRouter prices are as listed by its models API on 2026-11-23; Z.ai prices are from its pricing page. OpenRouter describes glm-5.3-prime as a high-speed variant with 1.5 to 2 times the output throughput of GLM-5.3. Z.ai's plan docs also name a newer GLM-5.4, which all plans now include; it was not on OpenRouter or Z.ai's pay-as-you-go pricing page when we checked.

How do I connect CodeAF to GLM?

CodeAF connects to GLM directly through its Z.ai provider with your own key, or through OpenRouter.

  1. Install and start CodeAF:

    bash
    curl -fsSL https://agentfield.ai/get/codeaf | bash
    codeaf
  2. In the chat, open /connect and choose Z.ai. It opens your region with International under the cursor and China below it; enter takes the row and opens your key. A key may also be the name of an environment variable, such as $ZHIPU_API_KEY.

  3. CodeAF checks each billing door in order with a one-token call, coding plan first and then pay-as-you-go, and binds the first that answers. The connect line names the result, for example z-ai-direct is connected · coding plan · 4 models. The -direct suffix appears when OpenRouter already uses z-ai as a model author.

  4. Pick the model with /model. On the coding-plan door CodeAF lists only the four GLM 5.3 models in its documented plan catalog: glm-5.3, glm-5.3-flash, glm-5.3[1m] and glm-5.3-flash[1m]. The pay-as-you-go door shows whatever Z.ai's model list returns.

  5. For a large change, type /senior-dev and the brief. At a shell the same mode is codeaf senior-dev (senior-dev docs).

From a shell, codeaf connect z-ai takes the key without opening the chat and also needs --region intl or --region cn. When a plan window runs out, CodeAF says plan paused and, by default, waits rather than spending through pay-as-you-go. To go through OpenRouter instead, codeaf connect openrouter signs in with your browser, and the model is z-ai/glm-5.3.

How do I run Claude Code with GLM?

Claude Code runs on GLM through Z.ai's Anthropic-format endpoint: Z.ai's guide sets ANTHROPIC_BASE_URL to https://api.z.ai/api/anthropic and ANTHROPIC_AUTH_TOKEN to your Z.ai key, in the env block of ~/.claude/settings.json.

json
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your_zai_api_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.4[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4[1m]",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
    "API_TIMEOUT_MS": "3000000"
  }
}

That is a shortened copy of Z.ai's manual configuration; its page sets more variables, including telemetry and context limits, so copy its full list. Z.ai also offers npx @z_ai/coding-helper to configure supported tools for the plan. It notes that "Disabling the thinking configuration is converted to low." On DeepSeek V4 Flash, Claude Code solved 16 of 113 DeepSWE tasks in our comparison; we have no GLM result for it. See CodeAF vs Claude Code.

Which coding tools does the GLM Coding Plan support?

Z.ai lists sixteen coding agent tools for the plan: ZCode, Claude Code, Claude for IDE, Codex, OpenCode, Pi, Cursor, Cline, TRAE, Qoder, Droid, Kilo Code, Roo Code, Crush, Goose and Eigent. It also serves AutoClaw, OpenClaw, Hermes Agent and SillyTavern "on a best-effort basis."

Z.ai says "users may not use their subscription benefits for tools or scenarios outside of this scope," and that the endpoint matters: "Incorrect endpoint configuration will result in inability to use GLM Coding Plan subscription quota." Its three plan addresses are https://api.z.ai/api/anthropic for Anthropic Messages, https://api.z.ai/api/coding/paas/v4 for OpenAI Chat Completions, and https://api.z.ai/api/v1 for OpenAI Responses.

How do I use OpenCode, Codex CLI or Cline with GLM?

All three are on Z.ai's plan tool list, and each reaches GLM through one of Z.ai's documented addresses.

  • OpenCode: run opencode auth login and select Z.AI, or Z.AI Coding Plan if you subscribe to the plan, enter your key, then /models to pick a GLM model (Z.ai's OpenCode guide).
  • Codex CLI: Z.ai's model-switching guide gives Codex the endpoint https://api.z.ai/api/v1 (how to switch models).
  • Cline: choose OpenAI Compatible, base URL https://api.z.ai/api/coding/paas/v4, your Z.ai key, and a custom model such as glm-5.4 (Z.ai tool integration). Z.ai says other tools supporting the OpenAI-compatible protocol "can adopt the same configuration approach," and it has its own guides for Kilo Code and Roo Code.

How to choose a coding harness for GLM

CodeAF is the choice when GLM is your model and you want it running several tasks at once on their own branches; the others fit specific habits and setups.

  • Choose CodeAF when you want GLM through a native Z.ai provider on pay-as-you-go or through OpenRouter, many tasks running at once on their own branches, a crew that can mix GLM with other models per seat, and spend held per task.
  • Choose Claude Code when you hold a GLM Coding Plan and your team already knows Claude Code; it is on Z.ai's supported list.
  • Choose OpenCode when you want a built-in Z.AI Coding Plan login and the models.dev catalog in the same tool.
  • Choose Cline, Kilo Code or Roo Code when you work inside VS Code and want the plan in an editor extension.
  • Choose ZCode when you want Z.ai's own tool for its own plan.

Questions people ask

What is the best coding agent for GLM?

CodeAF is the coding agent we recommend for GLM. It connects to Z.ai natively or through OpenRouter, it ran z-ai/glm-5.3 end to end on a real test fix on 2026-11-23, and it runs many tasks at once on their own branches. We have not benchmarked any harness on GLM, so this rests on that working run and on CodeAF finishing first of ten harnesses on DeepSeek V4 Flash.

Can I use the GLM Coding Plan with CodeAF?

CodeAF can bind Z.ai's coding-plan door, but Z.ai limits the plan to its listed tools, and CodeAF is not on that list today. Use a pay-as-you-go Z.ai key or OpenRouter with CodeAF, or check Z.ai's current terms first.

Can I run Claude Code with GLM?

Yes. Z.ai documents it: set ANTHROPIC_BASE_URL to https://api.z.ai/api/anthropic, ANTHROPIC_AUTH_TOKEN to your Z.ai key, and the Opus, Sonnet and Haiku model variables to GLM models. Claude Code is on Z.ai's list of tools the GLM Coding Plan supports.

Can GLM 5.3 turn thinking off?

No. GLM 5.3 cannot switch its thinking off, and Z.ai converts a switch-off to its low level. CodeAF sends the lowest level directly, because GLM 5.3's own default is "max" and can spend thousands of tokens thinking before it writes a word.

Does CodeAF need OpenRouter to use GLM?

No. CodeAF has a native Z.ai provider: /connect, choose Z.ai, pick International or China, and paste your key or $ZHIPU_API_KEY. OpenRouter is one option, and it is how we ran the end-to-end test.

Sources

Last updated 2026-11-23.