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-token-dashboard

v0.1.1

Published

OpenCode plugin that provides token usage analytics.

Downloads

193

Readme

OpenCode Token Dashboard

npm version License: MIT

opencode-token-dashboard is an OpenCode plugin that adds a token analytics dashboard with clear ASCII tables and a ready-to-use slash command.

Features

  • /token-usage slash command
  • token_usage tool (primary)
  • token_dashboard tool (alias)
  • Aggregated analytics across one or both OpenCode databases
  • Styled ASCII output for overview, model usage, and top sessions

Installation (npm recommended)

  1. Install the package:
npm install opencode-token-dashboard
  1. Add the plugin to your OpenCode config at ~/.config/opencode/opencode.json:
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-token-dashboard"]
}
  1. Restart OpenCode.

  2. Run:

/token-usage

Local development install

Use this path when developing or testing from source.

  1. Install dependencies in this repository:
bun install
  1. Reference the local plugin entrypoint in ~/.config/opencode/opencode.json:
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["file:///<Full-Plugin-Path>/opencode-token-dashboard/index.ts"]
}
  1. Restart OpenCode, then run /token-usage.

Usage

Slash command examples:

/token-usage
/token-usage 14 8
/token-usage 30 10

Tool examples (via prompt):

  • Run token_usage with days=30 and topSessions=10
  • Run token_dashboard with days=7

Arguments

token_usage and token_dashboard support:

| Argument | Type | Default | Range | | --- | --- | --- | --- | | days | number | 7 | 1..365 | | topSessions | number | 5 | 1..20 | | includeMain | boolean | true | true/false | | includeLocal | boolean | true | true/false |

For slash command usage:

  • first positional argument -> days
  • second positional argument -> topSessions

Data sources

By default, the plugin reads:

  • ~/.local/share/opencode/opencode.db
  • ~/.local/share/opencode/opencode-local.db

Environment overrides

Use environment variables when databases are in non-default locations:

  • OPENCODE_DB_PATH
  • OPENCODE_LOCAL_DB_PATH

Example:

OPENCODE_DB_PATH="/custom/path/opencode.db" opencode

Troubleshooting

  • Command not found:
    • verify plugin entry in ~/.config/opencode/opencode.json
    • restart OpenCode after config changes
  • Empty dashboard or missing source data:
    • confirm database files exist
    • confirm custom environment variable paths
  • Dependency issues:
    • local install: run bun install again in this repository
    • npm install: reinstall plugin and restart OpenCode

Maintainer release notes

npm whoami
npm publish --access public

If npm whoami fails, run npm login first.

License

MIT