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-auth-v2

v0.4.0-beta.6

Published

OpenCode 2 plugin that uses your Claude Code subscription credentials.

Readme

opencode-claude-auth-v2

Use an existing Claude Code Pro or Max subscription in the OpenCode 2 beta.

This is an OpenCode 2-only fork of griffinmartin/opencode-claude-auth. Use Griffin's package for OpenCode 1.

OpenCode 2 and its plugin API are in beta. This package currently targets @opencode-ai/[email protected] and may require updates with later beta builds.

How It Works

The plugin:

  • discovers Claude Code credentials in the macOS Keychain or ~/.claude/.credentials.json;
  • adds a Claude Code OAuth method to OpenCode 2's Anthropic integration;
  • routes OpenCode's built-in Anthropic provider through the Claude subscription transport;
  • routes requests through the AI SDK Anthropic provider with Claude subscription bearer authentication;
  • preserves OpenCode's own tools and permission loop;
  • refreshes expiring OAuth credentials and writes rotated tokens back to their original source;
  • applies the request, billing, beta-header, tool-name, and streaming transformations inherited from the original plugin.

Installing this plugin opts the Anthropic provider into Claude subscription use. Models keep their normal anthropic/<model> IDs; the plugin replaces the request transport because Claude subscription OAuth requires bearer authentication and additional request transformations.

Requirements

  • Node.js 22 or newer
  • @opencode-ai/cli@next
  • Claude Code installed and authenticated with claude auth login
  • A Claude Pro or Max subscription

Install

Add the published package to your OpenCode 2 configuration:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["opencode-claude-auth-v2@latest"],
}

Restart OpenCode 2 after changing plugin configuration.

For local development, build the checkout:

pnpm install
pnpm build

Then load its absolute entrypoint instead:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": [
    "/absolute/path/to/opencode-claude-auth-v2/opencode-claude-auth.js",
  ],
}

Migrating from OpenCode 1

OpenCode 1 uses the singular plugin field and the original package:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-claude-auth@latest"],
}

When upgrading to OpenCode 2, replace it with the plural plugins field and this v2 package:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["opencode-claude-auth-v2@latest"],
}

The OpenCode 1 plugin and its saved connection are not used by the OpenCode 2 integration. Ensure Claude Code is signed in with claude auth login, restart OpenCode 2, then run /connect and choose Anthropic > Import Claude Code subscription. If Claude Code is already signed in on the device, the existing Keychain or credentials-file entry can be imported without another browser login.

Existing anthropic/<model> references continue to work. Use /models to select a model under Anthropic.

If you used 0.1.0-beta.3 or earlier, replace explicit claude-subscription/<model> references with anthropic/<model> and reselect the model in existing OpenCode 2 sessions.

Running OpenCode 1 and 2 Side by Side

Do not put both plugin and plugins in the same configuration. OpenCode 1 rejects the OpenCode 2 plugins field.

Keep the existing OpenCode 1 configuration at ~/.config/opencode/opencode.json. Create a separate OpenCode 2 config root:

mkdir -p "$HOME/.config/opencode-v2/opencode"

Create ~/.config/opencode-v2/opencode/opencode.json with:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["opencode-claude-auth-v2@latest"],
}

Add this alias to ~/.zshrc or ~/.bashrc:

alias oc2='XDG_CONFIG_HOME="$HOME/.config/opencode-v2" XDG_DATA_HOME="$HOME/.local/share/opencode-v2" XDG_STATE_HOME="$HOME/.local/state/opencode-v2" XDG_CACHE_HOME="$HOME/.cache/opencode-v2" opencode2'

Restart the shell, then use opencode for OpenCode 1 and oc2 for OpenCode 2. The alias isolates configuration, sessions, state, and plugin caches while leaving HOME unchanged, so the v2 plugin can still import Claude Code credentials from the Keychain or ~/.claude/.credentials.json.

Project-level opencode.json files are still discovered by both versions. Keep version-specific plugin or plugins entries in the separate global configurations when using both versions side by side.

Use

Start OpenCode 2 and select a model from the Anthropic provider:

opencode2

Run /connect once and choose Anthropic > Import Claude Code subscription. You can repeat that flow to replace the stored connection or switch Claude Code accounts.

Why Not ai-sdk-provider-claude-code?

That community provider runs the Claude Agent SDK as its own agent harness. Its AI SDK v6 implementation does not support application-provided custom tools. OpenCode needs model tool calls returned to its own permissioned tool loop, so this plugin uses OpenCode 2's native Anthropic provider. Its HTTP hooks adjust requests and responses for Claude Code subscription billing.

Credential Sources

  1. macOS Keychain entries named Claude Code-credentials*
  2. ~/.claude/.credentials.json, or $CLAUDE_CONFIG_DIR/.credentials.json when configured

Multiple macOS accounts appear as choices in the OpenCode 2 connection flow. The selected source is persisted locally.

Development

pnpm install
pnpm build
pnpm test
pnpm lint

See RELEASING.md for the beta release and npm publishing process.

Diagnostic logging can be enabled with CLAUDE_AUTH_DEBUG=1 or set to a file path:

CLAUDE_AUTH_DEBUG=/tmp/claude-auth-debug.log opencode2

Attribution

This repository preserves the history and MIT-licensed implementation of griffinmartin/opencode-claude-auth. The OpenCode 2 integration architecture follows the public provider-plugin patterns in anomalyco/opencode, particularly its GitHub Copilot provider.

Disclaimer

OpenCode's documentation states that Anthropic does not permit Claude Pro or Max subscription use through third-party plugins. This project is unofficial, may stop working when Anthropic changes its OAuth infrastructure, and should be used at your own discretion.

License

MIT