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

@albinocrabs/o-switcher

v0.7.2

Published

Seamless OpenRouter profile rotation for OpenCode — buy multiple subscriptions, use as one pool

Readme

O-Switcher

npm version CI License: Apache-2.0

Seamless OpenRouter profile rotation for OpenCode. Buy multiple cheap subscriptions and use them as one pool: when one profile hits quota or rate limits, O-Switcher keeps the backend moving to the next healthy profile.

Why?

  • OpenRouter profiles have quota and rate-limit ceilings.
  • Without O-Switcher, you re-auth manually and break flow.
  • With O-Switcher, the current auth/profile remains the source of truth until there is real failure evidence.
  • One cheap subscription pool behaves like one uninterrupted working pool.

Supported delivery paths

O-Switcher now documents only the supported OpenCode 1.4.x delivery surfaces:

  • Plugins
    • plugin in opencode.json
    • .opencode/plugins/
    • ~/.config/opencode/plugins/
  • Commands
    • command in opencode.json
    • .opencode/commands/
    • ~/.config/opencode/commands/

The supported contract is backend-first. If the backend plugin loads successfully, switching, diagnostics, and operator tools are available. Optional UI affordances are not the delivery contract.

Quick start

Published package

Add O-Switcher to your OpenCode config:

{
  "plugin": ["@albinocrabs/o-switcher@latest"]
}

That is enough to enable the backend plugin.

Deterministic local staging

If you are running from a local checkout, use the installer instead of keeping a live checkout path in plugin[]:

npm install
npm run install:opencode-local -- --target /path/to/your-project

The installer stages a supported local layout:

.opencode/
  plugins/
    o-switcher.js
    o-switcher/
      package.json
      dist/
      node_modules/
  commands/
    switcher.md

That gives you a staged backend plugin under .opencode/plugins/ and a staged /switcher command asset under .opencode/commands/ without relying on a live checkout path.

Control surface

O-Switcher exposes two supported operator layers:

  1. Backend tools on the plugin surface:
    • switcherStatus
    • switcherDoctor
    • switcherUse
    • switcherNext
    • switcherPinCurrent
  2. A staged /switcher custom command in .opencode/commands/switcher.md that routes to those backend tools.

The documented operator path is explicit command-driven control: inspect with switcherStatus and switcherDoctor, then switch with switcherUse, switcherNext, or switcherPinCurrent when needed.

Runtime behavior

  • The active backend profile is the current source of truth.
  • Ambiguous same-provider failures are recorded as warnings instead of triggering blind switching.
  • switcherDoctor reports backend facts, warnings, and unknowns honestly.
  • Diagnostics history records heartbeats, manual actions, and recent switch decisions.

When a request fails, O-Switcher applies bounded retries and bounded failover:

| Failure class | Backend action | | --- | --- | | Rate limited | Retry with cooldown/backoff | | Transient server failure | Retry with backoff | | Model unavailable | Try the next healthy target | | Auth failure | Stop and surface re-auth required | | Ambiguous same-provider failure | Record warning, no blind failover |

Configuration

Zero config works. Optional tuning in OpenCode 1.4.x goes through plugin tuple options:

{
  "plugin": [
    ["@albinocrabs/o-switcher@latest", {
      "retry": 3,
      "timeout": 30000
    }]
  ]
}

| Option | Default | Description | | --- | --- | --- | | retry | 3 | Max retry attempts per request | | timeout | 30000 | Request timeout in milliseconds |

Restart caveat

Opening a new OpenCode window is not a clean runtime restart. After changing plugin delivery or local staged assets, fully restart OpenCode before you trust the result.

Documentation

  • Getting Started — supported install, local staging, troubleshooting
  • API Reference — config, tools, supported vs unsupported surfaces
  • Examples — published-package and staged-local examples
  • Architecture — backend-first contract and current limitations

Development

git clone https://github.com/apolenkov/o-switcher.git
cd o-switcher
npm install
npm test
npm run typecheck
npm run build

See CONTRIBUTING.md for the full development guide.

Roadmap

O-Switcher started as a plugin, but the long-term goal is to upstream multi-profile failover ideas into OpenCode itself.

  • Now: backend-first OpenCode plugin for OpenRouter profile rotation
  • Next: harden the supported operator surface and document it end-to-end
  • Vision: each provider can have multiple interchangeable profiles with transparent bounded failover

License

Apache-2.0