"openrouter api 401 user not found"
OpenRouter returns 401 'User not found' when the request arrives with the wrong key. In tools like Hermes this is usually key drift, a stale key from a previous provider, not a revoked key. Remove stale keys from ~/.hermes/.env, confirm your config points to OpenRouter with the matching key, and verify it with curl before regenerating.
Likely cause
OpenRouter returns 401 'User not found' when the request arrives with the wrong key. In tools like Hermes this is usually key drift - a stale key from a previous provider - rather than a revoked key. Outside Hermes, the usual causes are a key that was revoked, a key generated under a different OpenRouter account, or a raw provider key (Anthropic, OpenAI) sent to OpenRouter's endpoint.
The fix
- 1 Check ~/.hermes/.env (or your tool's key store) and remove stale keys from other providers.
- 2 Confirm the active config points to OpenRouter with the matching key.
- 3 Verify the key directly with curl; regenerate it in the OpenRouter dashboard only if curl also fails, then retry.
- 4 If you regenerate, do it at openrouter.ai/keys while logged into the right account, confirm the new key starts with sk-or-, and make sure the account has credits if you are calling a paid model.
curl -H "Authorization: Bearer $OPENROUTER_API_KEY" https://openrouter.ai/api/v1/modelsHit a different error?
Paste any agent error and get the cause and fix in seconds.
Frequently asked questions
My OpenRouter key works in curl but Hermes returns 401. Why?
This is the documented key-drift case (issue #14637). Hermes is sending a stale key from a previous provider config, not your OpenRouter key. Clear old keys from ~/.hermes/.env and confirm the active provider matches.
Should I regenerate my OpenRouter key?
Only if curl with that key also fails. If curl succeeds, the key is valid and the problem is in how your tool resolves credentials, not the key itself.
How do I confirm config and key match?
Check that the provider in your config is OpenRouter and that the OPENROUTER_API_KEY in your key store is the one being sent. A mismatch between provider, model format, and key is the usual cause of 401.
Why does my OpenRouter key start with sk-or- instead of sk-ant- or sk-?
That is normal. An OpenRouter key never looks like an Anthropic or OpenAI key. If you paste an OpenRouter key into a tool that expects a raw provider key, or a provider key into a tool pointed at OpenRouter, you get a 401 rather than a billing error. Match the key to the endpoint.
Stop firefighting agent errors
Decoding errors one at a time is the manual version of what BetterClaw automates. Run your agents on a no-code AI agent platform with managed models, retries and config validation built in.
Free plan available · Pro $49/mo · BYOK · 7-day money-back guarantee
