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-sipmon

v0.1.0

Published

OpenCode plugin for usage-limit failover and local CLI notifications

Downloads

97

Readme

opencode-sipmon

OpenCode plugin that listens for usage-limit events and automatically switches the active OpenAI account using sipmon snapshots.

When a rate-limit happens, it picks the best available sipmon OpenAI snapshot and writes that auth into OpenCode auth. OpenCode's own retry loop then continues naturally on the switched account.

Install

npm install opencode-sipmon

Add to OpenCode config

~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-sipmon"]
}

Local dev plugin path (before publish)

If you want to test this repo copy directly, use a file:// entry that points to the plugin file:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    "file:///Users/liamvinberg/personal/projects/sipmon/packages/opencode-sipmon/index.js"
  ]
}

After publishing to npm, switch back to:

{
  "plugin": ["opencode-sipmon"]
}

Required setup

No failover env vars are required.

The plugin uses existing sipmon/OpenCode paths:

  • sipmon snapshots: $SIPMON_OPENAI_PROFILES_DIR or ~/.local/share/sipmon/profiles/openai
  • OpenCode auth: $OPENCODE_AUTH_FILE or ~/.local/share/opencode/auth.json

As long as sipmon snapshots exist, switching works automatically.

Notifications

Default local notification behavior:

  • macOS: osascript
  • Linux: notify-send
  • Windows: PowerShell message box

Optional override: OPENCODE_FAILOVER_NOTIFY_COMMAND

Optional log path override: OPENCODE_FAILOVER_LOG_FILE

Safety guards

  • In-flight lock per session
  • Cooldown per session (45s)
  • Maximum attempts per session (3)

These are required because OpenCode event hooks are dispatched without awaiting plugin completion.

Selection rules

For each sipmon snapshot (except current and already-tried ones), plugin:

  • refreshes token if needed
  • fetches usage from OpenAI usage API
  • computes usable status with strict rule: both 5h and 7d must be > 0
  • prefers Codex windows when available
  • selects the highest-scoring usable snapshot

If no usable snapshot exists, no switch is performed.

Verify it loaded

Check the log file (default: ~/.local/state/sipmon/opencode-sipmon.log) for lines like:

  • plugin_initialized
  • session_retry_status_received
  • session_error_received
  • snapshot_candidates_evaluated
  • active_auth_switched
  • switch_applied