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-model-cost

v0.3.0

Published

Live per-model tokens, cost, and TPS in the OpenCode TUI sidebar - one line per model for the whole session tree.

Readme

opencode-model-cost

Live per-model tokens, cost, and TPS in the OpenCode TUI sidebar.

OpenCode sidebar with the per-model stats block

Shows the model split of the current session tree in the right sidebar, one model per line, updated in real time:

Models  $2.19  135k tok
glm-5.3  89k  $2.10  ·~12.3tps
glm-5.3-flash  12k  $0.09
local  34k

The heading shows the totals; each line shows the model, its cumulative token count (input + output + reasoning), its cumulative cost (hidden when $0), and its tokens-per-second rate — the last run's rate is retained between runs, and the currently streaming model's line is highlighted.

Why

OpenCode's built-in stats show totals per session. Once you run multiple models — a flagship main agent delegating to cheap flash subagents, or a free local lane — you lose sight of who is actually spending what. This plugin breaks the session tree down per model, live, so you can see the split while you work.

Requirements

  • OpenCode >= 2.0.24 (use plugin 0.2.x for OpenCode v1)
  • The TUI (the plugin does nothing in CLI/web mode)

Install

Add the plugin to your global CLI config (~/.config/opencode/cli.json):

{
  "plugins": ["opencode-model-cost"]
}

Or install via the CLI:

opencode plugin add opencode-model-cost

Then restart OpenCode.

How it works

  • Reads every assistant message in the viewed session's tree — the session itself plus all subagent child sessions (attributed via parentID)
  • Groups cumulative tokens and cost per model
  • Tracks streaming text deltas to compute a per-model live TPS (5-second rolling window, byte-based token estimate); the last run's rate stays visible and the streaming model's line is highlighted
  • Renders a block in the right sidebar of the session view, in theme colors, one line per model

Limitations

  • TPS is available only for responses streamed during the current TUI run; restored session history still includes all models' tokens and cost
  • Token counts exclude cache reads/writes to keep the display readable; use opencode stats for full accounting
  • TPS is an estimate based on streamed text/reasoning bytes (~5 bytes per token), marked with ~ in the display

License

MIT