Stop paying for API keys. If you already have a Claude Pro or Max subscription, you can run ClawdBot (OpenClaw) for free. Here's exactly how.
Make sure you have the following ready before starting:
There are two ways to authenticate Claude Code / ClawdBot:
Most guides tell you to use an API key — but if you already have a Pro or Max subscription, you're paying twice. The OAuth token method lets you use ClawdBot at no additional cost.
ANTHROPIC_API_KEY environment variable set, Claude Code will use it instead of your subscription — and you'll be charged API fees. Remove it to use your subscription.This step must be done on a machine with a web browser — not on your VPS.
curl -fsSL https://claude.ai/install.sh | bash
claude setup-token
Here's what happens:
SSH into your server:
ssh root@your-server-ip
openclaw models auth setup-token --provider anthropic
Paste the token when prompted.
export CLAUDE_CODE_OAUTH_TOKEN="your-token-here"
To make it permanent:
echo 'export CLAUDE_CODE_OAUTH_TOKEN="your-token-here"' >> ~/.bashrc
source ~/.bashrc
~/.bashrc manually when the token expires.openclaw gateway restart
Start OpenClaw if it's not already running:
openclaw gateway start
Or launch the TUI:
openclaw tui
Now test it:
Check your status:
openclaw status
This should show the model provider as Anthropic.
OAuth tokens expire periodically (usually every few weeks). When it happens, you'll see authentication errors in OpenClaw.
The fix takes 30 seconds:
claude setup-tokenopenclaw models auth setup-token --provider anthropic → paste the new tokenopenclaw gateway restartclaude setup-token, you can SSH into your VPS from Termius and access any machine that has a browser to generate the token.Check if you have an API key set:
echo $ANTHROPIC_API_KEY
If it returns a value, remove it:
unset ANTHROPIC_API_KEY
Also remove it from ~/.bashrc if it's saved there, then reload:
source ~/.bashrc
Make sure you're using the correct variable name:
CLAUDE_CODE_OAUTH_TOKENANTHROPIC_AUTH_TOKENRestart your terminal session:
source ~/.bashrc
That's expected — your VPS has no browser. Run claude setup-token on your local PC/Mac, then transfer the token to your VPS.
Your token has expired. Follow Step 5 above to refresh it.
Update OpenClaw to the latest version:
npm update -g openclaw@latest
claude — the browser handles everything automatically.claude setup-token locally → copy the token → run openclaw models auth setup-token --provider anthropic on your server.Join the Vibe Coding Academy community to learn how to build AI-powered apps, automate your workflow, and level up your skills.
Join the Academy