Skip to main content

Z.AI GLM API key setup

GLM coding plans via Z.ai: $18/month Lite, $80/month Pro, and $168/month Max before quarterly/yearly discounts. The free Z.ai chat surface and paid API/coding-plan limits are separate.

Disclosure: the sign-up link in step 1 is a partner link. Dracon may earn a commission when you create an account through it. It never changes the price you pay, and Z.AI GLM's own site is always reachable directly at z.ai.

Get your key

  1. Open the Z.AI GLM API keys page: z.ai/subscribe?ic=FD6ODRFLIG partner link
  2. Create an account and generate an API key.
  3. Paste it into the Dracon BYOK provider keys, stored encrypted (AES-256-GCM), used browser-direct, works in every Dracon tool.

Use your key in every tab

Two free extensions take the key you just set up. Both read the page you are on and use your own provider key: free, no account, nothing stored on a server we run.

SamAI

Summarize or ask about any page with your own provider key.

Add to Chrome Add to Firefox

AI Auto Form Filler

Complete a web form from a short description, using a model you bring yourself.

Add to Chrome Add to Firefox

All extensions · last checked 2026-10-22.

Get the key and test it

  1. Open the Z.AI GLM API keys page: z.ai/manage-apikey/apikey-list Create a key and copy the secret straight away.
  2. Point your client at this provider's base URL: https://api.z.ai/api/paas/v4 It speaks the OpenAI-compatible shape, so an OpenAI SDK client works against it with no adapter: only the base URL and the key change.
  3. Prove the endpoint answers before you trust it. Send one call with no Authorization header: a live endpoint answers 401 Unauthorized, because it is waiting for a bearer key. The wording of that error differs by provider (some say invalid_api_key, others incorrect_api_key or Token is invalid), so read the 401 as the signal, not the error text.
  4. Paste the key into the Dracon BYOK provider keys ; stored encrypted, used browser-direct, no relay.
  5. Compare other provider plans when this subscription does not match your usage or budget.

Test the key

Both examples read the key from the ZAI_API_KEY environment variable, so the key stays out of the command line.

export ZAI_API_KEY="<YOUR_API_KEY>"

curl https://api.z.ai/api/paas/v4/chat/completions \
  -H "Authorization: Bearer $ZAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"glm-4.6","messages":[{"role":"user","content":"hi"}]}'
import os
from openai import OpenAI

# export ZAI_API_KEY="<YOUR_API_KEY>" first
client = OpenAI(
    api_key=os.environ["ZAI_API_KEY"],
    base_url="https://api.z.ai/api/paas/v4",
)
resp = client.chat.completions.create(
    model="glm-4.6",
    messages=[{"role": "user", "content": "hi"}],
)
print(resp.choices[0].message.content)

Free tier

Yes. Z.ai chat is available free with current GLM access; the API and coding plans are paid with separate limits. no credit card required

Rate limits: Lite: 10,000 credits / week. Pro: 6× Lite usage. Max: 14× Lite usage. The plan supports 20+ agent tools; exact model access and limits can change.

Paid plans compared

Every tier Z.AI GLM publishes, with the price and the limit as the vendor states them, last checked 2026-10-26. Confirm with the provider before you buy. You pay them directly, no Dracon markup.

Z.AI GLM subscription plans: price, usage limit and what each tier includes.
PlanPriceUsage limitWhat you get
Lite$18/mo10,000 credits / week; Billing periods: $18/month, $14.40/month on the quarterly plan (20% off) and $12.60/month on the yearly plan (30% off)
  • Rolling access to the latest flagship models and features
  • Supports 20+ agent tools, including ZCode, Claude Code, OpenCode, and Cursor
  • Default data privacy
Pro$80/mo6× Lite usage; Billing periods: $80/month, $64/month on the quarterly plan (20% off) and $56/month on the yearly plan (30% off)
  • All Lite benefits
  • Priority access to the latest flagship models and features
  • Curated MCP tools
  • Faster generation speeds
Max$168/mo14× Lite usage; Billing periods: $168/month, $134.40/month on the quarterly plan (20% off) and $117.60/month on the yearly plan (30% off)
  • All Pro benefits
  • First access to the latest flagship models and features
  • Dedicated resources during peak times

Official plan source: z.ai/subscribe

Connection details

Base URL
https://api.z.ai/api/paas/v4
API shape
OpenAI-compatible
Env var
ZAI_API_KEY
Models
glm-4.6, glm-4.5-air
Model lineup
GLM-5.3, GLM-5.3-Flash, GLM-5.2, GLM-5-Turbo

Our verdicts on this kind of provider

Independent comparisons we keep current as pricing and free tiers shift. A guide is setup; a verdict is whether it's worth setting up.

Add your Z.AI GLM key Add this provider to a fallback list Compare provider plans