Freeloading OpenCode auth off your Claude Code login
It lets OpenCode piggyback on your existing Claude Code OAuth session, skipping a separate login entirely.

What it does
The plugin registers a custom auth provider inside OpenCode that intercepts every Anthropic API request and injects fresh OAuth tokens lifted from your existing Claude Code setup. On macOS it reads directly from the Keychain; on Linux and Windows it falls back to ~/.claude/.credentials.json. It caches credentials in memory with a 30-second TTL, refreshes tokens automatically via Anthropic’s OAuth endpoint, and syncs everything back to disk so OpenCode stays authenticated without you touching an API key.
The interesting bit
The macOS Keychain integration is the star: it automatically detects multiple Claude Code accounts, labels them by subscription tier, and exposes an account switcher inside OpenCode. It even writes credentials to two different Windows paths just to cover every possible OpenCode installation method.
Key highlights
- Reuses existing Claude Code OAuth tokens; no separate API key or login flow needed
- macOS Keychain support with automatic multi-account detection and tier-based labeling
- Direct OAuth token refresh via Anthropic’s endpoint, with fallback to the Claude CLI if that fails
- Background re-sync every 5 minutes and in-memory caching with a 30-second TTL
- Supports 15 Anthropic models, with opt-in 1M context window (requires Claude Max)
Caveats
- macOS is the preferred platform; Linux and Windows rely on a file-based fallback that is less integrated
- 1M token context is opt-in only—earlier versions sent the beta header automatically and broke billing for Pro users
- If your Claude Code credentials are not OAuth-based, the plugin falls through to standard API key auth, which may not be what you expect
Verdict
Worth it if you already live in Claude Code and want OpenCode to just work without managing another set of secrets. Skip it if you prefer isolated credentials or run exclusively on non-macOS platforms without Claude Code installed.
Frequently asked
- What is griffinmartin/opencode-claude-auth?
- It lets OpenCode piggyback on your existing Claude Code OAuth session, skipping a separate login entirely.
- Is opencode-claude-auth open source?
- Yes — griffinmartin/opencode-claude-auth is open source, released under the MIT license.
- What language is opencode-claude-auth written in?
- griffinmartin/opencode-claude-auth is primarily written in TypeScript.
- How popular is opencode-claude-auth?
- griffinmartin/opencode-claude-auth has 1.3k stars on GitHub and is currently cooling off.
- Where can I find opencode-claude-auth?
- griffinmartin/opencode-claude-auth is on GitHub at https://github.com/griffinmartin/opencode-claude-auth.