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

@bytespell/opencode-usage-limits-router

v0.0.2

Published

OpenCode plugin to auto-route to best AI provider based on usage limits. Includes CLI.

Readme

@bytespell/opencode-usage-limits-router

npm version

OpenCode integration for AI provider usage limits. Includes CLI and plugin.

Reads tokens from OpenCode's auth.json and uses @bytespell/model-provider-usage-limits for fetching usage data and routing logic.

Installation

Add to your opencode.json:

{
  "plugin": ["@bytespell/opencode-usage-limits-router"]
}

Or for project-level setup, create .opencode/package.json:

{
  "type": "module",
  "dependencies": {
    "@opencode-ai/plugin": "^1.1.4",
    "@bytespell/opencode-usage-limits-router": "^0.0.1"
  }
}

And .opencode/plugin/usage-limits.ts:

export { UsageLimitsPlugin } from '@bytespell/opencode-usage-limits-router';

Plugin Features

The plugin shows usage information via toast notifications:

  • On session.idle (after each model response): Shows compact usage summary
  • Listens for /usage and /route commands

CLI Usage

npx @bytespell/opencode-usage-limits-router
anthropic:
  5h: 84% remaining (used 16%) [-73%]
    resets at 2026-01-07T06:00:00Z
  7d: 59% remaining (used 41%)
    resets at 2026-01-11T09:00:00Z

github-copilot:
  monthly: 98% remaining (used 2%) [-87%]
  plan: individual
  credits: 293

CLI Options

opencode-usage-limits --provider anthropic     # Query specific provider
opencode-usage-limits --json                   # Output JSON format
opencode-usage-limits --no-cache               # Bypass cache
opencode-usage-limits --help                   # Show help

Pace Indicators

  • [+X%] = Using faster than pace (slow down!)
  • [-X%] = Using slower than pace (speed up!)

Library Usage

import { getProviderTokens, getUsage, pickBestProvider } from '@bytespell/opencode-usage-limits-router';

// Get tokens from OpenCode auth
const tokens = getProviderTokens();

// Fetch usage
const results = await getUsage({ tokens });

// Smart routing
const best = pickBestProvider('claude-sonnet-4-5', results);
console.log(best.reason);
// "github-copilot has most headroom (-29% behind pace)"

Authentication

Reads tokens from OpenCode's auth file (cross-platform):

  • Linux: ~/.local/share/opencode/auth.json
  • macOS: ~/Library/Application Support/opencode/auth.json
  • Windows: %APPDATA%\opencode\auth.json

Run opencode auth login to authenticate with providers.

License

MIT