# GLM-5.2 Free Setup Guide — the genuinely free ways to run Z.ai GLM-5.2 (chat + free API), plus the paid Claude Code path

> Source: <https://gist.github.com/conradcaffier03/da1ce3691926170d3c22a272b1fab957>
> Published: 2026-06-23 16:05:24+00:00

GLM-5.2 is Z.ai's open-weights (MIT) flagship — 744B-MoE, a 1M-token context, and
benchmarks within ~1 point of Claude Opus 4.8 on FrontierSWE. Here's how to actually
put it to work, starting with the routes that cost **nothing** and need **no credit card**.

Full GLM-5.2 in the browser. No key, no card, no install. Best for asking questions, drafting code, and pressure-testing the model before you wire it into anything.

Two genuinely free ways to call a GLM model from code (OpenAI SDK — zero rewrite):

- Sign up at
→ create an API key[openrouter.ai](https://openrouter.ai) - Use the free model id
`z-ai/glm-4.5-air:free`

*(this is the free lightweight GLM — full GLM-5.2 on OpenRouter is paid, see below)*

``` python
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OPENROUTER_API_KEY,
  baseURL: "https://openrouter.ai/api/v1",
});

const r = await client.chat.completions.create({
  model: "z-ai/glm-4.5-air:free",
  messages: [{ role: "user", content: "Write quicksort in TypeScript" }],
});

console.log(r.choices[0].message.content);
```

The free tier is rate-limited (currently ~50 requests/day) — fine for testing.

- Go to
→ create an API key (new accounts get free starter credits to try GLM-5.2 directly)[z.ai/manage-apikey/apikey-list](https://z.ai/manage-apikey/apikey-list) - OpenAI-compatible base URL:
`https://api.z.ai/api/paas/v4/`

· model`glm-5.2`

``` js
const client = new OpenAI({
  apiKey: process.env.ZAI_API_KEY,
  baseURL: "https://api.z.ai/api/paas/v4/",
});

const r = await client.chat.completions.create({
  model: "glm-5.2",
  messages: [{ role: "user", content: "..." }],
});
```

After the free credits, it's pay-as-you-go — about **$0.95 / $3 per M tokens** (in/out).
You only pay for what you use; no subscription.

Straight answer: there's **no free CLI** for this. Running GLM-5.2 natively as your
Claude Code model goes through Z.ai's **GLM Coding Plan** (paid — Lite starts at
**$18/mo**, ~$12.60/mo billed yearly). It's cheap, but it's not free.

Once you have a Coding Plan key:

```
# 1. install Claude Code if you haven't
npm install -g @anthropic-ai/claude-code

# 2. point it at Z.ai's Anthropic-compatible endpoint
export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
export ANTHROPIC_AUTH_TOKEN=your-zai-key

# 3. run, then set the model to GLM-5.2 (or GLM-5.2[1m] for the full 1M context)
claude
```

Or let Z.ai's helper auto-configure your tool:

```
npx @z_ai/coding-helper
```

| GLM-5.2 | |
|---|---|
| Parameters | 744B MoE |
| Context | 1M tokens |
| License | MIT — open weights on
|

`z-ai/glm-4.5-air:free`

**Reality check:** "free GLM-5.2" means the web chat and the free API model above —
no card needed. Running GLM-5.2 *as your Claude Code model* is the paid Coding Plan
($18/mo). Now you know exactly which door is which.
