Fixing OpenClaw OpenRouter API Key Error | Generated by AI
Question: What does this error mean and how do I fix it: “No API key found for provider ‘openrouter’. Auth store: /root/.openclaw/agents/main/agent/auth-profiles.json”?
Answer:
This error comes from OpenClaw, an AI agent framework, and means it cannot find an API key configured for the OpenRouter provider. Here’s what’s happening and how to fix it:
What’s Going On
OpenClaw stores provider credentials in a JSON file at:
/root/.openclaw/agents/main/agent/auth-profiles.json
The agent tried to start but found no OpenRouter API key in that file, so it aborted before it could reply.
How to Fix It
Option 1: Use the OpenClaw CLI to add credentials (recommended)
openclaw agents add main
This command should prompt you to enter your OpenRouter API key interactively and save it to the auth profile.
Option 2: Manually edit auth-profiles.json
- Open the file:
nano /root/.openclaw/agents/main/agent/auth-profiles.json - Add your OpenRouter key in the expected format (typically something like):
{ "openrouter": { "api_key": "sk-or-..." } }(The exact schema may vary — check OpenClaw’s documentation for the correct structure.)
- Save and retry running the agent.
Option 3: Copy auth from the main agent directory
The error message hints at this:
cp /root/.openclaw/agents/main/auth-profiles.json \
/root/.openclaw/agents/main/agent/auth-profiles.json
Use this if you already configured credentials in the parent directory but they weren’t propagated to the agent subdirectory.
Getting an OpenRouter API Key
If you don’t have one yet:
- Go to https://openrouter.ai
- Sign up or log in
- Navigate to Keys in your account dashboard
- Create a new key (starts with
sk-or-...)
Check the Logs
For more detail on the failure, run:
openclaw logs --follow
This may reveal additional context about what the agent was trying to do when it failed.