Support API key authentication for interactive mode on headless systems
Resolved 💬 2 comments Opened Mar 9, 2026 by pmolenaar Closed Apr 7, 2026
Problem
On a headless Raspberry Pi (no browser, no GUI), it's impossible to authenticate Claude Code for interactive mode. The OAuth flow requires a browser, which isn't available.
What works: claude -p "prompt" works fine with ANTHROPIC_API_KEY env var set.
What doesn't work: claude (interactive mode) always shows the login screen and requires browser-based OAuth, ignoring the ANTHROPIC_API_KEY environment variable.
Attempted workarounds (all failed)
- Setting
ANTHROPIC_API_KEYenv var — ignored by interactive mode claude login --api-key— unknown optionclaude auth login --method api-key— unknown optionapiKeyHelperin~/.claude/settings.json— still shows login screen- Text-based browser (lynx) — OAuth page requires JavaScript
- Device code flow (entering code on another machine) — hangs after entering code, never completes
claude config set --global apiProvider anthropic— doesn't skip login
Expected behavior
When ANTHROPIC_API_KEY is set, claude interactive mode should use it directly without requiring browser-based OAuth — the same way claude -p already does.
Environment
- Claude Code v2.1.71
- Raspberry Pi 4 (4GB RAM), Debian ARM64
- Headless (SSH only, no display/browser)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗