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

opencode-burn-rate

v1.1.0

Published

opencode TUI plugin that shows a projected hourly USD burn rate for the current session, subagents included

Downloads

882

Readme

opencode-burn-rate

npm version MIT license

opencode TUI plugin that adds a "Burn Rate" item to the TUI sidebar showing two projected hourly USD rates (session-lifetime average and active-work rate) for the current session, including all subagent (child) sessions. The session's own cost updates immediately; subagent costs and activity data are polled every 60 seconds.

Installation

Recommended: opencode CLI

opencode plugin -g opencode-burn-rate

opencode plug -g opencode-burn-rate is an alias. The -g flag (or --global) installs at global scope; omit it to install locally instead. Because the package exports ./tui, the command also writes the entry into tui.json automatically.

From the TUI

Press Ctrl+P to open the command palette, run "Install plugin", enter opencode-burn-rate, and press Enter. Press Tab to toggle between local and global scope.

Manual

Add opencode-burn-rate to the plugin array in ~/.config/opencode/tui.json, or a project-level tui.json:

{
  "plugin": ["opencode-burn-rate"]
}

Restart opencode after installing with any method.

This is a TUI plugin: adding it to the plugin array in opencode.json will not load it. tui.json is the TUI-side config.

AI-assisted install

Give any coding agent this block:

Install the opencode-burn-rate TUI plugin by running `opencode plugin -g opencode-burn-rate`; if that command is unavailable, add "opencode-burn-rate" to the "plugin" array in ~/.config/opencode/tui.json (create the file if missing), then tell me to restart opencode. Note it must go in tui.json, not opencode.json.

How the rate is computed

The plugin computes two projected hourly USD rates from the total cost of the session and all subagent (child) sessions. The session's own cost updates immediately; subagent costs and activity data are polled every 60 seconds. Both rates floor elapsed time at 1 minute so sessions younger than one minute do not show absurd extrapolations.

Session avg — a running session-lifetime average:

(total USD cost) / elapsed * 3_600_000

The elapsed window runs from session creation to the last time the total cost was observed to change across the session and its subagent tree. The rate holds steady between cost changes and jumps to a fresh, tighter window when new cost is observed; it does not decay toward zero while the session is idle.

Active rate — total cost divided by time the session was actually doing work:

(total USD cost) / active-elapsed * 3_600_000

The active-elapsed window is the union of every assistant-message or tool-part activity span for the root session, plus the [created, updated] window for each subagent session. Idle gaps between activity bursts are excluded automatically.

Time spent waiting on the user, including tool permission prompts and agent questions, is subtracted from that union when the wait belongs to the current session tree. These waits are tracked live from opencode's event stream while the plugin is open, and abandoned waits are closed during the periodic refresh when opencode no longer reports them as pending. The session avg is unaffected.

Limits

The subagent tree walk is capped at depth 5 and 100 total sessions. Deeper or wider trees are silently truncated. The plugin requires an opencode version whose server exposes GET /session/:id/children and GET /session/:id/messages (roughly >= 1.18).

Subagent active time uses the session's [created, updated] window rather than detailed message activity. When opencode's experimental backgrounded-subagent feature detaches a subagent to keep running after the parent tool call returns, this coarse window may under- or over-count that subagent's active time.

Waits that began before the plugin loaded are not excluded because pending requests do not include their start time. If two sessions work concurrently, a wait in one may slightly under-count the other's simultaneous work.

Local development

bun install
bun run check
bun run build

The build must run first so dist/tui.js exists. Point tui.json at the built entry file for a smoke test:

{
  "plugin": ["./path/to/burn-rate/dist/tui.js"]
}

Releasing

Releases are tag-driven. Run bun run patch (or minor / major) to bump the version, commit, tag vX.Y.Z, and push the branch and tag to origin. CI then publishes to npm and creates a GitHub release with generated notes.

License

MIT