Skip to content

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

  1. Get your setup token

    Inside the ClawHalla container, run:

    Terminal window
    claude setup-token

    This will output a token. Copy it — you will need it in step 3.

  2. 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.json

    Remove ANTHROPIC_API_KEY from .env:

    Terminal window
    # Comment out or delete the line:
    # ANTHROPIC_API_KEY=sk-ant-...

    Clean openclaw.json:

    Remove any apiKey or old auth references from the models section in ~/.openclaw/openclaw.json.

  3. Add Claude Max authentication

    Terminal window
    openclaw models auth add

    When prompted:

    • Select anthropic as the provider
    • Select setup-token as the authentication method
    • Paste the token from step 1
  4. Restart the gateway

    Terminal window
    # Kill the existing gateway
    kill $(ps aux | grep openclaw-gateway | grep -v grep | awk '{print $2}')
    # Start fresh
    nohup openclaw gateway > /tmp/openclaw-gateway.log 2>&1 &

    Wait about 15 seconds, then verify:

    Terminal window
    curl -I http://localhost:18789

    Check that models are available:

    Terminal window
    openclaw models status

    You should see Claude Opus 4.6, Sonnet 4.6, and Haiku 4.5 listed as available.

  5. Set Opus 4.6 as the default model

    Edit ~/.openclaw/openclaw.json and 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:

~/.openclaw/agents/main/agent/auth-profiles.json
[
{
"id": "anthropic:setup-token",
"provider": "anthropic",
"type": "setup-token",
"token": "..."
}
]

Troubleshooting

”Model not available” after setup

  1. Verify the auth profile was created:

    Terminal window
    cat ~/.openclaw/agents/main/agent/auth-profiles.json
  2. Check gateway logs for authentication errors:

    Terminal window
    tail -50 /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log
  3. 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-token again and repeat step 3.
  • Make sure you removed the old ANTHROPIC_API_KEY from .env. Having both can cause conflicts.

Gateway refuses to start

Check if the old gateway process is still running:

Terminal window
ps aux | grep openclaw-gateway

Kill it and try again:

Terminal window
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:

Terminal window
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:

  1. Run claude setup-token for a new token
  2. Run openclaw models auth add again
  3. Restart the gateway