npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cardinal4/opencode-quota

v5.0.3

Published

OpenCode 2 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.

Readme

[!IMPORTANT] Fork — OpenCode 2 support. This is an independent fork of slkiser/opencode-quota that adds OpenCode 2 compatibility. It is not affiliated with, endorsed by, or published by the original author. Requires OpenCode >= 2.0.7. See About this fork for installation and the differences from upstream.

OpenCode Quota sidebar


About this fork

This project is a fork of slkiser/opencode-quota, maintained to run on OpenCode 2. OpenCode 2 replaced the V1 plugin API, so upstream's V1 plugin does not run there. Only the plugin runtime layer was ported; the provider, quota, pricing, and reporting engine is upstream's.

Install the fork's CLI (same commands as upstream, different package name):

npx @cardinal4/opencode-quota init

Requires OpenCode >= 2.0.7 and Node.js >= 22.

Known differences from upstream:

  • Toasts are client-side. OpenCode 2 removed the server toast endpoint, so automatic quota toasts are emitted by the CLI plugin. Web/Desktop clients, which do not run CLI plugins, do not show them.
  • showOnQuestion is unavailable. The V2 event stream does not carry the tool name required for the question-tool trigger.
  • Everything else — providers, quota windows, slash commands, token reports, JSON output, and pricing — is upstream's engine and behaves the same.

For complete setup, provider, and configuration documentation, see the rest of this README and docs/readme/. Those documents come from upstream and apply to this fork except where noted above. Report fork-specific issues to cardin/opencode-quota; report upstream issues to the original project.


Quick start

npx @cardinal4/opencode-quota init

[!IMPORTANT] Node.js >= 22 is required.

Upgrading from v3? Read the v4 migration guide.

After installation:

  1. Restart OpenCode.
  2. Run a slash command in OpenCode, or use opencode-quota show from your terminal.
  3. If you enabled the sidebar, open the session sidebar and look for Quota.
  4. If you enabled the compact status line, look at the bottom of Home or below the message input.

Updating

  1. Close OpenCode.

  2. Preview the update:

    npx @cardinal4/opencode-quota@latest update --dry-run
  3. Inspect the safe setting/cache changes and manual credential findings, then apply:

    npx @cardinal4/opencode-quota@latest update
  4. 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.

Choose your setup

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, spaced reset countdowns by default with a resetTimeSpaced: false dense opt-out, decimal reset precision, bare percent labels, and accountingDetail.
  • 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.

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 @cardinal4/opencode-quota@latest init | Set up OpenCode Quota | | npx @cardinal4/opencode-quota@latest provider add | Add or update a custom provider | | npx @cardinal4/opencode-quota@latest show | Show current quota | | npx @cardinal4/opencode-quota@latest status | Check configuration and provider problems | | npx @cardinal4/opencode-quota@latest update | Update an existing installation |

Run npx @cardinal4/opencode-quota@latest --help for command options. See External integration for JSON, scripts, and CI examples.

Providers

Pre-configured American providers

| 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 |

| 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

| 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 |

| 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.

Custom providers

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

npx @cardinal4/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 @cardinal4/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