コンテンツにスキップ

Claude Auth

このコンテンツはまだ日本語訳がありません。

Claude Auth registers its own Anthropic auth provider with a custom fetch handler that intercepts all Anthropic API requests, using your Claude Code credentials.

Key features

FeatureDescription
No separate API keyReuses OAuth tokens from your Claude Code installation
Keychain-firstReads from macOS Keychain; falls back to ~/.claude/.credentials.json ($CLAUDE_CONFIG_DIR respected) on other platforms
30-second TTL cacheTokens cached in memory; near-expiry tokens refresh via the Anthropic OAuth endpoint (zero LLM tokens consumed)
Multi-account (macOS)Multiple Claude Code accounts detected automatically; switch via opencode auth login
auth.json fallbackSyncs credentials to OpenCode auth.json; on Windows writes both known locations
Background re-syncEvery 5 minutes; falls back to the Claude CLI if direct refresh fails

Prerequisites

  • Claude Code installed and authenticated (run claude at least once)
  • OpenCode installed
  • macOS preferred (Keychain); Linux and Windows work via the credentials file fallback

Installation

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

{
  "plugin": ["opencode-claude-auth@latest"]
}