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

v1.0.3

Published

One extra sidebar line showing total session spend, including all subagents.

Readme

OpenCode Total Spend

npm version

Calculates the total spend for your session, including all subagents, and puts it on one extra line underneath OpenCode's existing price.

OpenCode sidebar showing $83.75 agent spend and Σ $191.62 total spend including subagents

That's it. The original price is this agent's spend. Σ includes this session and every nested subagent, at any depth. It updates as they work and includes earlier spend when you reopen a session.

Install

For OpenCode 1.18.34 or newer in the 1.x series:

opencode plugin --global opencode-total-spend

Restart OpenCode. The command installs the npm package and adds it to your global TUI configuration. No cloning or build step is needed. OpenCode 2 uses a different plugin API and isn't supported by this release.

Alternatively, add the package to ~/.config/opencode/tui.json (keep any existing plugins):

{
  "plugin": ["opencode-total-spend"]
}

If you previously installed from a clone, remove the local dist/tui.js entry from tui.json when switching to the npm package, so it is only loaded once.

Install from source

git clone https://github.com/nabilfreeman/opencode-total-spend.git

Add the absolute path to the included, prebuilt dist/tui.js to the plugin array in ~/.config/opencode/tui.json. No build or npm install is needed.

How it works

The plugin reads session costs through OpenCode's API, recursively includes child sessions, and counts each session once. Session events update the figure live; a refresh every minute catches anything missed during a reconnect. It uses OpenCode's recorded dollar costs, including its cache pricing, rather than estimating tokens at a separate rate. These are the same cost records OpenCode uses, not a provider invoice.

OpenCode doesn't expose a slot immediately below the price, so the plugin replaces the small Context block with the same layout and adds the sigma line. It follows your current theme. While loading it shows Σ …; if costs can't be read it shows Σ unavailable instead of a partial total.

Remove

Remove its entry from tui.json and restart OpenCode. If Context is hidden, enable internal:sidebar-context in the command palette's Plugins menu.

Development

npm install
npm run build
npm test

The built JavaScript is committed so a clone is ready to use. Runtime UI dependencies are supplied by OpenCode.

Releases

Pushes and merges to main automatically bump the patch version, build the plugin, publish it to npm, and create a GitHub release. The release workflow uses npm trusted publishing (OIDC) with provenance. No manual version bump, tag, npm token secret, or sign-in is needed for these releases.

MIT licensed. Context layout and token calculation adapted from OpenCode.