Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mdrv/opencode-quota) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
opencode-quota
OpenCode plugin for querying Z.ai GLM, GitHub Copilot, and Kimi usage statistics. Check quota limits, model usage, and MCP tool usage with manual commands.
Features
- 📊 Multi-Platform Support: Query GLM, GitHub Copilot, and Kimi Coding Plans.
- 🖱️ Manual-Only: Plugin only runs when you ask (no periodic background checks).
- ⏱️ Human Durations: Clear reset timers (e.g.,
24d 13h 6m 12s), hiding zero values. - 🔐 Secure Credential Discovery: Automatically fetches tokens from OpenCode auth context.
- 📈 Visual Progress: Plain text progress bars and usage percentages.
- ⚡ Fail-Fast: Direct reporting without hidden retry loops.
Installation
Option 1: npm (Recommended)
# Install package
npm install opencode-glm-quota
# Run installer to configure OpenCode
npx opencode-glm-quota installWhat the installer does:
- Copies
/glm_quota,/copilot_quota, and/kimi_quotacommands to your OpenCode config. - Configures skill documentation in
~/.config/opencode/skills/. - Automatically adds the plugin to your OpenCode configuration.
Uninstall
npx opencode-glm-quota uninstallQuick Start
Run any of the following commands in OpenCode:
/glm_quota # Z.AI GLM Coding Plan statistics
/copilot_quota # GitHub Copilot usage statistics
/kimi_quota # Kimi Coding Plan usage statisticsCLI Usage
Check your quota directly from the terminal using the provided binaries:
# Check GLM quota
bun run bin/glm-quota.ts
# Check GitHub Copilot quota
bun run bin/copilot-quota.ts
# Check Kimi quota
bun run bin/kimi-quota.tsCLI Flags
| Flag | Shorthand | Description |
|---|---|---|
--debug |
-d |
Enable debug logging (hidden by default) |
--raw |
Output raw JSON (useful for scripting) | |
--help |
-h |
Show help message |
Platform Features
Z.AI GLM
- Shows TIME_LIMIT (1-month) and TOKENS_LIMIT (5-hour rolling window).
- Detailed model usage counts and MCP tool usage statistics.
GitHub Copilot
- Displays user login, subscription plan, and reset dates.
- Shows usage for Chat, Completions, and Premium features.
- Indicates if usage is "Unlimited".
Kimi
- Shows total usage and 5-hour rolling window usage.
- Displays specific "Time to Reset" for each quota window.
Output Example
--------------------------------------------------------
Z.ai GLM Coding Plan Usage Statistics
--------------------------------------------------------
Platform: Z.AI
Period: 2026-02-22 09:00:00 -> 2026-02-23 08:59:59
--------------------------------------------------------
QUOTA LIMITS
- Token usage(5 Hour) [###################--------] 40.5%
- MCP usage(1 Month) [####-----------------------] 12.3%
Used: 123/1,000
Reset in: 12d 4h 15m
--------------------------------------------------------
MODEL USAGE (24h)
- Total Tokens (24h): 12,500,000 (31% of 5h limit)
- 5h Window Usage: 40.5% of 40,000,000
- Total Calls: 1,234
--------------------------------------------------------
TOOL/MCP USAGE (24h)
- Network Searches: 5,678
- Web Reads: 2,345
- ZRead Calls: 890
--------------------------------------------------------Error Handling
The plugin uses fail-fast error handling. If an API request fails or credentials are missing, it displays a plain text error message immediately.
--------------------------------------------------------
ERROR: Z.ai Credentials Not Found
--------------------------------------------------------
Please authenticate first:
1. Run /connect in OpenCode TUI
2. Select "Z.AI Coding Plan" or "Z.AI"
--------------------------------------------------------API Reference
| Platform | Endpoint |
|---|---|
| Z.AI GLM | https://api.z.ai/api/monitor/usage/* |
| GitHub Copilot | https://api.github.com/copilot_internal/user |
| Kimi | https://api.kimi.com/coding/v1/usages |
Development
Build & Test
# Build TypeScript
bun run build
# Run all tests
bun run test
# Format code
bun run fmtProject Structure
src/
index.ts # Main plugin entry point
api/
client.ts # Shared HTTPS client
endpoints.ts # Endpoint definitions
utils/
duration.ts # d h m s formatting logic
progress-bar.ts # Plain text bar rendering
bin/
glm-quota.ts # CLI binary for GLM
copilot-quota.ts # CLI binary for Copilot
kimi-quota.ts # CLI binary for Kimi
install.js # Installation script
integration/
command/ # /command slash commands
skills/ # OpenCode skill docsLicense
MIT © 2026
Changelog
See CHANGELOG.md for version history.
- v2.62.0: Removed auto quota features; Added Copilot & Kimi support; Plain text output; CLI binaries.