#401 Missing Authentication header
1 messages Β· Page 1 of 1 (latest)
That specific OpenRouter error usually means the Gateway is calling OpenRouter without an API key header.
Quick fix checklist:
- First, confirm version:
openclaw --version
- Confirm auth/model state:
openclaw models status
- Make sure your model ref is OpenRouter-style (with provider prefix), e.g.:
openrouter/anthropic/claude-sonnet-4-6
- Make sure the key is visible to the Gateway process (not just your shell).
If you run as a service, put it in:
~/.openclaw/.env
with:
OPENROUTER_API_KEY=sk-or-...
- Restart and test:
openclaw gateway restart
openclaw models status
If you want to reconfigure in one shot, this is the official setup command:
openclaw onboard --auth-choice apiKey --token-provider openrouter --token "$OPENROUTER_API_KEY"
Docs:
- OpenRouter: https://docs.openclaw.ai/providers/openrouter
- Env loading / precedence: https://docs.openclaw.ai/help/environment
- FAQ (debug flow): https://docs.openclaw.ai/help/faq
If you paste openclaw models status (redact secrets), I can pinpoint exactly whatβs missing.
Config : ~/.openclaw/openclaw.json
Agent dir : ~/.openclaw/agents/main/agent
Default : openrouter/anthropic/claude-haiku-4.5
Fallbacks (0) : -
Image model : -
Image fallbacks (0): -
Aliases (1) : OpenRouter -> openrouter/auto
Configured models (2): openrouter/auto, openrouter/anthropic/claude-haiku-4.5
Auth overview
Auth store : ~/.openclaw/agents/main/agent/auth-profiles.json
Shell env : off
Providers w/ OAuth/tokens (0): -
- openrouter effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=1 (oauth=0, token=0, api_key=1) | openrouter:default=<token>
OAuth/token status
- none