How to Get a Zhipu API Key and Make Your First Call (2026)

Blog / AI concepts

How to Get a Zhipu API Key and Make Your First Call (2026)

To get a Zhipu API key, register an account on the Zhipu Open Platform (BigModel), complete the verification the platform asks for, and create a key on the API Key management page in the console. Once you have the key, you can call the API in an OpenAI-compatible way: point your SDK at Zhipu's base URL, then supply the key and a model name. Page names, endpoint URLs, and model names change over time, so wherever this article mentions them, treat the official Zhipu documentation as the source of truth.

How many steps does it take to get a Zhipu API key?

Roughly four:

  1. Open the Zhipu Open Platform website, then register and log in. Available login methods depend on what the page offers.
  2. Complete account verification as the platform prompts you to. Whether real-name verification is required, and which features need business verification, depends on the platform's current rules.
  3. Go to the API Key management page in the console, create a new key, and give it a name that tells you what it is for.
  4. Copy the key and store it. Many platforms show the full key only once, at creation, and you cannot see it again after closing the page, so put it in a password manager or an environment variable right away.

Menu locations and labels may change when the console is redesigned. If you cannot find the entry point, go straight to the "Quick Start" section of the official docs.

How should you store the key?

A key is effectively your account's payment credential. If it leaks, someone else can spend your quota. A few practices:

  • Do not commit it to a code repository, and do not paste it into screenshots or group chats.
  • For local development, keep it in an environment variable, for example export ZHIPU_API_KEY="your-key".
  • Use one key per project so you can disable them individually. See How to manage API keys across multiple projects and How to store API keys securely.
  • If you suspect a leak, delete the key in the console first, then create a new one.

How do you make the first request?

Zhipu offers an OpenAI-compatible chat endpoint, so you can use the OpenAI Python SDK directly. Below is an example. The base URL and model name must follow the official docs; fill in a model that is available on your account where it says model-name:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["ZHIPU_API_KEY"],
    base_url="https://open.bigmodel.cn/api/paas/v4/",  # check the official docs
)

resp = client.chat.completions.create(
    model="model-name",  # pick one from the model list in the official docs
    messages=[{"role": "user", "content": "Introduce yourself in one sentence"}],
)
print(resp.choices[0].message.content)

You can also use curl to confirm the key works:

curl https://open.bigmodel.cn/api/paas/v4/chat/completions \
  -H "Authorization: Bearer $ZHIPU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"model-name","messages":[{"role":"user","content":"Hello"}]}'

The request uses the Authorization: Bearer header. Providers differ in their auth headers; see Authorization: Bearer vs x-api-key for the difference. For a more general walkthrough, see How to use an LLM API, from getting a key to the first reply.

What should you check first when a call fails?

SymptomCommon causeHow to check
Returns 401Key mistyped, extra space or newline, or the key was deletedCopy it again and verify the header format
Returns 429Too many requests or rate limiting; see the official error code docs for specificsLower concurrency, add retries with backoff; check the limits in the console
Insufficient balance or no permissionAccount balance or model access may be the problemCheck balance and model permissions in the console
Model not foundModel name misspelled, or the model was retired or renamedCompare against the latest model list in the official docs
Timeout or very slowNetwork, peak load on the platform, or an outageCheck the status page in the next section, then look at latency

The exact meaning of each error code is defined in Zhipu's official error code documentation. The causes above are just common directions for troubleshooting.

Where do you see billing and usage?

Billing is shown in the Zhipu Open Platform console, where you can usually find pages for balance, usage, and bills. The exact entry point depends on the current interface. Prices, free quotas, and resource-pack rules get adjusted, so this article gives no specific figures; follow what the platform publishes.

One practical habit: on your first call, set the maximum output length (the parameter name depends on the official docs) to a small value, and raise it once the response looks normal. For cost estimation, you can apply the formula in How to estimate LLM API costs.

If the API doesn't respond, is it your side or the platform's?

Rule out your own side first: is the key valid, is the network reachable, is the request format correct. Then look at the server side:

  • /en/status/zhipu shows the results of cdnping probing the Zhipu API entry point from the Cloudflare edge every 5 minutes, with 30 days of history. cdnping started collecting data on October 17, 2026, so the history is still short. Use it as a recent reference, not as long-term statistics.
  • To see first-connection and round-trip times from your own network to each provider's API, use the cdnping online speed test on the home page, which runs right in your browser.
  • Latency to Chinese models from inside China differs in makeup from latency to overseas models; see Why AI API latency varies so much in China for the reasons.

If the status page shows the entry point is healthy and your calls still fail, the problem is most likely the key, permissions, or request parameters. Go back to the table above and check each item.

Is Zhipu enough, or should you connect other models too?

Many people start with one provider and later find that different tasks suit different models: cost and quality differ for long-context work, coding, and batch processing. Connecting another provider follows basically the same flow: register, create a key, change the base_url, pick a model. See the others in this series, How to get a DeepSeek API key and make your first request and How to get a Kimi (Moonshot AI) API key. Keeping a separate account and a separate set of keys for each provider gets tedious; for a conceptual alternative, see How one API key can call multiple providers' models.

As one option, AGI Plan is a multi-provider LLM aggregation gateway. It is billed by monthly subscription, paid in RMB, requires no overseas credit card, and is compatible with both the OpenAI and Anthropic API formats. Tools such as Claude Code and Codex only need one endpoint changed to switch between different capability groups within the same quota. Note that the service explicitly states it is not an officially authorized channel, and some models are labeled "overseas only"; see agiplan.dev/models for specifics. AGI Plan is a commercial partner of cdnping. If you just want to get Zhipu working first, there is no need to rush into this one.

What to do next

  1. Create a key following the four steps above and store it in an environment variable.
  2. Send your first request with the curl or Python example and confirm you get a reply.
  3. Build some budget awareness in the console: find the balance and usage pages, and read How to set a spending limit on an AI API so a runaway job can't drain your balance overnight.
  4. When you need to switch between multiple tools and models, look at how to connect to AGI Plan.

Related articles

Keep reading