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

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

  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.2.0.tar.gz (7.5 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.2.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

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

Hashes for zai_quota-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c23928d209b168a4b92cc6d66641f48ecd3f17af26bcecfead627b280c14a09f
MD5 e9a8b65a868668c622f98cdb3499376e
BLAKE2b-256 55876f8f348161a225b9d2fda1e1345f679f96c2bdb5d26b875735a4b5ad606f

See more details on using hashes here.

Provenance

The following attestation bundles were made for zai_quota-1.2.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.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

Hashes for zai_quota-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bac2af3b5b6c0d5cb5f7b3358a2aaf09e0631b6702e98d6885c51786986cff77
MD5 5f586df1dbbf57750aac60f4e4e24a1a
BLAKE2b-256 d1cc90fe7d76ad36254570150d6c84b95e0cd97a3ba0f4e45043039625091790

See more details on using hashes here.

Provenance

The following attestation bundles were made for zai_quota-1.2.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