Agent failed before reply: All models failed (2): custom-demo-hoha-ai-18124/Qwen...
🚨 错误信息
Agent failed before reply: All models failed (2): custom-demo-hoha-ai-18124/Qwen3: No API key found for provider "custom-demo-hoha-ai-18124". Auth store: /root/.openclaw/agents/main/agent/auth-profiles.json (agentDir: /root/.openclaw/agents/main/agent). Configure auth for this agent (openclaw agents add <id>) or copy auth-profiles.json from the main agentDir. (auth) | anthropic/claude-opus-4-6: No API key found for provider "anthropic". Auth store: /root/.openclaw/agents/main/agent/auth-profiles.json (agentDir: /root/.openclaw/agents/main/agent). Configure auth for this agent (openclaw agents add <id>) or copy auth-profiles.json from the main agentDir. (auth).
Logs: openclaw logs --follow
🤖 AI解决方案
报错分析报告
1.错误翻译
原文:No API key found for provider "custom-demo-hoha-ai-18124";No API key found for provider "anthropic"
译文:未找到提供商“custom-demo-hoha-ai-18124”的API密钥;未找到提供商“anthropic”的API密钥
2. 原因分析
auth-profiles.json)中配置custom-demo-hoha-ai-18124和anthropic两个提供商的API密钥。 /root/.openclaw/agents/main/agent/auth-profiles.json文件缺失目标提供商的密钥记录。3.解决方案
通过OpenClaw命令配置API密钥:
bash
为custom-demo-hoha-ai-18124提供商添加API密钥(替换YOUR_KEY为实际值)
openclaw agents add custom-demo-hoha-ai-18124 --api-key YOUR_KEY为anthropic提供商添加API密钥(替换YOUR_ANTHROPIC_KEY为实际值)
openclaw agents add anthropic --api-key YOUR_ANTHROPIC_KEY
或复制现有认证文件(若主目录有备份):
bash
cp /path/to/main/agentDir/auth-profiles.json /root/.openclaw/agents/main/agent/
4. 预防措施
openclaw agents add预配置所有依赖模型的API密钥,避免运行时缺失。 auth-profiles.json完整性。 ---
注:修复后可通过openclaw logs --follow验证日志是否正常。