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

@satas/opencode-usage-bar

v0.2.0

Published

AI subscription usage gauge with provider status for the opencode TUI (Claude Pro/Max, ChatGPT Plus/Pro) — shows ▓▓▓░░░ 36% · 0h 39m and a ! marker during incidents.

Readme

opencode-usage-bar

npm · source

An AI subscription usage gauge for the opencode TUI.

Shows how much of your coding-plan quota you've used and how long until it resets, in a full-width row just below the session footer. Supports Claude Pro/Max and ChatGPT Plus/Pro (Codex) — each optional, each with per-window toggles.

┌─ opencode session ────────────────────────────────────┐
│ ...                                                   │
│ > _                                                   │
│ Build · Claude Fable 5      ▓▓▓▓░░░░░░ 4/5 · todo bar │
│ esc interrupt        119.8K (12%) · $4.04  ctrl+p     │
│ ▓▓▓▓░░ 65% · 0h 11m                                   │
└───────────────────────────────────────────────────────┘

With multiple windows/providers enabled:

cld ▓▓▓▓░ 65% · 0h 11m  7d ▓░░░░ 19% · 1d 11h   oai ▓░░░░ 12% · 3h 4m

When a provider's public status page reports an active incident, a colored ! marker appears next to its prefix:

! cld ▓▓▓▓░ 65% · 0h 11m          (Anthropic incident — usage bar unchanged)
  • Bar color escalates with usage: green < 50%, amber 50–85%, red > 85%.
  • Provider status — a ! marker (red = major/critical, amber = minor, cyan = maintenance) shows next to a provider during an active incident, read from the vendor's own status page. Disable with show_status = false.
  • The countdown ticks live; usage refreshes every 2 minutes (with backoff on failures — these endpoints throttle aggressive polling).
  • Last known values are cached, so the bar appears instantly on restart.
  • Providers hide silently when credentials are missing/expired or a fetch fails; the whole row hides when nothing is available.
  • Provider prefixes (cld/oai) appear only when two or more providers are visible; window labels (5h/7d/…) appear only when a provider shows two or more windows.

Install

Recommended (npm)

opencode plugin @satas/opencode-usage-bar

This installs the package via Bun, detects the TUI entrypoint, and adds it to your tui.json automatically. Add -g to install globally (~/.config/opencode/tui.json).

Or add it manually:

// ~/.config/opencode/tui.json
{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": ["@satas/opencode-usage-bar"]
}

opencode auto-installs npm plugins at startup.

Local file (no build needed)

opencode transpiles .tsx plugins on the fly, so you can point tui.json straight at the source file:

{
  "plugin": ["/absolute/path/to/opencode-usage-bar/src/index.tsx"]
}

Configuration

On first run the plugin creates ~/.config/opencode/usage-bar.toml with commented defaults (Claude enabled, 5-hour window only — matching the screenshot above). Edit it and restart opencode; the config is read once at startup.

[ui]
show_bars = true      # render ▓▓░░ mini-bars (false = text only)
show_status = true    # show a ! marker next to a provider during incidents
# bar_width = 6       # override bar width (default: 6 for a single window, 5 otherwise)

[anthropic]
enabled = true        # Claude Pro/Max via ~/.claude/.credentials.json
show_5h = true        # rolling 5-hour session window
show_7d = false       # weekly cap across all models
show_model = false    # per-model weekly windows (e.g. Fable)
# credentials_path = "~/.claude/.credentials.json"

[openai]
enabled = false       # ChatGPT Plus/Pro via the Codex CLI login
show_5h = true
show_7d = false
# codex_auth_path = "~/.codex/auth.json"

Providers & data sources

| Provider | Credentials (first match wins) | Usage endpoint | Status endpoint | Windows | |---|---|---|---|---| | anthropic | Claude Code's ~/.claude/.credentials.json → opencode's auth store | api.anthropic.com/api/oauth/usage | status.anthropic.com | 5h session, 7d all-models, 7d per-model | | openai | Codex CLI's ~/.codex/auth.json → opencode's auth store | chatgpt.com/backend-api/wham/usage | status.openai.com | 5h session, 7d weekly |

If you log in through opencode itself (opencode auth login), everything works with zero extra setup — the plugin falls back to opencode's own auth store (<data dir>/auth.json, e.g. ~/.local/share/opencode/auth.json). All credential access is read-only; expired tokens simply hide the provider until the owning CLI refreshes them.

Security note: each credential is read from disk/env and sent only to its own provider's API host, over HTTPS, to fetch usage numbers. The status check hits each vendor's public status page with no credentials at all. Nothing else is read, stored, or transmitted. Both usage endpoints are undocumented/internal (the same ones the vendors' own tooling uses) and may change without notice.

Develop

bun install      # dev deps (solid-js, @opencode-ai/plugin, @opentui/solid, tsc)
bun run build    # emit dist/index.js + dist/index.d.ts (for npm publish)
bun run typecheck

Publishing: npm publish (the prepublishOnly script runs the build automatically).

Roadmap

  • GLM coding plan (z.ai) provider.
  • Anthropic/OpenAI OAuth token auto-refresh (both credential files include a refresh token; for now the respective CLIs keep them fresh).

Requirements

  • opencode >= 1.17 (TUI plugin API, @opencode-ai/plugin/tui)
  • Bun runtime (used by opencode; Bun.TOML parses the config)

Contributing

Contributions welcome — especially new providers (see the checklist in CONTRIBUTING.md). The whole plugin is a single file, and opencode transpiles .tsx on the fly, so you can hack on it with no build step.

License

MIT