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.0.tar.gz (7.4 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.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zai_quota-1.1.0.tar.gz
  • Upload date:
  • Size: 7.4 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.0.tar.gz
Algorithm Hash digest
SHA256 d729998a6e8c789026a6dc9d8346792b400e84f75616d67a70e21d5a0b071482
MD5 93bed44875afa0a5b685721a714a441e
BLAKE2b-256 eaac90b4bfd5b82d846ddb1a03ab0b964c48555ad32b40376e038226d3d9cc25

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zai_quota-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bb1c4582542140b67afcd8db69c76f0a29a7f9be3d629c78e32a13a26770e00
MD5 c314005374292a88492bf75f83cde8a1
BLAKE2b-256 fa0862754366c4eba5689e903e61852a701ace3abfa126bb128fbf32ff5c063f

See more details on using hashes here.

Provenance

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