oc-quota
v0.1.3
Published
OpenCode plugin + CLI for querying Z.AI GLM, GitHub Copilot, Kimi, Neuralwatt, Kiro, and Ollama Cloud usage
Readme
oc-quota
Note: This plugin is designed for personal use only by the author. It may not be maintained or suitable for general use.
OpenCode plugin + CLI for querying usage quotas from multiple AI coding assistants.
Features
- GitHub Copilot - Check chat, completions, and premium interactions quotas
- Z.AI (GLM) - Monitor token and time-based usage limits
- Neuralwatt - View credit balance, energy usage, and subscription status
- Kiro - Track credits, free trial, and subscription limits (via kiro-cli DB)
- Ollama Cloud - Monitor session and weekly usage (via Firefox cookies)
Works as both an OpenCode plugin (automatic quota checks on session events) and a standalone CLI (manual queries).
Note: Distributed as TypeScript files - requires Bun runtime (which can execute .ts files directly without transpilation).
Installation
As a standalone CLI
bun install -g oc-quotaThis installs the oc-quota binary to ~/.bun/bin/oc-quota. Bun executes the TypeScript files directly without requiring a build step.
As an OpenCode plugin
Add to your OpenCode project dependencies:
bun add oc-quotaThen register the plugin in your OpenCode configuration.
Usage
CLI Mode
Query quotas directly from the command line:
# Check GitHub Copilot quota
oc-quota copilot
# Check Z.AI (GLM) quota
oc-quota zai
# Check Neuralwatt quota
oc-quota neuralwatt
# Check Kiro quota (reads from kiro-cli DB)
oc-quota kiro
# Check Ollama Cloud quota (reads Firefox cookies)
oc-quota ollama
# Interactive provider search/selection (when omitted)
oc-quotaWhen no provider is passed and the terminal is interactive, oc-quota opens a searchable provider picker.
Output example:
🤖 GitHub Copilot
6.7% used (280 / 300)
♻️ Apr 1, 2026, 12:00 AM (20d 9h 52m 45s)Ollama Cloud browser flag:
By default, oc-quota reads cookies from Firefox. Use --browser to specify a different browser (only Firefox is currently supported):
oc-quota ollama --browser firefoxOpenCode Plugin Mode
The plugin automatically monitors your coding sessions and displays quota information via toast notifications when:
- A session becomes idle
- A session is compacted
Configuration
Auth JSON
The plugin reads credentials from OpenCode's ~/.local/share/opencode/auth.json:
{
"zai-coding-plan": {
"key": "your-zai-api-key"
},
"github-copilot": {
"access": "your-copilot-access-token",
"refresh": "your-copilot-refresh-token"
},
"neuralwatt": {
"key": "sk-your-neuralwatt-api-key"
},
"kiro": {
"key": "ksk-your-kiro-api-key"
},
"ollama-cloud": {
"key": "your-ollama-cloud-api-key"
}
}Kiro Authentication
Kiro does not use the API key from auth.json. Instead, it reads OAuth tokens directly from the kiro-cli SQLite database at ~/.local/share/kiro-cli/data.sqlite3. Ensure you are logged in via kiro-cli before using this provider.
Ollama Cloud Authentication
Ollama Cloud does not use an API key. Instead, it reads session cookies from your Firefox profile (~/.mozilla/firefox/*.default-release/cookies.sqlite). You must be logged into ollama.com/settings in Firefox for this to work.
Provider Details
GitHub Copilot
- Endpoint:
https://api.github.com/copilot_internal/user - Auth:
auth.jsonaccess/refresh tokens - Metrics: Chat, Completions, Premium Interactions
- Reset: Monthly (resets on the 1st)
- Note: Educational accounts may have unlimited access for some features
Z.AI (GLM)
- Endpoint:
https://api.z.ai/api/monitor/usage/quota/limit - Auth:
auth.jsonAPI key - Metrics: Token limits, Time limits
- Reset: Periodic (varies by plan level)
- Plan Levels: lite, standard, premium
Neuralwatt
- Endpoint:
https://api.neuralwatt.com/v1/quota - Auth:
auth.jsonAPI key (Bearertoken) - Metrics: Credit balance, monthly usage (cost, requests, tokens), energy (kWh)
- Reset: Billing period (monthly)
- Rate Limit: 1 request per second
Kiro
- Endpoint:
https://q.us-east-1.amazonaws.com/getUsageLimits - Auth: OAuth token refreshed via kiro-cli DB
- Metrics: Credits (used/limit), free trial bonus
- Reset: Periodic (per credit breakdown)
- Note: Requires
kiro-cliinstalled and logged in
Ollama Cloud
- Endpoint:
https://ollama.com/settings(HTML scraping) - Auth: Firefox session cookies
- Metrics: Session usage (5h window), Weekly usage (7d window)
- Reset: Session (5 hours), Weekly (7 days)
- Note: Requires Firefox with active ollama.com login
API
Plugin Function
import { QuotaPlugin } from 'oc-quota'
export default QuotaPluginThe plugin subscribes to:
session.idle- Shows quota when session is idlesession.compacted- Shows quota after compactionchat.message- Tracks provider from model changes
Development
# Install dependencies
bun install
# Type check
bun run check
# Format code
bun run fmt
# Run CLI directly
bun run quota.ts copilot
bun run quota.ts zai
bun run quota.ts neuralwatt
bun run quota.ts kiro
bun run quota.ts ollama
# Interactive mode
bun run quota.tsLicense
MIT
Author
Umar Alfarouk
Repository
https://github.com/mdrv/oc-quota
