Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

spawn 子 agent 报 401: OpenRouter API key 未传递给 litellm

Open
#281 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
ai, api, backend

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

Bug 描述

使用 spawn 创建子 agent 时,子 agent 调用 litellm → OpenRouter 时报 401 User not found,无法正常执行任务。

根因分析

  1. Raven 主进程从 config.json 的 providers.openrouter.apiKey 读取 API key,主会话正常
  2. spawn 出的子 agent 通过 litellm 调用 LLM
  3. litellm 从环境变量 OPENROUTER_API_KEY 读取 API key
  4. 当前环境没有设置 OPENROUTER_API_KEY 环境变量
  5. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EverMind-AI/Raven

All issues in EverMind-AI/Raven

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.