@slkiser/opencode-quota
v3.11.2
Published
OpenCode quota & tokens usage with zero context window pollution. Supports GitHub Copilot, OpenAI (Plus/Pro), Qwen Code, Chutes AI, Synthetic, Google Antigravity, Z.ai coding plan and more.
Maintainers
Readme
Quick start
npx @slkiser/opencode-quota init[!IMPORTANT] OpenCode
>= 1.4.3and Node.js>= 20are required.
- Restart OpenCode.
- Run
/quotain OpenCode, or useopencode-quota showfrom your terminal. - If you enabled the Sidebar panel, open the session sidebar and look for
Quota. - If you enabled Compact status line, look for the home-bottom quota line and the chat/session prompt quota line.
- If something looks wrong, run
/quota_statusin OpenCode or see Troubleshooting.
Update OpenCode Quota safely
Close OpenCode.
Run:
npx @slkiser/opencode-quota@latest updateReview the exact config edits and cache directories, then confirm.
Restart OpenCode.
Use --dry-run to preview without changing anything. Use --yes only for explicit noninteractive confirmation. The update command changes only canonical OpenCode Quota plugin entries and removes only verified OpenCode Quota cache directories; it preserves settings, JSONC comments, tuple options, and other plugins.
What you get
More ways to use it:
- Terminal checks with
opencode-quota showbefore or without opening OpenCode - JSON output for scripts, status bars, CI checks, and external tools
- Deterministic inline slash-command output shared by TUI and Desktop/server
- Provider diagnostics for auth, quota sources, pricing, and bundled maintainer announcements
See Configuration for UI options and Manual install for setup details.
Commands
Core slash commands
The server plugin registers each command once for TUI and Desktop/server. Each command injects one ignored, no-reply inline message, does not call the model, and does not add output to model context. /tokens_between requires both dates inline and does not open a prompt dialog.
| Command | Use when |
| --------------------------------------- | -------------------------------------------------------------------- |
| /quota | Show your quota and usage details |
| /quota_status | Diagnose setup, auth, provider detection, pricing, and announcements |
| /quota_announcements | Read active bundled maintainer notices |
| /pricing_refresh | Refresh local runtime pricing from models.dev |
| /tokens_today | Show tokens used today |
| /tokens_daily | Show tokens used in the last 24 hours |
| /tokens_weekly | Show tokens used in the last 7 days |
| /tokens_monthly | Show tokens used in the last 30 days, including pricing |
| /tokens_all | Show tokens used across all local history |
| /tokens_session | Show tokens used in the current session |
| /tokens_session_all | Show current session plus descendant sessions |
| /tokens_between YYYY-MM-DD YYYY-MM-DD | Show tokens used between two dates |
CLI commands
| Command | Use when |
| ---------------------------------------------- | --------------------------------------------------------------------- |
| opencode-quota update | Preview and confirm a scoped OpenCode Quota update |
| opencode-quota update --dry-run | Preview exact config and cache targets without changing them |
| opencode-quota show | Check quota from your terminal |
| opencode-quota show --provider <id> | Check one provider only, such as copilot or openai |
| opencode-quota show --json | Print JSON for scripts, status bars, and other tools |
| opencode-quota show --json --threshold <pct> | Fail the command when cached quota drops below your chosen percentage |
Providers
Most providers work automatically. If a provider has a “Needs setup” link, open that setup note only if you use that provider.
| Provider | Auth/setup | Source | Reports | | ------------------------ | -------------------------------------------------------------- | ------------------ | --------------- | | Anthropic (Claude) | Needs setup | Local CLI/OAuth | Usage/quota | | GitHub Copilot | OpenCode OAuth or PAT | Remote API | Quota/usage | | OpenAI | Automatic | Remote API | Usage/quota | | Cursor | Needs setup | Local estimate | Estimated quota | | Qwen Code | Needs setup | Local estimate | Estimated quota | | Alibaba Coding Plan | OpenCode config | Local estimate | Estimated quota | | MiniMax Coding Plan | OpenCode config | Remote API | Usage/quota | | MiniMax Coding Plan (CN) | OpenCode config | Remote API | Usage/quota | | Kimi Code | OpenCode config | Remote API | Usage/quota | | Chutes AI | API key/config | Remote API | Usage/quota | | Synthetic | Automatic | Remote API | Quota | | Google Antigravity | Needs setup | Remote API | Usage/quota | | Google AGY | Needs setup | Remote API | Usage/quota | | Gemini CLI | Needs setup | Remote API | Usage/quota | | Z.ai Coding Plan | OpenCode config | Remote API | Usage/quota | | Zhipu Coding Plan | OpenCode config | Remote API | Usage/quota | | NanoGPT | API key/config | Remote API | Usage + balance | | DeepSeek | API key/config | Remote API | Balance/status | | Ollama Cloud | Needs setup | Dashboard scraping | Dashboard usage | | OpenCode Go | Needs setup | Dashboard scraping | Dashboard usage |
Setup details live in the Provider setup guide.
Troubleshooting
Start here when quota or token data looks wrong:
- Run
/quota_status, or start withopencode-quota showfor a terminal quota summary. - Confirm the expected provider appears in the detected provider list.
- Confirm companion auth plugins are before
@slkiser/opencode-quotainopencode.json. - If token reports are empty, start OpenCode once so it creates
opencode.db, then run a session with model usage. - Check Troubleshooting for common symptoms and provider-specific fixes.
Reference
Contributors
Thanks to everyone who has contributed to OpenCode Quota.
License
MIT
Remarks
OpenCode Quota is not built by the OpenCode team and is not affiliated with OpenCode or any provider listed above.
Star history


