Docs · Provider

GLM Coding Plan in Claude Code, Codex, Gemini CLI and OpenCode

Zhipu’s GLM models come from two places, Zhipu GLM at open.bigmodel.cn and Z.ai at api.z.ai, and each has two plans: pay as you go and the GLM Coding Plan. Add a key to magpie with its plan, and Claude Code, Codex, Gemini CLI, OpenCode and your other agents can use GLM through magpie’s gateway at 127.0.0.1:3425.

Add GLM

  1. Get a keyFrom open.bigmodel.cn for Zhipu GLM, or z.ai for Z.ai.
  2. Add the provider and pick the planIn Providers, press + Add provider, pick Zhipu GLM or Z.ai, choose the plan your key is for (Pay as you go or Coding Plan), paste the key and save.
  3. Pick it for an agentIn the Agents tab, choose a GLM model such as glm-5.3 on the agent’s row.
Terminal
magpie provider add zhipu sk-… plan=coding   # GLM Coding Plan (open.bigmodel.cn)
magpie provider add zai sk-… plan=coding     # GLM Coding Plan (z.ai)
magpie provider add zhipu sk-… plan=api      # pay as you go
Pick the plan your key is for. A Coding Plan key has its own endpoints. Sent to the pay-as-you-go one, it is told it has no balance (429, code 1113). If that happens, magpie tries the Coding Plan endpoint, and when the key is served there it moves the provider to the plan’s endpoints. When both refuse, the error says what each said and what to change.

Plans and endpoints

PresetPlanOpenAI Chat CompletionsOpenAI ResponsesAnthropic Messages
Zhipu GLMPay as you gohttps://open.bigmodel.cn/api/paas/v4—https://open.bigmodel.cn/api/anthropic
Zhipu GLMCoding Planhttps://open.bigmodel.cn/api/coding/paas/v4https://open.bigmodel.cn/api/v1https://open.bigmodel.cn/api/anthropic
Z.aiPay as you gohttps://api.z.ai/api/paas/v4—https://api.z.ai/api/anthropic
Z.aiCoding Planhttps://api.z.ai/api/coding/paas/v4https://api.z.ai/api/v1https://api.z.ai/api/anthropic

Both plans share the Anthropic endpoint, which bills the Coding Plan when the account has one. Each key on the provider says which plan it is for, so one provider can hold a pay-as-you-go key and a Coding Plan key, and each key’s requests, model list and windows are its own plan’s.

In each agent

Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.

Terminal
magpie claude zhipu/glm-5.3
magpie codex zhipu/glm-5.3
magpie gemini model zhipu/glm-5.3
magpie opencode zhipu/glm-5.3

Thinking and effort

Usage windows and search

FAQ

How do I use the GLM Coding Plan in Claude Code?

Add Zhipu GLM (open.bigmodel.cn) or Z.ai (api.z.ai) in magpie, choose Coding Plan as the key’s plan, then pick a GLM model such as glm-5.3 on Claude Code’s row, or run magpie claude zhipu/glm-5.3. Claude Code’s requests go to the Anthropic endpoint, which bills the Coding Plan when the account has one.

Can Codex use GLM?

Yes. The GLM Coding Plan serves the OpenAI Responses API Codex speaks, so magpie passes Codex’s requests on as they are. On pay as you go, magpie translates Codex’s requests to Chat Completions. Run magpie codex zhipu/glm-5.3 or pick it on Codex’s row.

Why does my GLM Coding Plan key say insufficient balance (1113)?

A Coding Plan key sent to the pay-as-you-go endpoint, https://open.bigmodel.cn/api/paas/v4, is answered with 429 code 1113. magpie tries the Coding Plan endpoint, https://open.bigmodel.cn/api/coding/paas/v4, and when the key is served there it moves the provider to the plan’s endpoints. Choosing Coding Plan when you add the key avoids it.

Can I have a Coding Plan key and a pay-as-you-go key together?

Yes. Each key on a Zhipu GLM or Z.ai provider says which plan it is for. Its requests go to that plan’s endpoints, and its model list and usage windows are that plan’s.

Zhipu GLM or Z.ai: which preset do I pick?

The one that issued your key: Zhipu GLM for a key from open.bigmodel.cn, Z.ai for a key from z.ai.

Does GLM-5.3 work with thinking turned off?

GLM-5.3 always thinks and turns away a request that switches thinking off. magpie asks again with thinking left on, so the agent gets an answer.

Every agent: Models in Claude Code, Models in Codex, Models in Gemini CLI, Models in OpenCode. Ask on Discord if you get stuck.