@alexanderfortin/pi-zai-usage0.6.0
Pi extension for monitoring Z.ai API token usage quota
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
Pi coding agent Z.ai Usage Extension
A Pi coding agent extension that monitors Z.ai subscription API token usage quota and automatically displays usage in the footer when using the Z.ai provider.

Features
- Auto Footer Display: Automatically shows usage in the footer when using Z.ai models
- Smart Caching: Caches usage data for 30 seconds to avoid excessive API calls
- Time Tracking: Displays remaining time until quota reset
Install
pi install npm:@alexanderfortin/pi-zai-usage
or
pi install https://github.com/shaftoe/pi-zai-usage
or if you prefer to build and keep it checked out locally:
git clone https://github.com/shaftoe/pi-zai-usage
cd pi-zai-usage
# Install dependencies
pnpm install
# Build the extension
pnpm run build
# Install the extension
pi install ./
Development
This project uses modern TypeScript development tooling:
- pnpm - Fast, disk-efficient package manager
- Node.js - JavaScript runtime
- TypeScript 6 - Static type checking with strict mode enabled
- Biome - Ultra-fast linter and formatter
# Type check
pnpm run typecheck
# Lint code
pnpm run lint
# Auto-fix lint issues
pnpm run lint:fix
# Format code
pnpm run format
# Run all checks
pnpm run check
# Watch mode for development
pnpm run dev
Usage
Automatic Footer Display
When using a Z.ai model (e.g., glm-4.7, glm-5, glm-5-flash), the extension automatically displays the usage in the footer (between brackets the time left for the quota to be reset):
Z.ai: 45% (2h 15m 30s)
The footer updates after each AI turn and on model selection changes.
Configuration
No configuration needed. The extension automatically:
- Uses cached data for 30 seconds to avoid excessive API calls
- Shows/updates status only when Z.ai models are active
- Clears status when switching to non-Z.ai models
API
The extension uses the Z.ai API endpoint: https://api.z.ai/api/monitor/usage/quota/limit
Make sure you're logged in to Z.ai via Pi (/login for Z.ai).
GLM Coding Plan (China) users
If you're on the GLM Coding Plan (China) and logged in via the zai-coding-cn
provider (/login for ZAI Coding Plan (China)), the extension automatically
uses the China endpoint https://open.bigmodel.cn/api/monitor/usage/quota/limit
with that provider's credentials. When keys for both providers are present,
the international endpoint takes precedence.
Releasing
This project uses automated publishing to NPM via GitHub Actions. The workflow will:
- Run all CI checks
- Build the package
- Publish to NPM with provenance (signed) via trusted publishing
License
MIT