Check Z.ai (Zhipu AI) GLM API usage quota, remaining sessions, and token limits.
Project description
zai-quota
Check your Z.ai (Zhipu AI / 智谱AI) GLM API usage quota, remaining sessions, and token limits.
- Standalone CLI: Single Python file, zero dependencies
- Agent Skill: Install across 45+ AI agents via
npx skills - Python Tool: Install via
uvxorpip
Quick Start
As a standalone script
curl -O https://raw.githubusercontent.com/SeeYangZhi/zai-quota/main/zai_quota.py
ZAI_API_KEY=your_key python3 zai_quota.py
As an agent skill
npx skills add SeeYangZhi/zai-quota
Works with Claude Code, Codex, OpenCode, Cursor, Windsurf, Gemini CLI, and 45+ agents.
As a Python tool
# With uv
uvx zai-quota
# With pip
pip install zai-quota
zai-quota
Standalone Usage
# Environment variable
export ZAI_API_KEY="your_api_key_here"
python3 zai_quota.py
# CLI argument
python3 zai_quota.py --key "your_api_key_here"
# JSON output
python3 zai_quota.py --json
# List supported models + availability check
python3 zai_quota.py --models
# Force a specific endpoint
python3 zai_quota.py --endpoint cn # China (open.bigmodel.cn)
python3 zai_quota.py --endpoint intl # International (api.z.ai)
Skill Usage
Once installed via npx skills add SeeYangZhi/zai-quota, compatible agents will load this skill automatically when you ask things like:
- "Check my zai quota"
- "How much GLM API usage do I have left?"
- "What's my Zhipu quota?"
The agent will run:
python3 skills/zai-quota/scripts/check_quota.py
API Key Sources (in priority order)
--keyCLI argumentZAI_API_KEYenvironment variable~/.hermes/auth.json(if you use Hermes Agent)
Output Example
Z.ai GLM Quota
Plan: Lite
-------------------------------------
[green] Time Limit
Used: 0% | Remaining: 100
- search-prime: 0
- web-reader: 0
- zread: 0
Resets: 2026-04-16 10:31 SGT
[green] Tokens
Used: 18%
Resets: in 3h
-------------------------------------
How It Works
Calls the Z.ai monitoring API to fetch your current quota usage. Supports two endpoints:
- International:
api.z.ai(default, tried first) - China:
open.bigmodel.cn(fallback)
Note: This uses an unofficial monitoring endpoint. It works today but Z.ai could change it without notice.
Requirements
- Python 3.6+
- A Z.ai API key (from z.ai or open.bigmodel.cn)
Repository Structure
├── zai_quota.py # Standalone script (root-level)
├── pyproject.toml # uv/pip packaging
├── skills/
│ └── zai-quota/
│ ├── SKILL.md # Agent Skills spec
│ └── scripts/
│ └── check_quota.py # Skill entrypoint
├── README.md
└── LICENSE
For maintainers
make sync # Copy zai_quota.py into skills/zai-quota/scripts/
make verify-sync # CI check that both copies are identical
make build # uv build
make publish # uv build + uv publish to PyPI
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zai_quota-1.2.0.tar.gz.
File metadata
- Download URL: zai_quota-1.2.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c23928d209b168a4b92cc6d66641f48ecd3f17af26bcecfead627b280c14a09f
|
|
| MD5 |
e9a8b65a868668c622f98cdb3499376e
|
|
| BLAKE2b-256 |
55876f8f348161a225b9d2fda1e1345f679f96c2bdb5d26b875735a4b5ad606f
|
Provenance
The following attestation bundles were made for zai_quota-1.2.0.tar.gz:
Publisher:
publish.yml on SeeYangZhi/zai-quota
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zai_quota-1.2.0.tar.gz -
Subject digest:
c23928d209b168a4b92cc6d66641f48ecd3f17af26bcecfead627b280c14a09f - Sigstore transparency entry: 1260641918
- Sigstore integration time:
-
Permalink:
SeeYangZhi/zai-quota@63039f6ab8ec237f03d0d90e9c8c57f67072f859 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/SeeYangZhi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@63039f6ab8ec237f03d0d90e9c8c57f67072f859 -
Trigger Event:
push
-
Statement type:
File details
Details for the file zai_quota-1.2.0-py3-none-any.whl.
File metadata
- Download URL: zai_quota-1.2.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bac2af3b5b6c0d5cb5f7b3358a2aaf09e0631b6702e98d6885c51786986cff77
|
|
| MD5 |
5f586df1dbbf57750aac60f4e4e24a1a
|
|
| BLAKE2b-256 |
d1cc90fe7d76ad36254570150d6c84b95e0cd97a3ba0f4e45043039625091790
|
Provenance
The following attestation bundles were made for zai_quota-1.2.0-py3-none-any.whl:
Publisher:
publish.yml on SeeYangZhi/zai-quota
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zai_quota-1.2.0-py3-none-any.whl -
Subject digest:
bac2af3b5b6c0d5cb5f7b3358a2aaf09e0631b6702e98d6885c51786986cff77 - Sigstore transparency entry: 1260641924
- Sigstore integration time:
-
Permalink:
SeeYangZhi/zai-quota@63039f6ab8ec237f03d0d90e9c8c57f67072f859 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/SeeYangZhi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@63039f6ab8ec237f03d0d90e9c8c57f67072f859 -
Trigger Event:
push
-
Statement type: