A core-auth provider that signs in to Claude with the real Claude Code OAuth flow and lets you add multiple Claude subscription accounts. Both Claude Code (via the loader proxy) and OpenCode route requests through it, rotating accounts and respecting each one's subscription rate limits — so OpenCode uses your Claude Code subscription instead of a pay-per-token API key.
flowchart TD
subgraph Driver [claude-code driver — thin layer on core-auth]
HANDLE["handle(request) — Anthropic request rewrite"]
LOGIN["loginFlow() — PKCE OAuth"]
end
subgraph Core [core-auth]
MGR[AccountManager: select / refresh / rotate]
STORE[(accounts.json)]
MGR <--> STORE
end
CC[Claude Code loader proxy] -->|dist/handler.js handle| HANDLE
OC[OpenCode loader] -->|loader.fetch| HANDLE
HANDLE -->|acquire account + token| MGR
HANDLE -->|"Bearer + anthropic-beta: oauth + Claude Code system block"| API[(api.anthropic.com)]
API -->|429 / 529| MGR
LOGIN -->|platform.claude.com OAuth| STORE
src/driver/— driver + OAuth config/loginoauth/— PKCE flowplugin/request.ts— Anthropic rewritecommands.ts— slash-commandshandler.ts/index.ts/cli.ts— entries
dist/index.js— OpenCode bundlehandler.js— Claude loader bundlecli.js— CLI bundle
npx plugin-updater@latest init https://github.com/intisy-ai/claude-code-authnpm install claude-code-authConfig file: <configDir>/config/claude-code.json (edit via the loader or /claude-code-config set).
{
"logging": true,
"max_account_attempts": 4,
"account_selection_strategy": "hybrid",
"default_cooldown_seconds": 60,
"max_cooldown_seconds": 900
}| Key | Default |
|---|---|
logging |
true |
max_account_attempts |
4 |
account_selection_strategy |
"hybrid" |
default_cooldown_seconds |
60 |
max_cooldown_seconds |
900 |
| Command | Description | Arguments |
|---|---|---|
/claude-code-auth-config |
View and change claude-code-auth configuration | `list |
/claude-accounts |
List signed-in Claude subscription accounts |
corecore-authsync-bridge
Logs are written to <configDir>/logs/YYYY-MM-DD/claude-code-auth-HH-MM-SS.log and are toggled by
this plugin's logging config (default on). Console mirroring is global, off by default,
and controlled by the shared config/settings.json logConsole flag.
MIT.