#oauth anthropic

1 messages · Page 1 of 1 (latest)

gilded flare
#

I am trying to set up Claude Oauth for my openclaw so I can acces me 20x max subscription. When I carry out the openclaw onboarding and select oauth it always give a 401 and says invalid. How do I use oauth for open claw

burnt latchBOT
#

For Claude Pro/Max (subscription) you generally don’t want the “Anthropic OAuth” option in openclaw onboard.

OpenClaw’s recommended path for subscription accounts is setup-token:

  1. Generate a token with the Claude Code CLI (on any machine):
claude setup-token
  1. Paste it into OpenClaw on the gateway host (where the Gateway runs):
  • In the wizard: choose “Anthropic token (paste setup-token)”
  • Or via CLI:
openclaw models auth paste-token --provider anthropic
openclaw models status
#

If you’re seeing 401 / “invalid”, that usually means the stored subscription credential was revoked/expired → just re-run claude setup-token and paste the new token again. (Docs call this out explicitly.)

Docs:

If you paste:

  • openclaw --version
  • your OS (macOS / Linux / WSL2)
  • and openclaw models status (you can redact emails/tokens)

…I can tell you exactly which auth mode/profile OpenClaw thinks it’s using and why the wizard’s OAuth path is failing for you.

gilded flare
#

Do I just do this in my Mac terminal

#

here is the terminal resposnes you asked for aswell madsadmin@Maddoxs-Mac-mini ~ % openclaw --version
2026.2.15
madsadmin@Maddoxs-Mac-mini ~ % openclaw models status

🦞 OpenClaw 2026.2.15 (3fe22ea) — Meta wishes they shipped this fast.

Config : ~/.openclaw/openclaw.json
Agent dir : ~/.openclaw/agents/main/agent
Default : openai/claude-opus-4
Fallbacks (1) : openai/claude-sonnet-4
Image model : -
Image fallbacks (0): -
Aliases (3) : Opus -> openai/claude-opus-4, Sonnet -> openai/claude-sonnet-4, Haiku -> openai/claude-haiku-4
Configured models (3): openai/claude-opus-4, openai/claude-sonnet-4, openai/claude-haiku-4

Auth overview
Auth store : ~/.openclaw/agents/main/agent/auth-profiles.json
Shell env : off
Providers w/ OAuth/tokens (0): -

Missing auth

  • openai Run openclaw configure or set an API key env var.

OAuth/token status

  • none
    madsadmin@Maddoxs-Mac-mini ~ %
burnt latchBOT
#

Yes — if your Gateway is running on your Mac, do it right in Terminal on the Mac.

If you want the subscription (Pro/Max) path

  1. Install/use the Claude Code CLI (so claude works), then run:
claude setup-token
  1. Copy the token it prints, then paste it into OpenClaw on the same Mac:
openclaw models auth paste-token --provider anthropic
openclaw models status

Or rerun the wizard (openclaw onboard) and pick “Anthropic token (paste setup-token)”.

Key detail

gilded flare
#

i am currently using openrouter open ai bridge. i have altered the model.json and the other nessercary file do i need to ensreu that is not goin to be an usse before i do this

burnt latchBOT
#

If your Gateway is remote (Linux box/VPS), you still can run claude setup-token on your Mac — but you must paste the token on the gateway host (the machine actually running the Gateway).

If you tell me whether your Gateway is “This Mac” or remote, I’ll give the exact minimal steps for your setup.

gilded flare
#

i want to stop using the bridgeand do it properly, can i just proceed with the guide above

burnt latchBOT
#

That output makes it clear what’s going on:

  • Your default model is set to the openai/... provider (openai/claude-opus-4)
  • And OpenClaw has zero provider tokens configured (Providers w/ OAuth/tokens (0))
  • So it’s correctly telling you: “Missing auth – openai” → it’s waiting for an OpenAI key, not Anthropic.

For a Claude Pro/Max subscription, you want Anthropic setup-token, not “Anthropic OAuth”.

Do this on the Mac (since that’s where your Gateway/config is):

  1. Generate a setup-token with the Claude Code CLI:
claude setup-token
  1. Paste that token into OpenClaw (stores it in auth-profiles.json):
#

Using an OpenRouter “OpenAI-compatible bridge” won’t block you from adding Claude subscription auth — setup-token lives in OpenClaw’s auth store, separate from your models.json provider wiring.

What can bite you is if you accidentally overwrite/replace your current custom provider config when re-running a wizard. So do this safely:

1) Quick safety backup (recommended)

cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak
cp ~/.openclaw/agents/main/models.json ~/.openclaw/agents/main/models.json.bak 2>/dev/null || true
cp ~/.openclaw/agents/main/agent/auth-profiles.json ~/.openclaw/agents/main/agent/auth-profiles.json.bak 2>/dev/null || true

2) Add Claude subscription auth (doesn’t touch OpenRouter config)

  • Generate token:
claude setup-token
  • Paste into OpenClaw (on the gateway host, sounds like your Mac):
#

Yes — you can proceed, and you don’t need to undo the bridge first.

The two things you must do to “stop using the bridge” are:

  1. Add Anthropic subscription auth via setup-token
claude setup-token
openclaw models auth paste-token --provider anthropic
  1. Switch your default model off openai/... and onto anthropic/...
    Right now your config is set to openai/claude-opus-4, so OpenClaw will keep trying to use the OpenRouter/OpenAI-compatible bridge until you change it.

Do:

openclaw models list | grep anthropic
#
openclaw models set anthropic/<one-of-the-model-ids-from-the-list>
openclaw models status

After that, the OpenRouter bridge can stay in your config as “unused” (it won’t be hit unless it’s still a fallback). If you want to fully clean it out later, do it once everything works.

Docs:

If claude setup-token says “command not found”, you’ll need to install/login to the Claude Code CLI first (that’s what issues setup-tokens).

#
openclaw models auth paste-token --provider anthropic
  1. Switch your default model to an anthropic/... model (right now it’s openai/...):
  • easiest: run
openclaw configure

and in the model/auth step pick Anthropic + your Claude model.

  1. Re-check:
openclaw models status

Docs (subscription path): https://docs.openclaw.ai/providers/anthropic

#
openclaw models auth paste-token --provider anthropic
openclaw models status

After that, you’ll want to switch the default model/provider away from your current openai/... (right now OpenClaw is literally configured to use the openai provider, which is why it says “Missing auth - openai”).

3) How do you want to run it?

Pick one and I’ll give the exact next command(s):

A) Replace OpenRouter as your default (use Claude subscription by default)
B) Keep OpenRouter as default, but add Anthropic as a fallback / occasional use
C) Keep them totally separate (cleanest): make a second agent just for Claude subscription

Also: don’t paste the setup-token into Discord (treat it like a password).

#

If you paste the output of claude setup-token (just whether it succeeds / errors — not the token itself) and then your new openclaw models status, I can confirm it’s wired correctly.

gilded flare
#

i am setting up the gateway on my mac terminal i have already generated a setup tokne. my openclw is currenly broken so i cant use it 2) Add Claude subscription auth (doesn’t touch OpenRouter config)
Generate token:
claude setup-token

Paste into OpenClaw (on the gateway host, sounds like your Mac):
Yes — you can proceed, and you don’t need to undo the bridge first.

The two things you must do to “stop using the bridge” are:

#

i completed 1 and 2 here are the results after i psted the token l Config overwrite: /Users/madsadmin/.openclaw/openclaw.json (sha256 072be07944f98191d8efb6a459a7aa2fc459f378e3aacc30d2d9c6dc2a9bbe2c -> 85a28ed2dc1196948cecbdef807c02556d67b388871d9f06979b9541c64b69ef, backup=/Users/madsadmin/.openclaw/openclaw.json.bak)
Updated ~/.openclaw/openclaw.json
Auth profile: anthropic:manual (anthropic/token)
madsadmin@Maddoxs-Mac-mini ~ % openclaw models list | grep anthropic
madsadmin@Maddoxs-Mac-mini ~ % openclaw models set anthropic/<one-of-the-model-ids-from-the-list>
openclaw models status
zsh: parse error near `\n'
madsadmin@Maddoxs-Mac-mini ~ %

burnt latchBOT
#

You can do the whole fix from your Mac Terminal, even if “chatting” in OpenClaw is currently broken.

Since you already have a setup-token, the next step is just to store it in OpenClaw’s auth profiles (don’t paste the token into Discord).

1) Paste the setup-token into OpenClaw (on the Mac)

Run this and it will prompt you to paste the token:

openclaw models auth paste-token --provider anthropic

(Alternative: this also just prompts for a token value)

openclaw models auth setup-token --provider anthropic

2) Confirm OpenClaw sees an Anthropic token now

#

Your grep anthropic came back empty because openclaw models list only shows “configured models” by default. You haven’t configured any anthropic/... models yet, so there’s nothing to grep.

Do this instead to see the full catalog and pick an Anthropic model ID:

openclaw models list --all --provider anthropic --plain | head -n 30

Then set the model by copy/pasting an exact line from that output, e.g.:

openclaw models set anthropic/<PASTE-A-MODEL-ID-HERE>
openclaw models status

Two important gotchas from what you pasted:

#
openclaw models status

You should no longer see “Providers w/ OAuth/tokens (0)” for everything.

3) Stop using the bridge: switch your default model to anthropic/...

Right now you’re configured for openai/claude-* (that’s the bridge). Switch to an Anthropic model:

openclaw models list | grep '^anthropic/'
openclaw models set anthropic/<paste-one-from-the-list>
openclaw models status

4) If the Gateway is the broken part, restart + check logs

#
  • The zsh: parse error happened because you literally typed anthropic/<one-of-the-model-ids-from-the-list> — in zsh, < and > are special. Don’t use angle brackets; paste a real model id.
  • Good news: your token is stored now as Auth profile: anthropic:manual (anthropic/token). Next step is just switching the default model away from openai/... (the bridge) to anthropic/....

If openclaw models list --all --provider anthropic --plain prints nothing, paste the output of:

openclaw models list --all --plain | head -n 60

and I’ll tell you what provider config is still forcing the “bridge” behavior.

#
openclaw gateway restart
openclaw logs --limit 200

One important gotcha from the docs: if you get an error like

“This credential is only authorized for use with Claude Code …”
then that setup-token won’t work for API calls and you’ll need an Anthropic API key instead.

If you paste the error output you get when running openclaw models auth paste-token --provider anthropic (redact token), I’ll tell you exactly what to do next.

gilded flare
#

madsadmin@Maddoxs-Mac-mini ~ % openclaw models list | grep anthropic
madsadmin@Maddoxs-Mac-mini ~ % openclaw models set anthropic/<one-of-the-model-ids-from-the-list>
openclaw models status
zsh: parse error near `\n'
madsadmin@Maddoxs-Mac-mini ~ % openclaw models status
~ % openclaw models status

🦞 OpenClaw 2026.2.15 (3fe22ea) — Meta wishes they shipped this fast.

Config : ~/.openclaw/openclaw.json
Agent dir : ~/.openclaw/agents/main/agent
Default : openai/claude-opus-4
Fallbacks (1) : openai/claude-sonnet-4
Image model : -
Image fallbacks (0): -
Aliases (3) : Opus -> openai/claude-opus-4, Sonnet -> openai/claude-sonnet-4, Haiku -> openai/claude-haiku-4
Configured models (3): openai/claude-opus-4, openai/claude-sonnet-4, openai/claude-haiku-4

Auth overview
Auth store : ~/.openclaw/agents/main/agent/auth-profiles.json
Shell env : off
Providers w/ OAuth/tokens (1): anthropic (1)

  • anthropic effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=1 (oauth=0, token=1, api_key=0) | anthropic:manual=token:sk-ant-o...6vYJ9ppy

Missing auth

  • openai Run openclaw configure or set an API key env var.

OAuth/token status

  • anthropic
    • anthropic:manual static
      madsadmin@Maddoxs-Mac-mini ~ % here is the status update. and all of the comands i have sent so far. give me the rest of the guide to get this set up
burnt latchBOT
#

You’re very close — the token part is done. What’s still “broken” is simply that your default model is still the OpenRouter bridge (openai/claude-opus-4), so OpenClaw keeps expecting openai auth.

Also: the zsh: parse error happened because you typed the placeholder with <...> — in zsh, < / > are special. You must paste a real model id.

Next steps (copy/paste)

3) Pick an Anthropic model id (show full catalog)

openclaw models list --all --provider anthropic --plain | head -n 30

4) Set Anthropic as the default model (NO angle brackets)

Pick one line from the list above and paste it, e.g. (example only):

openclaw models set anthropic/claude-sonnet-4-5
# or: openclaw models set anthropic/claude-opus-4-6
#

5) Remove the bridge as fallbacks (so it won’t get used)

Right now your fallbacks still point at openai/.... Clear them and add Anthropic fallbacks instead:

openclaw models fallbacks clear
openclaw models fallbacks add anthropic/claude-haiku-4-5
# optional second fallback:
openclaw models fallbacks add anthropic/claude-sonnet-4-5

6) (Optional but recommended) Re-point the Opus/Sonnet/Haiku aliases to Anthropic

This prevents old shortcuts from selecting the bridge:

openclaw models aliases remove Opus
openclaw models aliases remove Sonnet
#
openclaw models aliases remove Haiku

openclaw models aliases add Opus   anthropic/claude-opus-4-6
openclaw models aliases add Sonnet anthropic/claude-sonnet-4-5
openclaw models aliases add Haiku  anthropic/claude-haiku-4-5

7) Verify + restart gateway

openclaw models status
openclaw gateway restart

At this point, openclaw models status should show:

  • Default: anthropic/...
  • Fallbacks: anthropic/...
#
  • and ideally no “Missing auth - openai” (if it still shows, it means something still references openai/... — usually aliases/fallbacks).

8) Quick “does the token actually work?” test (optional)

This makes a tiny live request:

openclaw models status --probe --probe-provider anthropic --probe-max-tokens 32

If you paste the output of:

openclaw models list --all --provider anthropic --plain | head -n 30

I’ll tell you exactly which one to pick (best “default” choice) for your Claude Max use.

gilded flare
#

i am getting a 401 error HTTP 401 authentication_ │
│ │ │ error: Invalid bearer token │
│ │ │ (request_id: req_ │
│ │ │ 011CYE8eukzH8GaPTqaf5S79) │
└──────────────────┴────────────────────────┴────────────────────────────