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-claude-bridge

v1.8.0

Published

OpenCode ↔ Claude bridge — keychain sync + PKCE OAuth + request transformation

Downloads

2,230

Readme

opencode-claude-bridge

Use your Claude Pro/Max subscription in OpenCode. If you're logged into the Claude CLI, it just works — no extra setup.

Install

Add to ~/.config/opencode/opencode.json:

{
  "plugin": ["opencode-claude-bridge"]
}

OpenCode auto-installs the plugin from npm on next launch.

If you're logged into the Claude CLI (claude login), the plugin auto-syncs your credentials — just select an Anthropic model and start chatting. If not, you'll be prompted to authenticate via browser OAuth or enter an API key.

Upgrade:

OpenCode pins the installed version. To upgrade to the latest:

cd ~/.cache/opencode && npm install opencode-claude-bridge@latest

Then restart OpenCode.

git clone https://github.com/dotCipher/opencode-claude-bridge.git ~/opencode-claude-bridge
cd ~/opencode-claude-bridge && npm install && npm run build

Then reference the full path in your config:

{
  "plugin": ["/Users/YOU/opencode-claude-bridge/dist/index.js"]
}

How the bridge works

The plugin sits between OpenCode and the Anthropic API:

OpenCodeopencode-claude-bridgeAnthropic API

Authentication — Supports both OAuth and API key auth:

  • OAuth (Pro/Max) — Auto-reads your Claude CLI's OAuth tokens from macOS Keychain (or ~/.claude/.credentials.json on Linux). No browser flow needed. If Claude CLI isn't available, falls back to browser-based OAuth PKCE.
  • API key — Works alongside a standard provider entry in your OpenCode config with an apiKey. The plugin only activates its OAuth handling for the built-in anthropic provider; custom API key providers pass through unchanged.

Token refresh — When tokens expire, three layers are tried: re-read from Keychain, refresh via stored token, refresh via CLI's token.

Request transformation — Every outbound OAuth request is rewritten to match what Claude Code sends: correct headers, ?beta=true URL parameter, thinking body field, mcp_ tool name prefixing, and system prompt sanitization.

Requirements

  • OpenCode v1.2+
  • For OAuth: Claude CLI installed and logged in (claude login)
  • macOS (Keychain) or Linux (~/.claude/.credentials.json fallback)
  • For API key: just configure a provider with apiKey in your OpenCode config as usual

Environment overrides

All OAuth and header parameters can be overridden via environment variables (ANTHROPIC_CLIENT_ID, ANTHROPIC_TOKEN_URL, ANTHROPIC_AUTHORIZE_URL, ANTHROPIC_CLI_VERSION, ANTHROPIC_BETA_FLAGS). Defaults match Claude Code 2.1.81 — most users won't need to change these.

Updating for new Claude CLI versions

When Claude Code updates, the required headers or body fields may change. To capture exactly what the latest Claude CLI sends:

./scripts/intercept-claude.sh claude-sonnet-4-6

This starts a local proxy, runs Claude CLI through it with OAuth, and saves the full request headers and body to /tmp/claude-intercept-*. Compare against the plugin's constants and fetch wrapper to spot differences.

Key things that have changed across versions:

  • anthropic-beta flags (required set changes)
  • Body fields (thinking, metadata, context_management)
  • user-agent version string
  • x-stainless-package-version

Credits

Combines approaches from shahidshabbir-se/opencode-anthropic-oauth, ex-machina-co/opencode-anthropic-auth, vinzabe/PERMANENT-opencode-anthropic-oauth-fix, and lehdqlsl/opencode-claude-auth-sync.

License

MIT