Tracks Z.ai (Zhipu AI) GLM Coding Plan usage quotas for coding subscriptions.
| Metric | Meaning |
|---|---|
| Session | 5-hour rolling window token usage (percentage) |
| Weekly | 7-day rolling window token usage (percentage) |
| Web Searches | Monthly web-search / web-reader / Zread calls (used / limit) |
When Z.ai reports your plan name, OpenUsage shows it beside the provider name.
Z.ai has no companion CLI/app that OpenUsage can reuse a credential from, so you supply an API key. OpenUsage reads it from the first place it finds one, in this order:
~/.config/openusage/zai.json—{"apiKey":"…"}(the file Settings writes to)~/.config/zai/key.json- The
ZAI_API_KEYenvironment variable - The
GLM_API_KEYenvironment variable (the legacy Zhipu name, still accepted)
You can also add and rotate the key from Settings → API Keys without touching a file. Either way, nothing leaves your Mac except the same API calls Z.ai's own subscription UI makes.
- Subscribe to a GLM Coding plan and get your API key from the Z.ai console.
- Add the key to OpenUsage via Settings → API Keys, or export it:
export ZAI_API_KEY="YOUR_API_KEY"- Z.ai appears on the dashboard and (after you star a metric) the menu bar on the next refresh.
Two undocumented internal endpoints Z.ai's own subscription UI uses (stable in practice):
GET https://api.z.ai/api/biz/subscription/list— plan name (best-effort; a failure here doesn't blank the meters).GET https://api.z.ai/api/monitor/usage/quota/limit— the quota meters.
The quota response carries a limits array. Each TOKENS_LIMIT entry is a token window; its
window length decides which meter it feeds (sub-daily → Session, multi-day → Weekly), while a
TIME_LIMIT entry is the monthly web-search count. Reset times come back as epoch milliseconds.
Missing required usage values are reported as an invalid response instead of being shown as zero.
- "No Z.ai API key" — add a key in Settings → API Keys, or export
ZAI_API_KEY. - "Z.ai API key invalid" — the key was rejected (401/403). Regenerate it in the Z.ai console.
- "No active GLM Coding Plan" (amber notice by the name) — the key is valid, but the account has no GLM Coding Plan, so there's nothing to meter. Subscribe at z.ai/subscribe; usage appears once your plan is active.
- Meters show "No usage data" — you have a plan, but the quota endpoint returned no usable limits yet. Check your plan.