Skip to content

How to Run GLM-5 With Claude Code (No Proxy Needed)

Run GLM-5 with Claude Code using Z.AI's Anthropic-compatible endpoint — no proxy. API key, environment variables, model choice, the coding plan, and the fixes.

MGMCSA Guru Team July 1, 2026 3 min read
Claude Code on Windows running GLM-5 via Z.AI's Anthropic-compatible endpoint

GLM is one of the easiest cheap models to run with Claude Code because Z.AI ships an Anthropic-compatible endpoint — no proxy, no router, just two environment variables. Combined with the GLM Coding Plan, which starts at $18/month, it’s one of the best-value ways to keep using Claude Code without Anthropic’s bill.

This is the setup, the model lineup, and the plan details (including the usage window everyone forgets about). For the no-proxy approach in general, see anthropic-compatible endpoints.

Step 1: Get a Z.AI key or coding plan

Sign up at Z.AI. You can pay per token or subscribe to the GLM Coding Plan (from $18/month), which is designed to work with Claude Code and other coding tools. Either way you get an API key.

Step 2: Make sure Claude Code is installed

npm install -g @anthropic-ai/claude-code

Step 3: Point Claude Code at GLM

Z.AI’s Anthropic-compatible endpoint is the key. In WSL (recommended on Windows):

export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
export ANTHROPIC_AUTH_TOKEN="your-zai-key"
export ANTHROPIC_MODEL="glm-5"
claude

On native Windows PowerShell:

$env:ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic"
$env:ANTHROPIC_AUTH_TOKEN = "your-zai-key"
$env:ANTHROPIC_MODEL = "glm-5"
claude

That’s the whole setup. Confirm the exact base URL in Z.AI’s docs, since paths can change.

Step 4: Choose the model

GLM models (availability varies by plan)

glm-5 Flagship; strongest (Pro plan)
glm-5-turbo Faster, cheaper; all plans
glm-4.7 Previous flagship; solid coding
glm-4.5-air Lightweight; cheapest

Set ANTHROPIC_MODEL to whichever your plan includes. glm-5-turbo is a strong, fast default if you’re not on Pro.

Pricing and the coding plan

Z.AI offers both billing models:

  • GLM Coding Plan — flat subscription from $18/month, built to work with Claude Code, Cline, Kilo Code, and similar tools. Predictable, and cheapest for heavy daily use.
  • Pay-per-token — standard API rates per million tokens for lighter use.

See GLM Coding Plan setup for plan specifics and GLM-4.6 vs GLM-5 vs GLM-5-Turbo to pick a model.

Verify

claude
# then: "summarize this repo and suggest one improvement"

If it reads files and answers, GLM is serving Claude Code. Switch models by changing ANTHROPIC_MODEL.

Troubleshooting

  • Auth errors — token not set in the current shell, or wrong key.
  • Access denied on glm-5 — your plan tier doesn’t include it; use glm-5-turbo.
  • Format errors — confirm you’re on the /anthropic endpoint, not the OpenAI one.
  • Hit a wall mid-session — you reached the plan’s rolling-window cap; wait for reset or check your tier.

GLM-5 + Claude Code checklist

  • Z.AI key or GLM Coding Plan active
  • Claude Code installed
  • ANTHROPIC_BASE_URL set to Z.AI's /anthropic endpoint
  • ANTHROPIC_AUTH_TOKEN and ANTHROPIC_MODEL set
  • Model matches your plan tier (glm-5 needs Pro)

Wrapping up

Running GLM-5 with Claude Code needs no proxy: set ANTHROPIC_BASE_URL to Z.AI’s /anthropic endpoint, add your token, and pick a model your plan covers. The GLM Coding Plan from $18/month makes it one of the cheapest flat-rate ways to keep Claude Code, just mind the rolling usage window.

For the plan details, see GLM Coding Plan setup; to use GLM elsewhere, see GLM-5 with Codex CLI or GLM + Cline.

Frequently asked questions

Can Claude Code run on GLM-5 without a proxy?

Yes. Z.AI exposes an Anthropic-compatible endpoint, so you point Claude Code at it with ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN — no Claude Code Router or other proxy needed.

Is GLM-5 available on all plans?

Per Z.AI's docs, GLM-5 is available to Pro-tier coding plan users, while GLM-5-Turbo, GLM-4.7, and GLM-4.5-Air are on all plans. Check the current plan tiers, since model availability changes with releases.

Does GLM have a coding plan or just pay-per-token?

Both. The GLM Coding Plan starts at $18/month and works with Claude Code and other tools, and there's also standard pay-per-token API pricing. Heavy daily users usually prefer the plan.

What's the Anthropic endpoint URL for GLM?

Z.AI's Anthropic-compatible base URL (commonly https://api.z.ai/api/anthropic). Confirm the exact path in Z.AI's developer docs, then set it as ANTHROPIC_BASE_URL.

Does the coding plan have usage limits?

Yes. Like most flat plans, it caps usage in rolling windows (commonly prompts every 5 hours), similar to Anthropic's own limits. Heavy bursts can hit the cap; check your tier's per-window quota.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.