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

@timmyjl12/pi-opencode-bridge

v0.2.3

Published

Owned OpenCode bridge for Pi: registers oc-bridge / oc-go-bridge providers over the local opencode CLI. Free models work without login; all catalog models available. Built-in opencode/opencode-go providers are never touched.

Readme

pi-opencode-bridge (@timmyjl12/pi-opencode-bridge)

Owned replacement for the npm pi-opencode-bridge package. Registers two bridge providers in Pi that delegate model calls to the local opencode CLI:

| Provider | Catalog | Notes | |---|---|---| | oc-bridge | opencode/* (Zen) | free models work without OpenCode login | | oc-go-bridge | opencode-go/* (Go) | same, Go catalog |

pi's built-in opencode / opencode-go providers are never touched — they serve normal models and back the opencode-go/* fallback-chain / thinking-map entries in settings.

Why a bridge (not plain API providers)?

Free models (*-free) are refused by OpenCode's plain chat-completions endpoints (429/400, with or without a key) but work through the CLI with no login. The bridge therefore spawns opencode run -m <provider/model> --format json per turn and maps the NDJSON stream into pi's model stream. pi's tools cross the boundary via a <pi_tool_call> marker protocol (OpenCode's own tools disabled).

Install

pi install npm:@timmyjl12/pi-opencode-bridge

or run ad hoc: pi -e npm:@timmyjl12/pi-opencode-bridge. The provider ids stay oc-bridge and oc-go-bridge.

Commands

  • /oc-bridge-status — CLI binary, catalog counts, fallback state

Failure policy

No silent failures: missing opencode binary, empty catalog, or unparseable CLI output raises a visible warning naming the cause and the remedy. Model discovery is live (opencode models) with a curated fallback list.

Testing

Two committed layers, both hermetic (no network model calls):

  • npm test — helper-level tests: catalog cache/auth, marker and DSML parsing, thinking levels, usage math (node --test test/*.test.ts).
  • powershell -ExecutionPolicy Bypass -File test\run-battery.ps1 — stub-CLI battery over a real pi process: marker/tolerant-tag/chunk-split/DSML round trips, empty responses, key hygiene, thinking variants (max → #max, unsupported levels clamp), reload safety. Needs pi and node on PATH.

Run both after touching the parser, the thinking-level mapping, or when an upstream OpenCode change is suspected.

Thinking levels

/thinking offers exactly the effort values the OpenCode catalog advertises for the selected model (capabilities.reasoning.effort): GLM-5.3, for example, offers low, high, and max — nothing else. The selected level crosses the bridge as an OpenCode model variant:

opencode run -m opencode/glm-5.3#max --thinking ...
  • Levels the catalog does not list are hidden, so pi clamps a stored unsupported level to the nearest offered one instead of sending a variant the CLI rejects (provider.no-route).
  • off is offered only when the catalog can disable thinking (none); otherwise the lightest real effort is the floor and pi clamps off to it.
  • A model with no effort metadata keeps pi's default levels (off–high) and runs at the provider's default effort (no variant).

Compatibility

Checked against the installed CLI (2026-11-26):

| Component | Version | What the bridge uses | |---|---|---| | opencode CLI | 2.4.1 | run --format json, -m provider/model#variant, --agent, --auto, --thinking; NDJSON text / reasoning / step-start / step-finish / error | | @opencode/schema | 2.4.2 | capabilities.reasoning.effort, model selection {providerID, model, variant?}, step-finish tokens/cost | | @opencode/sdk | 2.4.2 | current SDK line (the older @opencode-ai/sdk 1.x describes the v1 CLI) |

Known limitations

  • Images are not bridged — bridge models are registered text-only; image parts are referenced as [image … omitted] in the prompt.
  • Free models share an upstream free-usage quota (429 FreeUsageLimitError when exhausted; surfaces as a normal bridge error).
  • Bridge turns are latency-heavy — every turn spawns opencode run with the full transcript (measured 37.8s for a trivial turn on 2026-11-05); multi-step agentic tasks take minutes. A persistent-server transport is the documented swap-in if this bites.
  • Usage is reported when the CLI reports it — step-finish carries tokens and billed cost on CLI 2.4.x; very old CLI versions emit neither and show 0.
  • The bridge is text-marker tool calling — models that ignore the <pi_tool_call> protocol produce plain text instead of tool calls (the prompt and a deterministic parser minimize this; echoed transcript reminders are filtered out).

Uninstall / shared state

The extension creates one file outside its repo on first run — the deny-all agent profile ~/.config/opencode/agents/oc-bridge.md (created if missing; rewritten only when it still matches an older extension-generated version, with a .bak-pre-v2 backup kept beside it). It keeps spawned OpenCode turns tool-less. After removing the extension, optionally delete it:

Remove-Item "$env:USERPROFILE\.config\opencode\agents\oc-bridge.md"

Plan

Work is tracked under .plan/replace-opencode-bridge/.