spawn 子 agent 报 401: OpenRouter API key 未传递给 litellm
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
Research direction
Start by tracing the spawn child-agent entry point and how config.json values under providers..apiKey are passed to litellm. Reproduce with the OpenRouter setup and inspect the session log at ~/.raven/workspace/sessions/sub/2064bdc3.jsonl. Done means spawned agents receive the provider-specific environment key and the reported 401 no longer occurs.
Written by the indexing model from the issue text.
Description
Bug 描述
使用 spawn 创建子 agent 时,子 agent 调用 litellm → OpenRouter 时报 401 User not found,无法正常执行任务。
根因分析
- Raven 主进程从
config.json的providers.openrouter.apiKey读取 API key,主会话正常 spawn出的子 agent 通过litellm调用 LLMlitellm从环境变量OPENROUTER_API_KEY读取 API key- 当前环境没有设置
OPENROUTER_API_KEY环境变量 - litellm 带着空 key 发请求 → OpenRouter 返回
401 User not found
复现步骤
raven config 中 provider 设置为 openrouter
执行任意 spawn 操作
→ 子 agent 立即报错: 401 User not found
日志
~/.raven/workspace/sessions/sub/2064bdc3.jsonl:
{"role": "assistant", "content": "Error calling LLM: litellm.AuthenticationError: AuthenticationError: OpenrouterException - {\"error\":{\"message\":\"User not found.\",\"code\":401}}"}
建议修复
spawn 子进程时,应该将 providers.<provider>.apiKey 注入为对应 provider 的环境变量:
- OpenRouter →
OPENROUTER_API_KEY - Anthropic →
ANTHROPIC_API_KEY - OpenAI →
OPENAI_API_KEY
临时 workaround
export OPENROUTER_API_KEY=$(raven config show | python3 -c "import json,sys; print(json.load(sys.stdin)['providers']['openrouter']['apiKey'])")
环境
- Raven v0.1.10 / macOS arm64 / Python 3.12.13
- Provider: OpenRouter (deepseek-v4-pro)
- Dominant language
- Python
- Stars
- 4.1k
- Forks
- 94
- Avg merge
- 10h 2m
- Merged PRs (30d)
- 376
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EverMind-AI/Raven
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
EverMind-AI/Raven#798 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
EverMind-AI/Raven#797 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
EverMind-AI/Raven#640 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
EverMind-AI/Raven#479 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
EverMind-AI/Raven#474 · 2 comments ·
Maintainers usually reply within 1 day
All issues in EverMind-AI/Raven
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
kornia/kornia#5263 · 1 comment ·
Maintainers usually reply within 1 day
-
approved correction metadata
Difficulty 1/5 Under an hour Newbie friendliness 88/100
acl-org/acl-anthology#10133 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
BasedHardware/omi#20084 ·
Maintainers usually reply within 1 day
-
bug needs-acceptance wg/evaluation-quality
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
vllm-project/semantic-router#4424 ·
Maintainers usually reply within 1 day