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-usage-viewer

v1.0.7

Published

OpenCode Go usage plugin showing rolling, weekly and monthly usage

Readme

opencode-usage-viewer

OpenCode Go plugin that displays token usage (rolling, weekly and monthly) in two ways:

  1. Tool - Run /usage at any time to see current usage
  2. Automatic toast - On session start, shows a toast with current usage

Requirements

  • OpenCode Go installed and configured
  • Environment variables:
    • OPENCODE_GO_WORKSPACE_ID - Your workspace ID (found in the opencode URL)
    • OPENCODE_GO_AUTH_COOKIE - Authentication cookie (auth cookie from opencode.ai)

How to get the variables

WORKSPACE_ID: Found in the URL when you access your workspace:

https://opencode.ai/workspace/[YOUR_ID_IS_HERE]/go

AUTH_COOKIE: You need to extract the auth cookie from your browser while logged into opencode.ai. In Chrome/Edge you can find it in DevTools > Application > Cookies.

Installation

npm install -g opencode-usage-viewer

The postinstall script automatically adds opencode-usage-viewer to your global opencode config (~/.config/opencode/opencode.json or opencode.jsonc). After installing, restart opencode.

How it works

/usage Tool

Tool screenshot

> /usage

  OpenCode GO Usage
------------------------

ROLLING   ████████░░░░░░░░░░░░░░░░  33.0%  reset 6h 12m
WEEKLY    ██░░░░░░░░░░░░░░░░░░░░░░   8.0%  reset 3d 0h
MONTHLY   ░░░░░░░░░░░░░░░░░░░░░░░░   0.0%  reset 12d 0h

Session Toast

Toast screenshot

When a session starts, a toast automatically appears showing:

OpenCode GO Usage
------------------------

ROLLING   ████████░░░░░░░░░░░░░░░░  33.0%  reset 6h 12m
WEEKLY    ██░░░░░░░░░░░░░░░░░░░░░░   8.0%  reset 3d 0h
MONTHLY   ░░░░░░░░░░░░░░░░░░░░░░░░   0.0%  reset 12d 0h

Uninstall

npm uninstall -g opencode-usage-viewer

Also remove opencode-usage-viewer from the plugin array in your opencode config (~/.config/opencode/opencode.json or opencode.jsonc).

Project structure

opencode-usage-viewer/
  index.js            # Main plugin (exports OpenCodeUsagePlugin)
  postinstall.js      # Adds plugin entry to opencode config
  package.json        # npm package config
  README.md           # This file
  screenshot-tool.png # Tool output screenshot
  screenshot-toast.png # Toast notification screenshot

Troubleshooting

Toast not appearing

  • Verify that environment variables are set
  • Check opencode console for errors

Tool not working

  • Make sure you are logged into opencode.ai
  • Verify the auth cookie has not expired

Fetch errors

  • May be a network issue or credentials problem