#authorize anthropic
1 messages · Page 1 of 1 (latest)
For Anthropic subscription auth in OpenClaw (non-API-key), use the setup-token flow:
openclaw models auth setup-token --provider anthropic
If you want the full interactive setup path instead:
openclaw onboard --auth-choice setup-token
You’ll still generate the token via Claude CLI (claude setup-token) and paste it when prompted.
Refs: https://docs.openclaw.ai/providers/anthropic · https://docs.openclaw.ai/concepts/oauth
Yep — generate it with the Claude Code CLI:
claude setup-token
That prints a token string. Copy it, then paste it into the openclaw models auth setup-token --provider anthropic prompt.
You can run claude setup-token on any machine. If it’s a different machine than your gateway host, just copy the token over and paste it there.
Ref: https://docs.openclaw.ai/help/faq#where-do-i-find-an-anthropic-setup-token
Nice — if you installed Claude Code via npm, it’s usually:
npm uninstall -g @anthropic-ai/claude-code
If that says package not found, check what installed claude first:
which claude
npm ls -g --depth=0 | grep -i claude
pnpm ls -g --depth=0 | grep -i claude
Then uninstall with the same package manager you used (npm uninstall -g <pkg> or pnpm remove -g <pkg>).
Perfect — since you used the native installer (curl ... install.sh | bash), here’s the full cleanup.
Uninstall Claude Code (native install: macOS/Linux/WSL)
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude
Optional: remove Claude Code config/history too (full wipe)
# user-level settings/state
rm -rf ~/.claude
rm -f ~/.claude.json
# project-level settings (run inside any project where you used Claude Code)
rm -rf .claude
rm -f .mcp.json
If you ever had an old npm install too, remove that as well
npm uninstall -g @anthropic-ai/claude-code
Verify uninstall
which -a claude
If uninstall worked, which should return nothing (or only unrelated paths).
For verifying Anthropic setup-token is working in OpenClaw + Discord:
- On the gateway host (CLI):
openclaw models status
You should see Anthropic auth/profile available.
- In Discord thread:
- Send:
/model status
This shows active model/provider + auth profile being used. - Then send a normal test prompt in that thread; if auth is broken you’ll get an auth error quickly.
Yep — easiest path is to pin auth order to the good token profile, so OpenClaw stops trying the old one.
openclaw models auth order set --provider anthropic anthropic:default
Then verify:
openclaw models auth order get --provider anthropic
openclaw models status --probe-provider anthropic
In Discord, run:
/model status
You should see it using the Anthropic profile you pinned.
If you want to fully remove the stale one (anthropic:0auth-01), there isn’t a dedicated models auth remove command yet — delete that profile entry from:
~/.openclaw/agents/main/agent/auth-profiles.json
(make a backup first), then:
openclaw gateway restart
Got it — let’s do a tight triage.
Most likely causes here are (a) bad session state, or (b) the thread still trying the stale Anthropic profile.
1) Quick in-Discord reset test
- Run
/new - Run
/model status - Send a tiny test message (
ping)
If /model status still shows the old profile, force the good one for this session.
2) On your gateway host, run these and paste output
openclaw --version
openclaw status --all
openclaw models status --probe-provider anthropic
3) Capture the exact runtime error
In one terminal:
openclaw logs --follow
Then send one message in Discord to reproduce, and paste the error lines from logs.
That generic “⚠️ Something went wrong…” is just the surface message — logs will show the real failure (auth/profile/session/tool error).
Refs: https://docs.openclaw.ai/help/faq#first-60-seconds-if-something-is-broken · https://docs.openclaw.ai/cli/models
Nice catch — your logs show the root cause exactly:
claude-opus-4.6 ❌ (invalid)
claude-opus-4-6 ✅ (correct)
So /new is failing when OpenClaw hits that bad model ref.
Run this on the gateway host:
openclaw models set anthropic/claude-sonnet-4-6
openclaw models fallbacks list
openclaw models fallbacks remove anthropic/claude-opus-4.6
openclaw models fallbacks add anthropic/claude-opus-4-6
openclaw models status
Then in Discord:
/new/status(or/model status)- send a test message
If you still see errors, paste fresh openclaw logs --follow output after these changes.
Docs: https://docs.openclaw.ai/concepts/models · https://docs.openclaw.ai/cli/models
what specifically am i looking for when i run the commands you send me? i don't want to paste all of my logs since this is a public forum. tell me specifically what to look for.
i'm still getting the same error when running "/new" in the channel.
100% fair — don’t paste full logs. Here’s exactly what to check.
What to look for (pass/fail)
-
Any model id with a dot version is wrong
Bad:claude-opus-4.6,claude-sonnet-4.6
Good:claude-opus-4-6,claude-sonnet-4-6 -
Fallbacks must not include dotted model ids
-
Aliases (like
opus,sonnet) must point to dashed ids
Minimal commands + expected result
openclaw models status
- Look for model lines; they should use
-4-6, not.4.6.
openclaw models fallbacks list
- Should not contain
4.6with a dot.
openclaw models aliases list
- Any alias mapping to
.4.6is wrong.
If you find dotted refs, fix them
openclaw models set anthropic/claude-sonnet-4-6
openclaw models fallbacks remove anthropic/claude-opus-4.6
openclaw models fallbacks add anthropic/claude-opus-4-6
openclaw models aliases add opus anthropic/claude-opus-4-6
openclaw models aliases add sonnet anthropic/claude-sonnet-4-6
Then retry /new.
Safe log snippet (only one line type)
If it still fails, only look for lines containing:
model_not_found
not_found_errorNo credentials found
You can share just those single lines (no full log dump).
there are no dots.
Good signal — if there are truly no dotted model refs now, next likely cause is stale runtime state.
Do this exact sequence:
openclaw --version
openclaw gateway restart
openclaw models status --probe-provider anthropic
Then in Discord:
/new/model status- send
ping
If it still errors, capture only matching error lines (not full logs):
openclaw logs --follow | rg -i "model_not_found|not_found_error|no credentials|session file path|embedded_run_agent_end"
Paste just those matched lines.
That’ll tell us if this is still model resolution vs session-state corruption.
give me a command that doesn't use "rg"
Yep — use grep instead:
openclaw logs --follow | grep -Ei "model_not_found|not_found_error|no credentials|session file path|embedded_run_agent_end"
Yep — now we need to find the exact file still holding 4.6.
Run this (no rg):
grep -RIn -E "claude-(sonnet|opus)-4\.6" ~/.openclaw/openclaw.json ~/.openclaw/agents/main 2>/dev/null
That command should print file paths + line numbers.
Those are the stale entries the runtime is still reading.
Fix each file it reports
sed -i.bak \
-e 's/claude-sonnet-4\.6/claude-sonnet-4-6/g' \
-e 's/claude-opus-4\.6/claude-opus-4-6/g' \
<FILE_FROM_GREP>
Then restart:
openclaw gateway restart
If grep prints nothing but errors still mention 4.6, then the gateway is reading a different state/agent path — run:
openclaw health --verbose
and check which config/state path it reports.
the grep command prints way too much output. hard to decipher what's happening there. simplify for me.
Totally — use this simpler version that prints only file names (no noisy lines):
grep -RIl --include='*.json' --include='*.json5' -E "claude-(sonnet|opus)-4\.6" ~/.openclaw/openclaw.json ~/.openclaw/agents/main 2>/dev/null
If that returns files, auto-fix all of them with:
grep -RIl --include='*.json' --include='*.json5' -E "claude-(sonnet|opus)-4\.6" ~/.openclaw/openclaw.json ~/.openclaw/agents/main 2>/dev/null \
| while IFS= read -r f; do
sed -i.bak -e 's/claude-sonnet-4\.6/claude-sonnet-4-6/g' -e 's/claude-opus-4\.6/claude-opus-4-6/g' "$f"
echo "fixed: $f"
done
Then restart:
openclaw gateway restart
Perfect — that means the stale model ref is in your main config.
Run exactly this:
sed -i.bak \
-e 's/claude-sonnet-4\.6/claude-sonnet-4-6/g' \
-e 's/claude-opus-4\.6/claude-opus-4-6/g' \
/home/claw/.openclaw/openclaw.json
Verify it’s clean:
grep -nE "claude-(sonnet|opus)-4\.6" /home/claw/.openclaw/openclaw.json || echo "✅ no dotted refs left"