Skip to content

fix: pass Anthropic API key from config to SDK subprocess - #16

Merged
pufit merged 1 commit into
ClickHouse:mainfrom
nikita-vanyasin:fix/pass-api-key-to-sdk
Mar 28, 2026
Merged

fix: pass Anthropic API key from config to SDK subprocess#16
pufit merged 1 commit into
ClickHouse:mainfrom
nikita-vanyasin:fix/pass-api-key-to-sdk

Conversation

@nikita-vanyasin

Copy link
Copy Markdown
Member

Summary

  • The API key in config.local.yaml was only used for direct HTTP calls (session title generation) but never passed to the Claude Agent SDK subprocess via its env parameter
  • This caused Could not resolve authentication method errors unless ANTHROPIC_API_KEY was separately set in the shell environment
  • Pass effective_api_key through ClaudeAgentOptions.env so config.local.yaml is the single source of truth

Test plan

  • Start Nerve withoutANTHROPIC_API_KEY in the environment, with the key only in config.local.yaml
  • Send a message via Telegram or web UI
  • Verify the agent responds (no authentication errors in nerve.log)

🤖 Generated with Claude Code

The API key configured in config.local.yaml was only used for direct
HTTP calls (e.g. session title generation) but never passed to the
Claude Agent SDK subprocess. This caused authentication failures when
ANTHROPIC_API_KEY was not set in the environment.
Pass effective_api_key via the SDK's env parameter so config.local.yaml
is the single source of truth for API credentials.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@nikita-vanyasin@pufit