Featured image for Z.ai Coding Plan: Base URL, API Key and Setup

Z.ai Coding Plan: Base URL, API Key and Setup

Published on:

Reading time: 5 min

Topic: Technology

Author: Leandro Valencia

#z.ai#glm coding plan#base url#api key#claude code#cline

The exact GLM Coding Plan endpoints: base URL for Claude Code and for Cline, which key to use, and why the wrong endpoint never draws down your quota.

Table of Contents

The endpoints, no preamble

Tool Base URL
Claude Code (Anthropic-compatible endpoint) https://api.z.ai/api/anthropic
Cline, Roo, Kilo, VS Code (OpenAI-compatible) https://api.z.ai/api/coding/paas/v4
Guided setup npx @z_ai/coding-helper

In both cases the token is your GLM Coding Plan API key.

And here is the detail that costs money: they are not interchangeable. The /api/anthropic endpoint is the one Claude Code understands. The /api/coding/paas/v4 one is OpenAI-compatible. If you paste one where the other belongs, either it works but never draws down your quota, or it fails and the error message does not tell you why.

The official shortcut

Before configuring anything by hand:

npx @z_ai/coding-helper

Z.ai's helper walks you through installing and configuring the tool and the plan. If you are unsure which endpoint applies to you, this route removes the problem entirely: it writes the config for you.

Manual setup makes sense when you already know what you want, when you are automating setup across machines, or when the helper does not cover your client.

Claude Code, step by step

The idea is to point Claude Code at Z.ai instead of Anthropic:

  • Base URL: https://api.z.ai/api/anthropic
  • Token: your Coding Plan API key

The current details are in Z.ai's Claude Code documentation. I stress "current": if you copy a 2024 tutorial with a different URL, you will either spend quota in the wrong place or spend none at all.

Cline, Roo and OpenAI-compatible clients

In VS Code with Cline:

  1. API ProviderOpenAI Compatible (or the "Z AI" provider if it shows in the list).
  2. Base URLhttps://api.z.ai/api/coding/paas/v4
  3. API Key → your Coding Plan key.
  4. Model → whichever GLM is active on your plan.

Z.ai's Cline documentation beats any old screenshot you find in a forum.

OpenCode, Roo and the rest follow the same pattern: coding endpoint + plan key.

The error nobody diagnoses: "it works but nothing gets deducted"

This is the most expensive failure and the quietest one, so it earns its own section.

There are two ways to get it wrong, and both produce the same symptom:

1. Wrong endpoint. If you paste the generic chat endpoint instead of the coding one, the request may work, but it does not come out of your subscription quota. Z.ai states this explicitly in its docs.

2. Wrong key. If you paid for the subscription but created a pay-as-you-go key instead of a Coding Plan key, your usage gets billed separately. You pay twice: for the subscription you are not using, and for the usage you are.

How to catch it: send a real prompt — not a "hello" — and watch usage in the console. If the number does not move, you have one of the two problems.

Which key to create, exactly

Once payment clears, go into the console (the tab is called something like API Keys or Billing; the exact name changes with each redesign, the concept does not):

  1. Create a Coding Plan key. Not a standalone pay-as-you-go key.
  2. Copy it once. Treat it like a password.
  3. Do not push it to a repo, do not paste it in a Discord, do not leave it in a screenshot.

If you rotate the key later, you update the tool; you do not need to pay for the plan again.

Lite, Pro and Max: what actually changes

All three tiers use the same models. The only thing that changes is how much quota you get.

That makes the decision simpler than it looks: start on Lite monthly and scale when you genuinely run short. Two concrete warnings:

  • Z.ai subscriptions are non-refundable once purchased.
  • Do not marry Max annual on day one. The big number feels like "savings"; it is a commitment.

If you are weighing this plan against OpenCode's subscription, we break that down in Z.ai GLM vs OpenCode Go.

Setup checklist

  1. Coding Plan key created (not pay-as-you-go).
  2. Correct endpoint for your tool: /api/anthropic for Claude Code, /api/coding/paas/v4 for OpenAI clients.
  3. A real prompt sent.
  4. Usage verified in the console: if it does not drop, something is wrong.
  5. One tool configured before you add the second.

Keep reading

Step-by-step guide

  1. Create the Coding Plan key

    In the Z.ai console, create a plan key, not a pay-as-you-go one. The wrong one never draws down your quota.

  2. Pick your tool's endpoint

    Claude Code uses `/api/anthropic`. Cline, Roo and OpenAI clients use `/api/coding/paas/v4`.

  3. Paste the base URL and token

    The token is your Coding Plan API key. In Claude Code it goes as the token for the Anthropic-compatible endpoint.

  4. Verify the quota drops

    Send a real prompt and check usage in the console. If it does not move, the endpoint or the key is wrong.

  5. Leave the rest for later

    One tool, one endpoint, one prompt. Configuring three clients the same day is the fastest way to not know what broke.

Frequently asked questions

What is the Z.ai Coding Plan base URL?

It depends on the tool. For Claude Code, the Anthropic-compatible endpoint: `https://api.z.ai/api/anthropic`. For Cline, Roo, Kilo and any OpenAI-compatible client: `https://api.z.ai/api/coding/paas/v4`. They are not interchangeable.

What does npx @z_ai/coding-helper do?

It is Z.ai's official shortcut: a terminal assistant that walks you through installing and configuring the tool and the plan without pasting endpoints by hand. If you are unsure about manual setup, start there.

Why does my plan quota never go down even though it works?

Because you are hitting a generic chat endpoint instead of the coding endpoint, or using a pay-as-you-go key instead of the Coding Plan key. Z.ai warns about this: the wrong endpoint does not draw down plan quota. The classic symptom is it works but it does not consume my Lite.

Which key do I use, the plan one or a standalone one?

The Coding Plan key. If you paid for the subscription and create a pay-as-you-go key, your usage gets billed separately instead of coming out of your quota. In the Z.ai console they are created in different places, even as the screen gets renamed between redesigns.

Do Lite, Pro and Max use different models?

No. All three tiers use the same GLM models. The only thing that changes is how much quota you get. That is why it makes sense to start on Lite monthly and scale only when you genuinely run short.

Can I get a refund on the GLM Coding Plan?

No. Z.ai subscriptions are non-refundable once purchased. That is the strongest argument for starting on Lite monthly rather than committing to Max annual on day one.

Related Posts

Keep exploring similar content that may interest you

Partnerships

Tools I use every day, on better terms for this community.

Affiliate links. Your price does not change.See all partnerships
Training program

Ready to turn your idea into a real project?

Transforma is the program where you will learn to create, execute and scale your project with clarity and method.

Discover the Transforma Program