Skip to main content

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 planGLM API (this guide)
BillingSubscribe and spend the plan's allowanceCharged from your Zhipu account balance by usage
QuotaVendor documents a per-5-hour + per-week dual cap; wait for the next window when used upBilled from account balance, with no plan-style quota pool
Best forDaily, steady usageOccasional use, spend control by usage
SetupComes with ZCode, nothing to configureCreate 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.

The top-up page offers several preset amounts (the page shows a few common ones) plus a custom amount.

Zhipu BigModel top-up page: several preset amounts plus a custom amount, with Alipay and WeChat Pay

About usage

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โ€‹

  1. Click New API Key at the top right;
  2. Give it a name you'll recognize (for example zcode) and click OK;
  3. In the dialog, click Copy immediately โ€” the key is shown in full only once.

Zhipu BigModel API Key page: the New API Key dialog with the name zcode entered before confirming

Zhipu BigModel save-your-key dialog: warns the key is shown in plain text once, with a Copy button

An API key is a password
  • 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.

There may already be 3 similar entries โ€” do not pick the wrong one

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โ€‹

FieldWhat to enter
Provider nameGLM (consider naming it "GLM pay-as-you-go" to avoid confusion with the built-in BigModel)
API formatChat Completions
Base URLhttps://open.bigmodel.cn/api/paas/v4 (do not add a trailing /)
API keyThe key you copied above
Model IDGLM-5.3-Flash (follow your ZCode list)

Input types are not part of this step โ€” the next section covers them.

ZCode Model Settings - GLM provider: Base URL filled, format Chat Completions, key hidden, models GLM-5.3-Flash / GLM-5.3

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.

Naming varies โ€” follow your list

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):

EntryWhat it isRoute
BigModel - Coding PlanBuilt-in planAnthropic format
Bigmodel - API KeyBuilt-in API-key providerAnthropic format
The GLM pay-as-you-go you createdThis guide's routeChat 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.

Enabled does not mean verified

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.

Do not guess capability from the model name

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.

Always run this step

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โ€‹

MistakeConsequenceHow to avoid
๐Ÿ”ด Leaking the API keySomeone else can spend your balanceKeep it only in ZCode; never paste it into chats/screenshots/repos; disable and recreate it if usage looks odd
๐Ÿ”ด Skipping the Test buttonYou think it works, but it does not connectClick Test and see "Connected" before moving on
๐ŸŸก Wrong model ID"Model not found" errorCopy the current available ID from the ZCode list or console
๐ŸŸก Format and Base URL mismatchConnection failsUse the matching pair; copy the address exactly
๐ŸŸก Treating a UI switch as capabilityImage/video upload failsAn enabled switch is not a guarantee; confirm official capability, then test with an ordinary file
๐ŸŸข Not knowing plan vs pay-as-you-goWrong charges, mixed allowanceRename your provider (e.g. "GLM pay-as-you-go")
๐ŸŸข Insufficient balanceRequests rejectedTop 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 Completions and Base URL is https://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.
๐Ÿš€ Next

๐Ÿ“„ Step 4 ยท Install the ZCode AI Agent Team โ€” put GLM to work alongside other models by role.

๐Ÿ“š Further Readingโ€‹