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

@stablekernel/opencode-bifrost

v0.13.2

Published

OpenCode plugin that routes models through the Bifrost gateway, resolving per-project virtual keys via gateway-cli. Supports OpenCode 1.x and 2.x.

Readme

@stablekernel/opencode-bifrost

OpenCode plugin that routes model traffic through a Bifrost LLM gateway, with per-project virtual-key resolution delegated to gateway-cli.

What it does

  • Registers a bifrost provider on OpenCode's OpenAI-compatible surface when gateway-cli is available. Without the CLI it registers no provider, but /bifrost-refresh still works.
  • Fetches the model list at startup through gateway-cli models --wire=openai, with per-model context/output limits and pricing already applied — no catalog is checked in, so a model added to the gateway appears without a local edit.
  • Seeds reasoning capability per model: catalog-flagged models are registered reasoning: true with one variant per effort value they accept. The config cascade's default reasoning_effort is seeded as the model's default when the model accepts it — on OpenCode 1.x as options.reasoningEffort, on OpenCode 2 as model-level settings.reasoningEffort — and a variant picked in the model picker overrides it. The static gateway-cli emit opencode block mirrors this (--v2 for the 2.x form).
  • Routes first-party OpenAI GPT models (…openai.gpt-*, not gpt-oss) over the Responses API, since the gateway answers their chat-completions requests with 400: a per-model provider.npm: "@ai-sdk/openai" (+ options.forceReasoning) on 1.x, package: "@opencode/ai/providers/openai/responses" on 2.x.
  • Adds rolling prompt-cache breakpoints for GPT-6.2 on Bedrock (bedrock/openai.gpt-6.2-*) on both OpenCode majors. Those models reuse a cached prefix only up to a content block marked prompt_cache_breakpoint: {mode: "explicit"}, which neither @ai-sdk/openai nor OpenCode 2's native Responses route sends, so every agent turn was a full cache write. The plugin marks the last input item of each Responses request and the item that ended the previous request; other requests pass through unchanged.
    • OpenCode 1.x: through the provider's in-memory fetch. Verified live 2026-11-24 on OpenCode 1.18.18 with gpt-6.2-sol: cache reads per step went from 0 on every step to 22.5K, 25.4K, 28.3K, 31.0K.
    • OpenCode 2: the native Responses route takes no custom fetch, so the plugin registers a session http.request hook scoped to the bifrost provider (in @opencode/plugin since 2.0.0). The host passes each outgoing provider request to it as a web Request and sends the one the hook leaves in its place. Verified live 2026-11-24 on OpenCode 2.3.2 with gpt-6.2-sol (four sequential tool steps and a final answer): cache reads per step went from 0 on every step with the released 0.11.1 to 19.6K, 20.5K, 20.8K, 21.1K, 21.4K.
  • Sets user on chat-completions requests to Fireworks models (fireworks/*) to a hash of the conversation's first messages, Fireworks' documented session-affinity key, on both OpenCode majors (the same provider fetch and http.request hook as above). OpenCode already sends an x-session-affinity header, but Bifrost forwards only x-bf-eh-* headers upstream; it does forward user. It is a hint, not a pin: measured live 2026-11-24 on kimi-k3.1, follow-up turns that missed the previous prefix fell from 26% to 18% (200 turns each). The rest is Fireworks routing (G-020).
  • Resolves the virtual key per project directory (gateway-cli resolve / gateway-cli key print), so two projects on different keys never collide in OpenCode's global auth store. On OpenCode 1.x it falls back to a credential stored via opencode auth login on machines without gateway-cli; OpenCode 2 removed that hook, so there discovery requires the CLI.

No secret is held by the plugin; the key is read at runtime.

/bifrost-refresh

Registered on every startup, with or without gateway-cli — in a sandbox that has no CLI at all the plugin registers no provider, so this command is the only way to see what the gateway offers. It reconciles the model list whenever you want it, without restarting OpenCode. Two modes, chosen by what is available at the moment you run it:

  • gateway-cli present — runs gateway-cli sync, which reconciles the saved selection on disk, and prints its output. On OpenCode 1.x, once that turn ends, the plugin disposes the instance so the TUI re-bootstraps and the model picker re-reads the reconciled list (disposing mid-turn would cut the turn short); OpenCode 2 exposes no dispose hook, so restart the service (opencode service stop) to pick up a reconciled list. On 1.x the list was re-registered, so the report does not tell you to restart; on OpenCode 2 the report is gateway-cli sync's own output.
  • gateway-cli gone (sandboxed machine) — asks $BIFROST_DISCOVERY_URL (or $BIFROST_GATEWAY_URL) /v1/models directly and reports what the gateway offers versus what this session registered: new ids, ids no longer offered, or "this session's list is current". Report only — nothing is written, here or anywhere else, and no instance is disposed; the text says to restart because this mode cannot re-register anything. The key comes from $BIFROST_VK, else the CLI's own ~/.config/bifrost/keys/default.env (on OpenCode 1.x, else the credential stored by opencode auth login). Project lookup also honors committed .gateway/shared.json, with personal > shared > user precedence per deployment. A saved project selection is the exception: refresh refuses before making a request and tells you to install gateway-cli, because direct discovery cannot apply the project context.

Either way the result arrives as a message part, never as an error: a failure prints one line. The virtual key is never printed or logged.

Requirements

  • gateway-cli on PATH (or the GATEWAY_CLI_BIN env var pointing at it), connected once with gateway-cli connect.

Install

opencode plugin --global @stablekernel/opencode-bifrost   # OpenCode 1.x
opencode plugin add @stablekernel/opencode-bifrost        # OpenCode 2.x

License

UNLICENSED — published for installation convenience; all rights reserved. Intended for use within the organization that operates the Bifrost gateway.