Getting startedQuickstart
Quickstart
Install zquota, set your Z.ai API key, read the quota view, then try the compact view, a timezone, watch mode and a threshold.
Install
Section titled “Install”brew tap netspeedy/zquotabrew install zquotamacOS and Linux. If Homebrew refuses the new third-party tap, runbrew trust netspeedy/zquota once, then install again.
sudo install -d -m 0755 /etc/apt/keyringscurl -fsSL https://netspeedy.github.io/zquota/zquota-archive-keyring.gpg \ | sudo tee /etc/apt/keyrings/zquota-archive-keyring.gpg >/dev/null
sudo tee /etc/apt/sources.list.d/zquota.sources >/dev/null <<'EOF'Types: deb deb-srcURIs: https://netspeedy.github.io/zquota/Suites: stableComponents: mainSigned-By: /etc/apt/keyrings/zquota-archive-keyring.gpgEOF
sudo apt update && sudo apt install zquotaThe repository is signed with DDD9 21F2 DC58 4A5B D421 8FD9 6946 EE31 E131 3662. The package needs Python 3.12 or newer, so Debian 13 or Ubuntu 24.04 and later.
python3 -m pip install git+https://github.com/netspeedy/zquota.git@v0.1.4Python 3.12 or newer. zquota has no dependencies outside the standard library.
mkdir -p ~/.local/bincurl -fsSL https://raw.githubusercontent.com/netspeedy/zquota/v0.1.4/zquota.py -o ~/.local/bin/zquotachmod +x ~/.local/bin/zquotazquota is one Python file. This needs python3 3.12 or newer on your PATH, and~/.local/bin on your PATH too.
Check it’s on your path:
zquota --versionIt prints zquota and the version, such as zquota 0.1.3.
Installation has the other ways to install it and what each one puts
where.
Set your API key
Section titled “Set your API key”zquota needs a Z.ai API key. Put it in the environment rather than on the command line, where it would end up in your shell history and the process list:
export ZAI_API_KEY='your-api-key'Add the same line to your shell’s profile to keep it for new terminals. Configuration covers the key, the timezone and the endpoint in more detail.
Check your quota
Section titled “Check your quota”zquotaYou get your plan, then a block for each window Z.ai reports:
Z.ai plan: pro
│ 5-Hour Rolling Token Quota │ │ [██████████████░░░░░░░░░░] 62% used │ Remaining: 38% │ Limit: 1.0M │ Used: 620.0k │ Remaining: 380.0k │ Resets in: 2h 13m 6s │ Resets at: 2026-11-05 09:25:00 GMT ────────────────────────────────── │ Weekly Token Quota │ │ [███████░░░░░░░░░░░░░░░░░] 31% used │ Remaining: 69% │ Limit: 8.0M │ Used: 2.5M │ Remaining: 5.5M │ Resets in: 4d 6h 11m │ Resets at: 2026-11-09 13:23:00 GMT ──────────────────────────────────Each block has the window’s name, a bar of how much you’ve used with the percentage beside it, what’s left as a percentage, the window’s limit, what you’ve used and what remains, and when it resets: a countdown and the exact local time. On a terminal the bar is green below 70%, yellow from 70% and red from 90%, and the countdown is yellow. Windows appear in the order Z.ai lists them.
Quota windows explains each window, and Usage and limits explains the numbers.
Try the other views
Section titled “Try the other views”One line per window, for a narrow terminal or a status bar:
zquota --compactPlan: pro 5h-rolling [██████░░░░] 62% left: 380.0k reset: 2h 13m 6s weekly [███░░░░░░░] 31% left: 5.5M reset: 4d 6h 11mReset times are shown in Europe/London unless you say otherwise. Give an IANA timezone name with
--timezone, or set ZAI_TIMEZONE to make it stick:
zquota --timezone America/New_Yorkexport ZAI_TIMEZONE=America/New_YorkKeep the view on screen and refresh it every 30 seconds until you press Ctrl-C:
zquota --watch 30Exit with code 2 when any window is at 80% or more, which is what a script or a cron job checks:
zquota --threshold 80echo $?The view prints either way. The exit code is 0 when every window is under the threshold, 2 when at least one has reached it, and 1 when zquota couldn’t get an answer at all.