Skip to main content

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 uvx or pip

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

# 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)

  1. --key CLI argument
  2. ZAI_API_KEY environment variable
  3. ~/.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

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

zai_quota-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zai_quota-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file zai_quota-1.0.0.tar.gz.

File metadata

  • Download URL: zai_quota-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zai_quota-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0acca18896075435e33e2be53b69785c69fa3fe9352e38138a2aa448a54e6cea
MD5 18fee57781abdc6ded38ecd69492d173
BLAKE2b-256 4af0c57608236d74da0dac50ef3025d856e6df4f1011ae4d22e4f052a71ef794

See more details on using hashes here.

Provenance

The following attestation bundles were made for zai_quota-1.0.0.tar.gz:

Publisher: publish.yml on SeeYangZhi/zai-quota

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zai_quota-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: zai_quota-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zai_quota-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 617d54243616630fc5561e473ab8805716d6e57d6a4f7d14a4dc4328143affe2
MD5 257eff20ba820b736d51f79b0bc0c2bb
BLAKE2b-256 78e42404edc72f49dade1a2030c3ea85417efc0480b54fe746c86b4f2eab9c89

See more details on using hashes here.

Provenance

The following attestation bundles were made for zai_quota-1.0.0-py3-none-any.whl:

Publisher: publish.yml on SeeYangZhi/zai-quota

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page