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.1.1.tar.gz (7.3 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.1.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zai_quota-1.1.1.tar.gz
  • Upload date:
  • Size: 7.3 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.1.1.tar.gz
Algorithm Hash digest
SHA256 cd4b759ef123e2fadc92dd635282b7f1e081b7a87408c7156bd1b2a3a91dd7cc
MD5 39a0a2df9bd4db894426750f18afb942
BLAKE2b-256 14d7962505a8013cdd6f15e6f3f4c6f01d01b66170f8243f06a6b4d1c2de1185

See more details on using hashes here.

Provenance

The following attestation bundles were made for zai_quota-1.1.1.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.1.1-py3-none-any.whl.

File metadata

  • Download URL: zai_quota-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f714ae7f1ddf929f746b3afdee03dfda6b685b42a215fe6e382643e272ff21b7
MD5 6f5b67e996facd0dd0f302c955c2f106
BLAKE2b-256 f74e4641267f8d61dfde793590ae3460114c57a22f4f315f3f3f6475a7915c57

See more details on using hashes here.

Provenance

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