OpenCode auth plugin: native Claude OAuth account manager (duh-claude-oauth protocol) + vendored opencode-claude-auth chat path. /claude use|list|status.
- JavaScript 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| scripts | ||
| test | ||
| vendor | ||
| .gitignore | ||
| index.js | ||
| package.json | ||
| README.md | ||
duh-claude-auth
Native Claude OAuth provider for OpenCode. Manages a pool of accounts with an account-first manager, auto-refreshes tokens before they expire, and sends the full claude-cli header set (betas, user-agent, stainless headers) on every request.
Install
git clone <repo-url>
opencode.jsonc:
{ "plugin": ["file:<clone-dir>/duh-claude-auth"] }
Restart opencode. No install, no build, zero deps.
Accounts
~/.config/opencode/duh-claude-accounts.json — plugin-private store:
{ "version": 1, "active": "you@gmail.com", "accounts": [ ... ] }
The active account is mirrored into ~/.local/share/opencode/auth.json.
auth.json is the session source of truth.
Commands
| Command | Effect |
|---|---|
/claude or /claude list |
list accounts, active marker, token TTL |
/claude use acc2|email |
switch active account (refreshes first) |
/claude status [acc] |
subscription + quota usage windows |
Env
DUH_CLAUDE_REDIRECT_PORT(default 54321)ANTHROPIC_CLI_VERSION(default 2.1.280, used in User-Agent)