Skip to content
 
 

Latest commit

 

History

741 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenCode Quota logo

OpenCode 2-only quota sidebar, usage, and token visibility.

CI License: MIT

OpenCode Quota sidebar


Warning

This fork targets the OpenCode 2 beta CLI (opencode2) only. It is not published to npm and the upstream npx @slkiser/opencode-quota init flow does not install this fork.

OpenCode 2 quick start

Node.js >= 22 is required. pnpm 11 is also required for this source checkout.

The inherited upstream package history remains available in the v4 migration guide, but its OpenCode V1 installation steps do not replace this fork's OpenCode 2 setup guide.

git clone https://github.com/sr4dev/opencode-quota-v2.git
cd opencode-quota-v2
corepack pnpm install --frozen-lockfile
corepack pnpm build

OpenCode 2 loads the server and terminal surfaces separately. Configure both local build entrypoints:

  • ~/.config/opencode/opencode.json: the repository's opencode2 directory
  • ~/.config/opencode/cli.json: dist/index.js
  • ~/.config/opencode/opencode-quota/quota-toast.json: sidebar and provider settings

See the OpenCode 2 setup guide for the exact JSON, Windows file URL examples, updates, and troubleshooting.

Restart the shared service after configuration:

opencode2 service restart
opencode2 service status

Open a session sidebar and confirm that the Quota panel appears. Run /quota_status to diagnose loaded configuration and provider credentials.

Updating

Pull, rebuild, and restart OpenCode 2. Do not use the upstream npm updater for this fork.

git pull --ff-only
corepack pnpm install --frozen-lockfile
corepack pnpm build
opencode2 service restart

Choose your setup

OpenCode Quota TUI sidebar panel OpenCode Quota popup toast
Sidebar panel
A full quota view in OpenCode's session sidebar.
TUI toast
Quota checks can appear automatically while you work.
OpenCode Quota TUI status line OpenCode Quota token report
Compact status line
Short quota text on Home and below the message input.
Token reports
/tokens_today, /tokens_weekly, session reports, and more.

More ways to use it:

  • Check quota anywhere: use opencode-quota show in 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, and accountingDetail.
  • 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.

Commands

Core slash commands

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

CLI commands

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.

Providers

Pre-configured American providers

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.

Pre-configured Chinese providers

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 Coding Plan Automatic Remote API Quota
MiniMax Coding 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 Coding Plan Automatic Remote API Quota
MiniMax Coding 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.

Custom providers

Add a provider that uses a remote quota API or tracks a local usage estimate:

npx @slkiser/opencode-quota@latest provider add

The guided setup previews the change before saving. See the custom-provider guide for details.

Troubleshooting

If quota or token data looks wrong:

  1. Run /quota_status in OpenCode, or opencode-quota status from a terminal for the same diagnostics. Use opencode-quota show for a quick quota glance.
  2. Confirm the expected provider appears in the detected provider list.
  3. Confirm companion auth plugins are before @slkiser/opencode-quota in opencode.json.
  4. If token reports are empty, start OpenCode once so it creates opencode.db, then run a session with model usage.
  5. Check Troubleshooting for common symptoms and provider-specific fixes.

Reference

Project guides:

External references:

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

Star History Chart

About

OpenCode 2-only quota sidebar fork with split server/TUI plugin setup and Claude enterprise quota support

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages