Quota, usage, and token visibility in OpenCode and your terminal.
npx @slkiser/opencode-quota initImportant
Node.js >= 22 is required.
Upgrading from v3? Read the v4 migration guide.
After installation:
- Restart OpenCode.
- Run a slash command in OpenCode, or use
opencode-quota showfrom your terminal. - If you enabled the sidebar, open the session sidebar and look for
Quota. - If you enabled the compact status line, look at the bottom of Home or below the message input.
Create ~/.config/opencode/opencode-quota/oauth-refresh.json with
{"enabled":true,"models":{"anthropic":"anthropic/claude-haiku-4-5","openai":"openai/gpt-5.6-sol","xai":"xai/grok-4.6"}}
to let quota collection send a Hello through the credential-owning CLI on
token expiry or HTTP 401. Choose models supported by your subscriptions.
OpenCode credentials use opencode run --standalone; native Claude credentials
use Claude's noninteractive mode. OpenCode Go API keys need no OAuth renewal.
OpenCode uses the built-in plan agent with a prompt requesting only Hello
and no tools or other work. No dedicated agent needs to be installed. If you
previously created ~/.config/opencode/agents/quota-token-refresh.md solely for
this plugin, remove that file; it is no longer used.
Attempts have a 60-second timeout and a persistent 15-minute cooldown per
owner/provider, including failed attempts. The plugin rereads credentials and
retries quota once; it never writes credentials itself. A model request can fail
after successful authentication, so a normal nonzero CLI exit also permits that
quota retry. Greetings create separate sessions and may consume quota. Disable
by removing the settings file or setting enabled to false.
-
Close OpenCode.
-
Preview the update:
npx @slkiser/opencode-quota@latest update --dry-run
-
Inspect the safe setting/cache changes and manual credential findings, then apply:
npx @slkiser/opencode-quota@latest update
-
Restart OpenCode.
The updater prints the complete preview before its own config or cache changes. --yes authorizes only the previewed safe config edits and manifest-verified cache cleanup; it never moves or deletes secrets. See Updating safely for detailed behavior and manual credential steps.
More ways to use it:
- Check quota anywhere: use
opencode-quota showin a terminal or the same slash commands in the TUI, Web, and Desktop. - Automate quota checks with JSON output for scripts, status bars, and CI. Optional OpenTelemetry metrics support monitoring tools.
- Customize the display with
tuiPromptBar.enabled, OpenCode Go's preferred collapsed-sidebar window, reset precision or spacing, bare percent labels, andaccountingDetail. - Optionally estimate Runs out ≈ 1h 50m for supported fixed windows with
quotaProjection: "runway". It is off by default and leaves JSON output unchanged. - Choose current-session or descendant-tree token totals. Get reset popups for selected windows with
resetNotifications. - Troubleshoot authentication, quota sources, pricing, and maintainer notices.
See Configuration for UI options and Manual install for setup details.
| Command | Use when |
|---|---|
/quota |
Show current quota |
/quota_status |
Diagnose setup, authentication, providers, pricing, and notices |
/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 |
Use the CLI for setup, updates, terminal checks, and custom providers.
| Command | What it does |
|---|---|
npx @slkiser/opencode-quota@latest init |
Set up OpenCode Quota |
npx @slkiser/opencode-quota@latest provider add |
Add or update a custom provider |
npx @slkiser/opencode-quota@latest show |
Show current quota |
npx @slkiser/opencode-quota@latest status |
Check configuration and provider problems |
npx @slkiser/opencode-quota@latest update |
Update an existing installation |
Run npx @slkiser/opencode-quota@latest --help for command options. See External integration for JSON, scripts, and CI examples.
Personal
| Provider | Auth/setup | Data from | Reports |
|---|---|---|---|
| Anthropic (Claude) | Needs setup | Local CLI/OAuth | Quota |
| Chutes AI | Automatic | Remote API | Quota |
| Cursor | Needs setup | Local estimate | Budget and spend |
| GitHub Copilot | Automatic | Remote API | Budget and usage |
| Google AGY | Needs setup | Remote API | Quota |
| Google Antigravity | Needs setup | Remote API | Quota |
| Kilo Gateway | Automatic | Remote API | Quota and balance |
| NanoGPT | Automatic | Remote API | Quota and balance |
| Ollama Cloud | Automatic | Remote API | Quota and usage |
| OpenAI | Automatic | Remote API | Quota |
| OpenCode Go | Automatic | Remote API | Quota |
| OpenCode Zen | Needs setup | Dashboard scraping | Budget and balance |
| OpenRouter | Automatic | Remote API | Budget and spend |
| Synthetic | Automatic | Remote API | Quota |
| xAI SuperGrok | Automatic | Remote API | Quota |
Business / Enterprise
| Provider | Auth/setup | Data from | Reports |
|---|---|---|---|
| Anthropic (Claude) | Needs setup | Local CLI/OAuth | Quota |
| Chutes AI | Automatic | Remote API | Quota |
| Cursor | Needs setup | Local estimate | Budget and spend |
| Gemini CLI (deprecated) | Existing setups only | Remote API | Quota |
| GitHub Copilot | Needs setup | Remote API | Budget and usage |
| Google AGY | Needs setup | Remote API | Quota |
| Google Antigravity | Needs setup | Remote API | Quota |
| NanoGPT | Automatic | Remote API | Quota and balance |
| OpenAI | Automatic | Remote API | Quota |
| OpenCode Zen | Needs setup | Dashboard scraping | Budget and balance |
| OpenRouter | Automatic | Remote API | Budget and spend |
| Synthetic | Automatic | Remote API | Quota |
| xAI SuperGrok | Automatic | Remote API | Quota |
Gemini CLI quota support is deprecated for new installs. Existing v4 configurations still work, with removal planned for v5.0.0. See the provider guide before choosing a replacement.
Personal
| Provider | Auth/setup | Data from | Reports |
|---|---|---|---|
| Alibaba Coding Plan | Automatic | Local estimate | Quota |
| DeepSeek | Automatic | Remote API | Balance and status |
| Kimi Code | Automatic | Remote API | Quota |
| MiniMax Token Plan | Automatic | Remote API | Quota |
| MiniMax Token Plan (CN) | Automatic | Remote API | Quota |
| Qwen Code | Needs setup | Local estimate | Quota |
| Xiaomi MiMo | Needs setup | Dashboard API | Quota and balance |
| Z.ai Coding Plan | Automatic | Remote API | Quota |
| Zhipu Coding Plan | Automatic | Remote API | Quota |
Business / Team
| Provider | Auth/setup | Data from | Reports |
|---|---|---|---|
| Kimi Code | Automatic | Remote API | Quota |
| MiniMax Token Plan | Automatic | Remote API | Quota |
| MiniMax Token Plan (CN) | Automatic | Remote API | Quota |
| Zhipu Coding Plan | Automatic | Remote API | Quota |
These vendors offer team or business plans, but the current integrations report only the configured member API key rather than organization-wide usage.
Add a provider that uses a remote quota API or tracks a local usage estimate:
npx @slkiser/opencode-quota@latest provider addThe guided setup previews the change before saving. See the custom-provider guide for details.
If quota or token data looks wrong:
- Run
/quota_statusin OpenCode, oropencode-quota statusfrom a terminal for the same diagnostics. Useopencode-quota showfor a quick quota glance. - 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.
Project guides:
External references:
- OpenCode docs
- OpenCode config
- OpenCode plugins
- OpenCode TUI
- models.dev pricing data
- Node.js downloads
Thanks to everyone who has contributed to OpenCode Quota.
MIT
OpenCode Quota is not built by the OpenCode team and is not affiliated with OpenCode or any provider listed above.



