Repository navigation
feat(anthropic): multi-account support (ANTHROPIC_TOKEN_<NAME> / anthropic-profiles) - #154
Itstommy10 wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
The only failing check is |
Track several Claude accounts at once. The primary account (ANTHROPIC_TOKEN or auto-detected Claude Code credentials) is unchanged and stored as account_id 0. Extra accounts come from ANTHROPIC_TOKEN_<NAME> (+ optional ANTHROPIC_REFRESH_TOKEN_<NAME>) env vars, which seed <data dir>/anthropic-profiles/<name>.json, or from Claude Code style credential files dropped into that directory. - store: account_id column on anthropic_snapshots/anthropic_reset_cycles (default 0), *ForAccount query variants, legacy functions keep working - tracker/agent: per-account tracker and agent; rotated OAuth tokens are written only to that account's profile file (one-time-use refresh tokens are never shared); statusline and Claude Code guard stay on the primary account - provider_accounts rows per extra account, soft-deleted when removed - web: ?account= on current/history/cycles, /api/anthropic/accounts, anthropicAccounts in the all-providers payload, per-account telemetry/dashboard toggles (anthropic:<id>) - docs: docs/ANTHROPIC_ACCOUNTS.md, README env table Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0c63a44 to
2e1ab14
Compare
|
Thanks for the multi-account work. The storage side is careful and consistent, and the profile credential handling is well thought out. A few things need fixing before we can merge.
Smaller items: every account reports its poll result under the same key, so one can clear another's error; a bad ?account= value returns the main account; turning off the default account hides it in one view but not the other; and extra accounts show "Collecting data..." because their history is always empty. Tests should use fakes only, with no real Claude credentials or OAuth calls. If you would rather we take this over, say so and we will pick it up from your branch. Either way, thanks for the careful work. |
|
Thanks for the thorough review, and for merging #156. All the points make sense, in particular the shared-credential case (1) and keeping the rotated token after an env change (2); I had not considered a profile holding the same OAuth credentials as the main account. Given the number of items and the test rework (fakes only), I would gladly take you up on the offer: please feel free to take this over from the branch. I will not push further commits to For what it is worth, the setup I have been running it on: 2 extra accounts seeded via Happy to test a revised branch against real accounts when you have one. Thanks again! |
Summary
Adds multi-account support for the Anthropic (Claude) provider, modeled on the existing Codex/MiniMax multi-account support.
ANTHROPIC_TOKENor auto-detected Claude Code credentials) is unchanged and stored asaccount_id = 0; all existing data stays with it.ANTHROPIC_TOKEN_<NAME>(+ optionalANTHROPIC_REFRESH_TOKEN_<NAME>) seeds<data dir>/anthropic-profiles/<name>.json, or drop a Claude Code.credentials.jsonthere directly. Docker friendly (/datavolume).provider_accountsrow, client, tracker and agent. Snapshots and reset cycles are stored per account (account_idcolumn, migration with default 0).?account=<id>on current/history/cycles,GET /api/anthropic/accounts,anthropicAccountsin the all-providers payload, per-account Telemetry/Dashboard toggles in Settings > Providers (anthropic:<id>), per-account cards on the Anthropic tab and in the All view.docs/ANTHROPIC_ACCOUNTS.md, README env table.Not in this PR
Insights, cycle overview, menubar, logging history and metrics remain primary-account only. Accounts are loaded at startup (restart to apply). At most 20 extra accounts.
Test plan
go vet ./...andgo test -race ./...(4754 passed, 0 failed)docker build