og.cc.cd / guides / glm-api-key

How to Get a Zhipu GLM API Key on bigmodel.cn or Z.ai

By og.cc.cd · Published · Updated · 3 min read

TL;DR: Zhipu runs two GLM developer platforms — open.bigmodel.cn (China) and z.ai (international) — both OpenAI-style with Bearer auth; plan keys and standard API keys are not interchangeable.

Updated · All sources ↓

Zhipu runs two developer platforms for its GLM models: open.bigmodel.cn in China and z.ai internationally. Both use an OpenAI-style API with Bearer auth; the main trap is that plan keys and standard API keys are not interchangeable.

Estimate your monthly API cost →All guides

China site: open.bigmodel.cn

  1. Register or sign in via the top-right corner of https://open.bigmodel.cn.
  2. Go to the user centre → API Keys (https://bigmodel.cn/usercenter/proj-mgmt/apikeys) and create a new API key (快速开始).

Three kinds of key are managed separately and do not work for each other: personal plan keys, team plan keys, and standard model-API keys. A Coding Plan uses its own endpoint, too. Make sure the key matches what you are calling.

  • Real-name: “calling the API does not currently require real-name verification”, though Zhipu recommends it. Personal verification by face recognition completes instantly, and overseas companies can be verified too (实名认证 FAQ).
  • Not verified by us: what sign-up needs (phone or email), the key format, any free quota, top-up and payment methods. When the account is in arrears the API returns business code 1113 (“please top up and retry”).

International site: z.ai

  1. Register or log in at https://z.ai/model-api.
  2. Top up as needed on the Billing page (https://z.ai/manage-apikey/billing).
  3. On the API Keys page (https://z.ai/manage-apikey/apikey-list), “Create a Standard API Key” and copy it (Z.ai Quick Start).

The z.ai pages we checked do not state a free quota, payment methods or regional restrictions.

Base URLs and authentication

SiteEndpointAuthModel
bigmodel.cnhttps://open.bigmodel.cn/api/paas/v4/chat/completionsAuthorization: Bearer …glm-5.3 (multimodal: glm-5.3-flash)
z.aihttps://api.z.ai/api/paas/v4/ (works directly with the OpenAI SDK)Authorization: Bearer …glm-5.3

Hello world

# Zhipu's docs recommend an env var but don't name one; GLM_API_KEY is our choice.
export GLM_API_KEY="paste-your-key-here"   # never hard-code it

curl https://open.bigmodel.cn/api/paas/v4/chat/completions \
  -H "Authorization: Bearer $GLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'
# International (z.ai): https://api.z.ai/api/paas/v4/chat/completions

Common errors

  • 1113 — account in arrears; top up and retry (错误码).
  • 1302 (HTTP 429) — rate limit exceeded. The tier details are on Zhipu’s rate-limit page, which we did not check.
  • Plan key used on the standard API (or vice versa) — the three key types are not interchangeable.
  • Safety: Zhipu says “don’t share it with others or hard-code it; use environment variables or a config file”. Put the key in an environment variable, keep it out of Git and out of any code that runs in a browser or mobile app, and replace it if it is ever exposed. The API keys overview has the full checklist.

Before you top up, paste a typical prompt into the token counter and estimate a month of traffic with the LLM cost calculator.

FAQ

Do I need real-name verification for the GLM API?

On bigmodel.cn it is not currently mandatory for API calls, but it is recommended.

Which environment variable name should I use?

Zhipu recommends an environment variable or config file but does not prescribe a name. Pick one (we use GLM_API_KEY) and use it consistently.

Is a z.ai key valid on bigmodel.cn?

They are separate platforms with separate consoles and base URLs; create the key on the platform whose endpoint you call. The docs we checked do not describe any cross-use.

Sources

Vendor features and prices were checked against these official pages on 2026-10-20. Products change; if something here no longer matches, the official page is right.

Related guides