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

@dong5945/opencode-quota

v0.1.0

Published

OpenCode Go TUI plugin - display subscription quota/usage in the bottom bar

Downloads

59

Readme

@dong5945/opencode-quota

OpenCode Go TUI plugin that displays your subscription quota usage (rolling / weekly / monthly) in the bottom bar of the CLI.

⚡ OpenCode Quota  Rolling: 30% (28m) | Weekly: 65% (2.8d) | Monthly: 60% (19d)

Installation

1. Install the npm package

# Global (recommended)
cd ~/.config/opencode
npm install @dong5945/opencode-quota

# Or project-level
cd <project>/.opencode
npm install @dong5945/opencode-quota

2. Configure tui.json

Add the plugin to your ~/.config/opencode/tui.json (global) or <project>/.opencode/tui.json (project):

{
  "plugin": [
    "@dong5945/opencode-quota"
  ]
}

3. Create config file

Create ~/.config/opencode/quota-plugin.json:

{
  "workspaceId": "wrk_YOUR_WORKSPACE_ID",
  "cookie": "auth=YOUR_AUTH_COOKIE; oc_locale=zh"
}

How to get these values:

  1. Open https://opencode.ai/workspace/YOUR_WORKSPACE_ID/go in your browser
  2. Open DevTools (F12) → Network tab → refresh the page
  3. Find the request to /workspace/.../go, copy the Cookie header value
  4. The workspaceId is the wrk_... part in the URL

Note: The auth cookie is an Iron session token and will expire periodically. When it expires, the bar will show ⚡ quota: error. Simply update the cookie value in the config file.

4. Restart OpenCode

opencode

You should see the quota bar at the bottom of the TUI.

Display

| Usage % | Color | |---------|-------| | < 50% | Green | | 50–79% | Yellow | | >= 80% | Red |

| State | Display | |-------|---------| | Normal | ⚡ OpenCode Quota Rolling: 30% (28m) \| Weekly: 65% (2.8d) \| Monthly: 60% (19d) | | Loading | ⚡ OpenCode Quota loading... | | Error | ⚡ quota: error | | No config | ⚡ quota: no config |

How It Works

The plugin fetches the HTML page at https://opencode.ai/workspace/{workspaceId}/go using your auth cookie, then extracts usage data from the server-side rendered JavaScript:

// Data is embedded in the HTML like:
rollingUsage:$R[35]={status:"ok",resetInSec:1843,usagePercent:22}
weeklyUsage:$R[36]={status:"ok",resetInSec:239197,usagePercent:62}
monthlyUsage:$R[37]={status:"ok",resetInSec:1650407,usagePercent:59}

Polling interval: 2 minutes (recursive setTimeout, no request stacking).

Development

git clone https://github.com/dong5945/opencode-quota-plugin.git
cd opencode-quota-plugin
npm install
node build.mjs    # Bundle + sync to npm package dirs

The build script (build.mjs) bundles src/index.jsdist/tui.js via esbuild and auto-syncs to:

  • ~/.config/opencode/node_modules/@dong5945/opencode-quota/dist/
  • ~/.cache/opencode/packages/@dong5945/opencode-quota/.../dist/

Restart OpenCode after each build to see changes.

Project Structure

opencode-quota-plugin/
├── src/
│   └── index.js        # Plugin source (ES Module)
├── build.mjs           # esbuild build script
├── package.json
├── dist/
│   └── tui.js          # Build output
└── .gitignore

License

MIT