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

@pistonex/opencode-go-usage

v0.1.4

Published

OpenCode TUI plugin that shows OpenCode Go subscription usage (rolling / weekly / monthly) in the sidebar

Downloads

873

Readme

opencode-go-usage

An OpenCode TUI plugin that shows your OpenCode Go subscription usage in the sidebar: rolling (5 h), weekly and monthly limits, with percent consumed, status and time until each reset.

Data comes from the public API — no scraping:

  • GET https://opencode.ai/zen/go/v1/usage (Bearer API key of your opencode-go account) → rolling, weekly and monthly percent, ok/rate-limited status and reset date.

What it looks like

Rendered in the sidebar.content slot of every session:

┌────────────────────────────────────────┐
│ ⬖ OpenCode Go                ▾         │
│ rolling  █░░░░░░░   0% ✓  ↻ 2h         │
│ weekly   ░░░░░░░░   4% ✓  ↻ 1h         │
│ monthly  ████████ 100% ✕  ↻ 9d         │
└────────────────────────────────────────┘

Up to 3 rows (rolling / weekly / monthly) with a usage bar, percent and time until reset. Auto-refreshes every 5 minutes (no requests are made while the widget is collapsed). Collapsed, only the header with "▾/▸" remains.

Use Show or hide the OpenCode Go usage panel (palette Ctrl+P, or slash /opencode-go) to toggle the widget. The state persists across restarts.

Install

Add the package to plugins in your global ~/.config/opencode/opencode.json(c):

{
  "plugins": ["@pistonex/opencode-go-usage"]
}

For CLI-only behavior against remote servers, add it to ~/.config/opencode/cli.json instead:

{
  "plugins": ["@pistonex/opencode-go-usage"]
}

Then restart OpenCode.

Requires OpenCode v2 (CLI plugin API).

How it gets the API key

The plugin reads ~/.local/share/opencode/account.json, finds the account with serviceID === "opencode-go" and uses its credential.key. The key is only used in memory for the Authorization: Bearer request; it is never printed or written anywhere.

Language

The plugin is bilingual (ES/EN). Language resolution order:

  1. The plugin language option ("es" or "en") in opencode.json(c)
  2. A persisted choice (see the slash command below)
  3. Auto-detected from your environment (LANG/LC_ALL)

Override it at any time with the slash command:

  • /opencode-go-lang — toggle ES/EN
  • /opencode-go-lang en / /opencode-go-lang es — set a specific language

Options

{
  "plugins": [{ "package": "@pistonex/opencode-go-usage", "options": { "language": "en" } }]
}

| Option | Values | Description | | ---------- | --------- | ---------------------------------- | | language | es, en| Force a language, ignoring the rest |

Configuration

Constants live in src/opencode-go-usage.tsx:

  • USAGE_URL — public usage endpoint (only change if the API changes)
  • REFRESH_MS — refresh interval (default 5 min)
  • FETCH_TIMEOUT_MS — request timeout (default 10 s)

Notes

The Zen balance and the "Use balance" toggle are not exposed by any public OpenCode API (they live in the console's database and are read through browser-session server actions). This plugin shows subscription usage, which is everything the API offers. See docs/RESEARCH.md for the full investigation.

Development

npm install
npm run typecheck

The plugin is a single .tsx file (src/opencode-go-usage.tsx) using the standard OpenCode v2 CLI plugin contract: Plugin.define({ id, setup }) from @opencode/plugin/tui, @opentui/solid JSX and theme tokens via usePlugin().

License

MIT © Tony Pistone