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-9routerplus-usage

v0.1.1

Published

OpenCode plugin that shows 9routerplus usage stats after AI completion

Downloads

275

Readme

9Router Usage Notifier

OpenCode plugin that displays 9routerplus usage statistics after each completed assistant turn.

Features

  • Shows usage stats after every AI response
  • Displays: estimated cost, input/output tokens, total requests
  • Configurable period: today, last24h, or 7d (defaults to today)
  • Usage display mode supports inline, toast, or both and defaults to toast

Installation

Primary install flow:

npx opencode-9routerplus-usage

What the installer does:

  • creates ~/.config/opencode/9routerplus-usage.json if missing
  • adds opencode-9routerplus-usage to ~/.config/opencode/opencode.json
  • relies on OpenCode's npm plugin support so the plugin is installed/loaded from the package entry directly
  • prints a reminder to check baseURL and allowedProviders

Manual fallback:

npm install -g opencode-9routerplus-usage
opencode-9routerplus-usage

If you prefer to edit OpenCode config yourself, add this plugin entry:

{
  "plugin": ["opencode-9routerplus-usage"]
}

Then create the plugin config file with:

npm run setup

when working from this repo locally.

Configuration

  1. Ensure plugin is listed in ~/.config/opencode/opencode.json:
{
  "plugin": [
    "@spoons-and-mirrors/subtask2@latest",
    "opencode-agent-skills",
    "@tarquinen/opencode-dcp@latest",
    "opencode-9routerplus-usage"
  ]
}

The npx opencode-9routerplus-usage command can add this automatically.

  1. Create plugin config file next to opencode.json:

Path: ~/.config/opencode/9routerplus-usage.json

{
  "baseURL": "http://localhost:20128",
  "period": "today",
  "enabled": true,
  "usageDisplay": "toast",
  "minNotifyIntervalMs": 1500,
  "requestTimeoutMs": 3500,
  "allowedProviders": ["9routerplus"]
}

Minimal (recommended to start):

{
  "baseURL": "http://localhost:20128",
  "period": "today",
  "usageDisplay": "toast",
  "allowedProviders": ["9routerplus"]
}

Quick setup command (auto-create config file):

npm run setup

Options

  • baseURL - 9routerplus server URL (default: http://localhost:20128)
  • period - Time period: today, last24h, or 7d (default: today)
  • enabled - Enable/disable plugin (default: true)
  • usageDisplay - Usage presentation mode: inline, toast, or both (default: toast)
  • minNotifyIntervalMs - De-duplicate end-of-turn status emission across supported completion hooks per session (default: 1500)
  • requestTimeoutMs - API request timeout in ms (default: 3500)
  • allowedProviders - Show usage when active provider matches, or when the model id is namespaced under an allowed provider such as 9routerplus/... (default: ["9routerplus"])

Behavior

  • Plugin reads model/provider from OpenCode session metadata.
  • Success status appears when provider attribution matches allowedProviders, or when the model id itself is namespaced under an allowed provider.
  • End-of-turn success output is de-duplicated across session.idle and experimental.text.complete.
  • usageDisplay is the only presentation switch for usage output.
  • API/runtime errors are shown as toast and de-duplicated (shown once per error key until recovery).

Usage

Once installed and configured, the plugin shows a success toast after each eligible assistant completion by default. If you switch usageDisplay to inline or both, the inline status block looks like this:

────────────────────────────────────────────────────
9ROUTERPLUS TODAY · REQ 1023 · $155 · IN 155M · OUT 150K
────────────────────────────────────────────────────

Default success toast content:

Title: 9ROUTERPLUS TODAY · $155
Message: TOTAL REQUEST 1023
IN 155M · OUT 150K

Requirements

  • OpenCode with plugin support
  • 9routerplus running with /api/plugin/usage-summary endpoint