401 Unauthorized / Invalid API Key
Error: 401 Unauthorized / Invalid API key / authentication_error
OpenClaw troubleshooting · Updated 2026
Error Message
Error: 401 Unauthorized / Invalid API key / authentication_error
What Causes This
Your API key is missing, expired, revoked, or misconfigured. This also happens when the key doesn't have sufficient billing credits (Anthropic requires at least $5 in credit purchases for API access).
How to Fix It
Verify and reset your API key:
# Run the doctor to check auth
openclaw doctor --fix
# Re-authenticate your provider
openclaw models auth setup-token --provider anthropic
# Verify the key works
openclaw test model
# Check the config has the right key
openclaw config get agent.model
Common causes: migrated from ClawdBot/Moltbot and old credential format persists (run openclaw doctor --fix to migrate), API key was regenerated on the provider's dashboard but not updated in OpenClaw, or trial credits expired. On macOS, Keychain access permissions can silently block credential retrieval.