Z.AI ships a massive free daily token quota — hundreds of millions of tokens, no credit card required. The model is GLM-5.2, a ~700B parameter open-weight coding model, MIT-licensed, and you can run it as your model inside Claude Code with a two-line config change.

Here is the part nobody shows you.

## What is GLM-5.2

GLM-5.2 is built by Z.AI (formerly Zhipu AI). It is an open-weight model at roughly 700 billion parameters, released under the MIT license.

On the FrontierSWE long-horizon coding benchmark it scores 74.4. Claude Opus 4 scores 75.1. That is within one point — for a model that costs nothing to use via the Z.AI hosted API.

Claude Opus costs up to $200/month on the Max plan. GLM-5.2 via Z.AI: $0, with a large free daily quota that refreshes every 24 hours.

| Model | FrontierSWE Score | Cost |
|---|---|---|
| Claude Opus 4 | 75.1 | ~$200/mo (Max plan) |
| GLM-5.2 (Z.AI free tier) | 74.4 | $0 |

## The full step-by-step

1. Sign in to Z.AI — run one command in your terminal:

npx zai auth login

This opens a browser window. Sign in with Google or email. The CLI stores your credentials locally.

2. Copy your API key from the Z.AI dashboard (platform.z.ai → API Keys).

3. Open your Claude Code config. It lives at:

~/.claude/settings.json

On Windows: C:\Users\<you>\.claude\settings.json

4. Add these two lines inside the top-level object:

"env": {
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_API_KEY": "<your-zai-api-key>"
}

5. Restart Claude Code. It now routes every request through the Z.AI endpoint — which serves GLM-5.2 — instead of Anthropic servers.

That is the whole setup. One sign-in, two config lines.

## The exact config block

Paste this into ~/.claude/settings.json (merge with any existing keys you already have):

{
"env": {
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_API_KEY": "<your-zai-key-here>"
}
}

Get your key at platform.z.ai after signing in with npx zai auth login.

## Tools & links

- Z.AI platform (sign up + API keys): platform.z.ai
- Z.AI CLI login command: npx zai auth login (Node 18+ required)
- GLM-5.2 model page: z.ai
- Claude Code settings docs: docs.anthropic.com/claude-code
- FrontierSWE benchmark: frontierswe.com
- This video: youtube.com/shorts/pqXrDxiov0Y

## What most people get wrong

They set ANTHROPIC_BASE_URL but leave ANTHROPIC_API_KEY as their real Anthropic key — so every request still bills their Anthropic account.

You need both lines: the base URL pointing to Z.AI AND an API key from Z.AI. The API key is what authenticates you with Z.AI servers, not Anthropic. Without it, the request hits Z.AI endpoint but with the wrong credential and fails.

The fix: get a fresh key from platform.z.ai and replace ANTHROPIC_API_KEY with that value in your config.

## One step to take today

Run npx zai auth login right now, get your key, and drop those two lines into ~/.claude/settings.json. You will have a near-Opus coding model running in Claude Code before you finish your next coffee.

Enter your email to read the full how-to

Confirm via the email link to unlock this and every future SharpenDaily how-to. Free.

No spam. Unsubscribe anytime.