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
- Get a keyFrom open.bigmodel.cn for Zhipu GLM, or z.ai for Z.ai.
- 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.
- Pick it for an agentIn the Agents tab, choose a GLM model such as
glm-5.3on the agent’s row.
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
Plans and endpoints
| Preset | Plan | OpenAI Chat Completions | OpenAI Responses | Anthropic Messages |
|---|---|---|---|---|
| Zhipu GLM | Pay as you go | https://open.bigmodel.cn/api/paas/v4 | — | https://open.bigmodel.cn/api/anthropic |
| Zhipu GLM | Coding Plan | https://open.bigmodel.cn/api/coding/paas/v4 | https://open.bigmodel.cn/api/v1 | https://open.bigmodel.cn/api/anthropic |
| Z.ai | Pay as you go | https://api.z.ai/api/paas/v4 | — | https://api.z.ai/api/anthropic |
| Z.ai | Coding Plan | https://api.z.ai/api/coding/paas/v4 | https://api.z.ai/api/v1 | https://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.
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
- Claude Code speaks Anthropic Messages, and so does GLM’s Anthropic endpoint, so its requests are passed on as they are. Every tier (opus, sonnet, haiku) runs on the model you pick unless you give one its own. Models in Claude Code.
- Codex speaks only OpenAI Responses. The Coding Plan serves the Responses API itself, so Codex’s requests are passed on as they are; on pay as you go, magpie translates them to Chat Completions. The model shows in Codex’s
/modelwith its reasoning efforts. Models in Codex. - Gemini CLI speaks Gemini’s API. magpie points it at its gateway and translates. Models in Gemini CLI.
- OpenCode gets the model in
opencode.json, with its reasoning variants and cost. Models in OpenCode.
Thinking and effort
- GLM-5.3 always thinks. It turns away a request that switches thinking off. magpie asks again with thinking left on, so the agent gets an answer rather than the error.
- Effort. GLM-5.2 and GLM-5.3 take their reasoning level in
output_config.effort, and magpie puts the agent’s level there.
Usage windows and search
- Coding Plan windows. The row shows the plan’s windows, read from Zhipu or Z.ai: the hourly and weekly allowances, and the month’s MCP tool calls.
- Web search. With a Coding Plan key and no searcher chosen in Settings, magpie searches the web for GLM models through the plan’s own search service.
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.