CoderClaw supports “subscription auth” via OAuth for providers that offer it (notably OpenAI Codex (ChatGPT OAuth)). For Anthropic subscriptions, use the setup-token flow. This page explains:
CoderClaw also supports provider plugins that ship their own OAuth or API‑key flows. Run them via:
coderclaw models auth login --provider <id>
OAuth providers commonly mint a new refresh token during login/refresh flows. Some providers (or OAuth clients) can invalidate older refresh tokens when a new one is issued for the same user/app.
Practical symptom:
To reduce that, CoderClaw treats auth-profiles.json as a token sink:
Secrets are stored per-agent:
~/.coderclaw/agents/<agentId>/agent/auth-profiles.json~/.coderclaw/agents/<agentId>/agent/auth.jsonLegacy import-only file (still supported, but not the main store):
~/.coderclaw/credentials/oauth.json (imported into auth-profiles.json on first use)All of the above also respect $CODERCLAW_STATE_DIR (state dir override). Full reference: /gateway/configuration
Run claude setup-token on any machine, then paste it into CoderClaw:
coderclaw models auth setup-token --provider anthropic
If you generated the token elsewhere, paste it manually:
coderclaw models auth paste-token --provider anthropic
Verify:
coderclaw models status
CoderClaw’s interactive login flows are implemented in @mariozechner/pi-ai and wired into the wizards/commands.
Flow shape:
claude setup-tokenThe wizard path is coderclaw onboard → auth choice setup-token (Anthropic).
Flow shape (PKCE):
statehttps://auth.openai.com/oauth/authorize?...http://127.0.0.1:1455/auth/callbackhttps://auth.openai.com/oauth/tokenaccountId from the access token and store { access, refresh, expires, accountId }Wizard path is coderclaw onboard → auth choice openai-codex.
Profiles store an expires timestamp.
At runtime:
expires is in the future → use the stored access tokenThe refresh flow is automatic; you generally don’t need to manage tokens manually.
Two patterns:
If you want “personal” and “work” to never interact, use isolated agents (separate sessions + credentials + workspace):
coderclaw agents add work
coderclaw agents add personal
Then configure auth per-agent (wizard) and route chats to the right agent.
auth-profiles.json supports multiple profile IDs for the same provider.
Pick which profile is used:
auth.order)/model ...@<profileId>Example (session override):
/model Opus@anthropic:workHow to see what profile IDs exist:
coderclaw channels list --json (shows auth[])Related docs: