Skip to content

Commit 7d67a2b

Browse files
committed
feat: Anthropic OAuth cleanup flow in setup wizard
Detects legacy Anthropic OAuth profiles that now incur Extra Usage. Offers 3 options: remove, keep, or migrate to API key. Added troubleshooting entry for manual cleanup.
1 parent 2c2bd73 commit 7d67a2b

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

SKILL.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,54 @@ Check if `~/.openclaw/zeroapi-config.json` exists.
9999
- **Re-run**: Read existing config, show current subscriptions and routing rules. Ask: "What changed? New subscription, dropped provider, or full reconfiguration?"
100100
- **First run**: Continue to Step 2.
101101

102+
### Step 1b: Detect Anthropic OAuth Profiles
103+
104+
Check the user's `openclaw.json` for Anthropic OAuth profiles:
105+
```bash
106+
cat ~/.openclaw/openclaw.json | grep -A2 '"anthropic'
107+
```
108+
109+
If `auth.profiles` contains entries like `"anthropic:[email protected]"` with `"mode": "oauth"`, these are **subscription-based Anthropic tokens** that no longer cover OpenClaw usage (as of April 4, 2026). They will incur Extra Usage (per-token) charges if left active.
110+
111+
**If Anthropic OAuth profiles are found, ask the user:**
112+
113+
> "I found Anthropic OAuth profiles in your config. Since April 4, 2026, Claude subscriptions no longer cover OpenClaw — these profiles will bill Extra Usage (per-token) if used. What would you like to do?
114+
>
115+
> A) **Remove them** — I'll clean up all Anthropic OAuth profiles and remove Anthropic from your fallback chains. Recommended if you don't want per-token billing.
116+
>
117+
> B) **Keep them** — They still work but will bill separately from your subscription. Choose this if you have an Anthropic API key or want to pay Extra Usage.
118+
>
119+
> C) **Migrate to API key** — Remove OAuth profiles and set up an Anthropic API key instead (standard per-token billing, cleaner setup)."
120+
121+
**If user chooses A (Remove):**
122+
123+
1. Remove all `anthropic:*` entries from `auth.profiles`
124+
2. Remove `"anthropic"` from `auth.order`
125+
3. Remove any `anthropic/*` model refs from `agents.defaults.model.primary` and `fallbacks`
126+
4. For each agent in `agents.list`: if `model.primary` is `anthropic/*`, switch to the best available subscription model
127+
5. Remove `anthropic/*` from all cron job model assignments
128+
6. Show summary of what was removed
129+
130+
```bash
131+
# Verify removal
132+
openclaw models status | grep anthropic
133+
# Should return nothing
134+
```
135+
136+
**If user chooses B (Keep):** Proceed. Note that Anthropic models will NOT be included in ZeroAPI routing (plugin skips them) but they remain available for manual `/model anthropic/claude-opus-4-6` use.
137+
138+
**If user chooses C (Migrate to API key):** Guide the user:
139+
```bash
140+
# Remove old OAuth profiles
141+
# Then set up API key:
142+
openclaw onboard --auth-choice anthropic-api-key
143+
# Or for Claude CLI backend:
144+
openclaw onboard --auth-choice anthropic-cli
145+
```
146+
Note: Even with an API key, Anthropic is NOT included in ZeroAPI routing. The API key enables manual use only.
147+
148+
**If no Anthropic profiles found:** Skip this step silently.
149+
102150
### Step 2: Ask Subscriptions
103151

104152
Ask the user: **"Which AI subscriptions do you have?"**

references/troubleshooting.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,32 @@ ls ~/.openclaw/zeroapi-config.json
1515

1616
---
1717

18+
### Anthropic OAuth profiles still in config (Extra Usage billing risk)
19+
20+
**Cause**: Legacy Anthropic OAuth profiles (`anthropic:[email protected]` with `mode: "oauth"`) remain in `openclaw.json` after the April 4, 2026 billing change. These profiles still work but now incur Extra Usage (per-token) charges instead of being covered by your Claude subscription.
21+
22+
**Check**:
23+
```bash
24+
cat ~/.openclaw/openclaw.json | grep -A2 '"anthropic'
25+
```
26+
27+
**Fix**: Run `/zeroapi` — the setup wizard detects Anthropic OAuth profiles and offers three options: remove, keep, or migrate to API key. If you want to remove manually:
28+
29+
```bash
30+
# 1. Open openclaw.json
31+
# 2. Remove all "anthropic:*" entries from auth.profiles
32+
# 3. Remove "anthropic" array from auth.order
33+
# 4. Remove any anthropic/* model refs from agents.defaults.model.primary and fallbacks
34+
# 5. Check each agent in agents.list for anthropic/* model assignments
35+
# 6. Restart gateway
36+
systemctl --user restart openclaw-gateway.service
37+
# 7. Verify
38+
openclaw models status | grep anthropic
39+
# Should return nothing
40+
```
41+
42+
---
43+
1844
### "ZeroAPI Router not loaded"
1945

2046
**Cause**: The plugin is not installed or failed to load at gateway start.

0 commit comments

Comments
 (0)