Connect GLM API to ZCode (Pay-as-you-go)
โฌ ๏ธ Coming from ยท Step 3 ยท Configure Plans and Models already set up a built-in plan and an everyday model โ this guide adds a pay-as-you-go GLM on top.
๐ก What you'll finish here: create an API key โ confirm balance (top up if needed) โ connect and test it in ZCode. About 15 minutes.
๐บ๏ธ The Flowโ
๐ฏ When to Use Itโ
Once ZCode is installed, you already have a built-in GLM plan (the one from Step 3). So why add another?
Because the billing model is different:
- Built-in plan: subscribe first and spend the plan's allowance โ good for daily, steady usage;
- Pay-as-you-go API: no subscription, charged straight from your Zhipu account balance โ good for occasional use or when you want to control spend by usage.
If you already have a plan and it works fine, you do not need this guide.
๐ค Plan or Pay-as-you-goโ
The two do not conflict and can coexist (ZCode will show them as two providers). The difference is billing and quota:
| Built-in GLM plan | GLM API (this guide) | |
|---|---|---|
| Billing | Subscribe and spend the plan's allowance | Charged from your Zhipu account balance by usage |
| Quota | Vendor documents a per-5-hour + per-week dual cap; wait for the next window when used up | Billed from account balance, with no plan-style quota pool |
| Best for | Daily, steady usage | Occasional use, spend control by usage |
| Setup | Comes with ZCode, nothing to configure | Create your own API key and provider |
๐ก This is only a difference in how you pay โ it does not mean one model is better. Both use GLM models. For pricing, rate limits, and account rules, follow the console and the official page.
๐ฐ What It Costsโ
Charged by actual usage from your account balance. If the account already has usable balance, skip the top-up and continue; top up only when needed.
- Top up: ๐ Zhipu account top-up
- Pricing: ๐ Zhipu model pricing
The top-up page offers several preset amounts (the page shows a few common ones) plus a custom amount.

How long it lasts depends on how many tasks you run, what you send, and the current price. This guide promises no specific duration or cost โ check the usage log in your console. Top-up only solves balance; it does not fix a wrong model ID, a format mismatch, or a permission problem.
๐ Get an API Keyโ
1. Open the API Key pageโ
Open the ๐ Zhipu API Key page and sign in.
2. Create and copy itโ
- Click New API Key at the top right;
- Give it a name you'll recognize (for example
zcode) and click OK; - In the dialog, click Copy immediately โ the key is shown in full only once.


- Put it only into ZCode; never paste it into chats, screenshots, tutorials, issues, or public repositories;
- Mask it fully before taking any screenshot;
- Never upload or share ZCode's config file (such as
config.json); - If usage looks abnormal, disable the old key and create a new one right away.
โ๏ธ Connect It in ZCodeโ
1. Open model settingsโ
Path:
Gear icon (lower left) โ Settings โ Model Settings
Click Add Provider to create one โ do not reuse an existing built-in entry.
After ZCode is installed, several GLM-related entries can appear; only the one you create is this guide's pay-as-you-go route:
BigModel - Coding Plan: the built-in plan, using the Anthropic format โ not this guide;Bigmodel - API Key: a built-in API-key provider, also Anthropic-format โ also not this guide;- The one you create (name it
GLM pay-as-you-go): this is the one, using Chat Completions.
If you pick one of the first two, the format and URL will not match and you may think it is configured when it is a different route.
2. Fill in the connection fieldsโ
| Field | What to enter |
|---|---|
| Provider name | GLM (consider naming it "GLM pay-as-you-go" to avoid confusion with the built-in BigModel) |
| API format | Chat Completions |
| Base URL | https://open.bigmodel.cn/api/paas/v4 (do not add a trailing /) |
| API key | The key you copied above |
| Model ID | GLM-5.3-Flash (follow your ZCode list) |
Input types are not part of this step โ the next section covers them.

3. Where the model ID comes fromโ
Select it from the ZCode model list first; if it is not there, copy a real, available ID from the ๐ Zhipu platform or the ๐ official model docs. Case and symbols must match exactly โ never type it from memory.
GLM-5.3-Flash and GLM-5.3 are what this guide's screenshot shows. Use whichever ID your ZCode list shows. If you only find lowercase variants (such as glm-4.5), follow the console and official docs โ do not hand-edit just to match this tutorial.
4. One easy mix-upโ
ZCode may hold three GLM-related entries (see the warning above):
| Entry | What it is | Route |
|---|---|---|
BigModel - Coding Plan | Built-in plan | Anthropic format |
Bigmodel - API Key | Built-in API-key provider | Anthropic format |
The GLM pay-as-you-go you created | This guide's route | Chat Completions |
Rename yours clearly (such as GLM pay-as-you-go) so you know later whether you are spending plan allowance or account balance.
๐งฉ Input Typesโ
Edit the model: the UI offers input switches such as Text / Image / Video / PDF. Enable what you need, set the output type to Text, and save.
The UI offering a switch only means ZCode provides the option โ it does not mean the model officially supports it. Before first using a given file type (especially image / video / PDF), test it once with an ordinary, non-sensitive file; if it fails, do not rely on it.
Rely on the vendor's official model list and the capability labels shown in ZCode. Do not upload business data just to test.
โ Test and Use Itโ
1. Test the connectionโ
Click the Test button in the model list (its icon position may vary by version). Only a green Connected means it works.
The model ID and URL here come from one tested setup โ whether your account can use the same ID is only known by clicking Test. If it reports "model not found" or fails to connect, copy a currently available ID from the console and try again.
2. How to select itโ
Below the prompt box in a new task there is a model menu; choose GLM โ the model you configured.
3. Add it to the teamโ
If you installed the ZCode AI agent team, installation or update reads the capability list and assigns roles automatically. GLM may be assigned to Chinese-language roles โ follow the role list after install/update.
๐ Common Mistakesโ
| Mistake | Consequence | How to avoid |
|---|---|---|
| ๐ด Leaking the API key | Someone else can spend your balance | Keep it only in ZCode; never paste it into chats/screenshots/repos; disable and recreate it if usage looks odd |
| ๐ด Skipping the Test button | You think it works, but it does not connect | Click Test and see "Connected" before moving on |
| ๐ก Wrong model ID | "Model not found" error | Copy the current available ID from the ZCode list or console |
| ๐ก Format and Base URL mismatch | Connection fails | Use the matching pair; copy the address exactly |
| ๐ก Treating a UI switch as capability | Image/video upload fails | An enabled switch is not a guarantee; confirm official capability, then test with an ordinary file |
| ๐ข Not knowing plan vs pay-as-you-go | Wrong charges, mixed allowance | Rename your provider (e.g. "GLM pay-as-you-go") |
| ๐ข Insufficient balance | Requests rejected | Top up at the ๐ top-up page |
โ Completion Checkโ
- Zhipu account signed in;
- API key created, and confirmed it was not pasted anywhere public;
- Account balance confirmed (topped up if needed);
- The GLM provider in ZCode shows Enabled;
- API format is
Chat Completionsand Base URL ishttps://open.bigmodel.cn/api/paas/v4; - The model ID was copied from the list or console;
- Input types enabled as needed;
- Clicking Test shows "Connected", and the text test passes.
๐ Step 4 ยท Install the ZCode AI Agent Team โ put GLM to work alongside other models by role.
๐ Further Readingโ
- ๐ Step 3 ยท Configure Plans and Models: how to choose a built-in plan, plus the Base URL cheat sheet
- ๐ Connect DeepSeek to ZCode: Complete Guide: another full third-party setup example
- ๐ Zhipu model pricing: the latest billing rules