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-costs

v1.0.2

Published

Show LLM costs and token usage per agent in OpenCode sidebar

Downloads

88

Readme

opencode-costs

Show LLM costs and token usage per agent in OpenCode sidebar.

OpenCode costs sidebar

Why

OpenCode shows total token usage per session, which works fine when you have a single agent. But once you start working with multiple agents — a planner that delegates to a backend-dev, a frontend-dev, a reviewer, and a scriber — you lose visibility into who's spending what.

This plugin breaks down costs per agent, so you can see at a glance which agents are the most expensive, where token usage piles up, and whether your delegation strategy is cost-effective.

What it looks like

Costs  $0.615764  549.6K tok
qa  $0.137073  53.2K tok  (1)
scriber  $0.110440  55.1K tok  (1)
backend-dev  $0.104367  53.2K tok  (1)
frontend-dev  $0.090654  43.3K tok  (1)
plan  $0.082858  235.6K tok  (1)
system-analyst  $0.079053  38.6K tok  (1)
consult  $0.011319  70.7K tok  (1)

Install

  1. Open OpenCode
  2. Press Ctrl+P (or Cmd+P on macOS)
  3. Select Install Plugins
  4. Type opencode-costs and hit Enter

Done. Costs will appear in the sidebar on your next session.

Configuration

Override the refresh interval via environment variable:

OPENCODE_COSTS_REFRESH_MS=30000 opencode

| Option | Default | Description | |--------|---------|-------------| | OPENCODE_COSTS_REFRESH_MS | 15000 | Sidebar refresh interval in milliseconds (min 1000) |

How it works

Reads session history via OpenCode API, groups by agent (e.g. plan, build, default), shows cumulative cost ($) and token usage in the sidebar. Refreshes automatically and on session events.

Known Limitations

  • Agent attribution when switching with Tab: OpenCode reuses the same session when switching between Plan/Build agents, so all costs are attributed to the last active agent. This is an API limitation, not a plugin bug. Totals ($, tok) remain correct.
  • Current directory only: Only sessions from the current project directory are shown.
  • TUI only: This plugin only works in TUI mode, not CLI.

License

MIT