Claude Max OAuth Setup
If you have a Claude Max subscription, you can use it with ClawHalla through OAuth authentication instead of paying for API calls separately. This gives you access to Claude Opus 4.6, Sonnet 4.6, and Haiku 4.5 through your existing subscription.
Setup Process
-
Get your setup token
Inside the ClawHalla container, run:
Terminal window claude setup-tokenThis will output a token. Copy it — you will need it in step 3.
-
Remove old authentication
Before adding Claude Max auth, clean up any existing API key authentication:
Delete the auth profiles file:
Terminal window rm -f ~/.openclaw/agents/main/agent/auth-profiles.jsonRemove
ANTHROPIC_API_KEYfrom.env:Terminal window # Comment out or delete the line:# ANTHROPIC_API_KEY=sk-ant-...Clean
openclaw.json:Remove any
apiKeyor old auth references from the models section in~/.openclaw/openclaw.json. -
Add Claude Max authentication
Terminal window openclaw models auth addWhen prompted:
- Select anthropic as the provider
- Select setup-token as the authentication method
- Paste the token from step 1
-
Restart the gateway
Terminal window # Kill the existing gatewaykill $(ps aux | grep openclaw-gateway | grep -v grep | awk '{print $2}')# Start freshnohup openclaw gateway > /tmp/openclaw-gateway.log 2>&1 &Wait about 15 seconds, then verify:
Terminal window curl -I http://localhost:18789Check that models are available:
Terminal window openclaw models statusYou should see Claude Opus 4.6, Sonnet 4.6, and Haiku 4.5 listed as available.
-
Set Opus 4.6 as the default model
Edit
~/.openclaw/openclaw.jsonand configure the models section:~/.openclaw/openclaw.json {"models": {"anthropic/claude-opus-4-6": {},"anthropic/claude-sonnet-4-6": {},"anthropic/claude-haiku-4-5": {}},"agents": {"defaults": {"model": {"primary": "anthropic/claude-opus-4-6"},"models": {"anthropic/claude-sonnet-4-6": {},"anthropic/claude-haiku-4-5": {}}}}}
Important Notes
baseUrl must NOT have /v1
When configuring the Anthropic provider, make sure the baseUrl does not end with /v1. The OpenClaw gateway appends the version path automatically.
// Correct"baseUrl": "https://api.anthropic.com"
// Wrong -- will cause 404 errors"baseUrl": "https://api.anthropic.com/v1"Auth profile format
After setup, your auth-profiles.json should look something like this:
[ { "id": "anthropic:setup-token", "provider": "anthropic", "type": "setup-token", "token": "..." }]Troubleshooting
”Model not available” after setup
-
Verify the auth profile was created:
Terminal window cat ~/.openclaw/agents/main/agent/auth-profiles.json -
Check gateway logs for authentication errors:
Terminal window tail -50 /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log -
Make sure the gateway was restarted after adding auth:
Terminal window openclaw status
“401 Unauthorized” errors
- Your setup token may have expired. Run
claude setup-tokenagain and repeat step 3. - Make sure you removed the old
ANTHROPIC_API_KEYfrom.env. Having both can cause conflicts.
Gateway refuses to start
Check if the old gateway process is still running:
ps aux | grep openclaw-gatewayKill it and try again:
kill $(ps aux | grep openclaw-gateway | grep -v grep | awk '{print $2}')nohup openclaw gateway > /tmp/openclaw-gateway.log 2>&1 &Models show but agent cannot use them
Verify the agent’s model assignment in openclaw.json:
cat ~/.openclaw/openclaw.json | grep -A3 '"model"'Each agent must reference a model that is available through the configured auth profile.
Token refresh
Claude Max tokens may need periodic refresh. If you start seeing auth errors after the system has been running for a while:
- Run
claude setup-tokenfor a new token - Run
openclaw models auth addagain - Restart the gateway