Following up on the OpenRouter 401 issue. Here are the results of the three checks you suggested:
Setup: OpenClaw v2026.4.14 (control panel UI), WSL2 Ubuntu 24.04, Windows 11. Agent is Steve, running as systemd service.
Background: This morning Steve was asked to switch from OpenAI/Anthropic API to OpenRouter to reduce costs. During that process the gateway was stopped twice via SIGTERM and on restart Steve started throwing 401 Missing Authentication header on every model call.
1. openclaw gateway status
Runtime: running, RPC probe: ok. Gateway healthy.
2. openclaw models status --probe --probe-provider openrouter
Key findings:
- Default: openrouter/openrouter/auto (from openrouter/auto)
- Fallbacks: 0
- openrouter effective=profiles:auth-profiles.json | profiles=1 (api_key=1) | env=sk-or-v1...present | source=env: OPENROUTER_API_KEY
- Auth probe result: openrouter/openrouter/auto | openrouter:default (api_key) | ok · 30.7s
So the probe PASSES but Steve still gets 401s mid-session on every actual model call.
3. openclaw secrets audit --check
Key finding: OPENROUTER_API_KEY appears twice in ~/.openclaw/.env — could a duplicate entry cause the 401s Steve sees mid-session even though the probe passes?
Also noted: openrouter apiKey is stored plaintext in both openclaw.json and auth-profiles.json. models.json also has a codex apiKey entry.
Summary of the puzzle:
- Key is valid and active on openrouter.ai ✓
- Probe passes ✓
- Config references ${OPENROUTER_API_KEY} correctly ✓
- OPENROUTER_API_KEY appears twice in .env ?
- Steve cannot complete any model calls — 401 on every attempt ✗
What would cause the probe to pass but live model calls to fail with 401?