OpenClaw plugin to view and switch Anthropic auth modes (OAT / API key) from chat.
/authβ Show current auth status (mode, base URL, masked keys)/auth oatβ Switch to OAT mode (officialapi.anthropic.com)/auth apiβ Switch to API mode (last used URL & key)/auth api <url> <key>β Switch to API mode with custom base URL and key- Auto-fallback β Automatically rotates to next auth profile on billing errors
- Error suppression β Suppresses billing error messages from reaching users
- Clone or copy the plugin to your server:
git clone https://github.com/rikouu/openclaw-auth-switch.git /opt/openclaw-auth-switch- Register in
openclaw.json:
{
"plugins": {
"allow": ["auth-switch"],
"load": {
"paths": ["/opt/openclaw-auth-switch/plugin"]
},
"entries": {
"auth-switch": { "enabled": true }
},
"installs": {
"auth-switch": {
"source": "path",
"sourcePath": "/opt/openclaw-auth-switch/plugin",
"installPath": "/opt/openclaw-auth-switch/plugin",
"version": "1.0.0"
}
}
}
}- Restart OpenClaw gateway.
Edit the constants at the top of plugin/index.ts to match your auth profile names:
const OAT_PROFILE = "anthropic:max20"; // your OAT profile name
const API_PROFILE = "anthropic:api"; // your API key profile name- Reads/writes
~/.openclaw/agents/main/agent/auth-profiles.jsonfor credentials - Updates
openclaw.jsonauth order and provider base URL on switch - Saves last-used API base URL to
~/.openclaw/auth-switch-state.json - After switching, send
/restartto apply changes
MIT