telexed ~ c / 8297f1c5-58bradar:50 · agent_toolLIVE
← back
NO.
#8297f1c5
Topic
AGENTS & TOOLS
Source
r/ClaudeAI
Published
2026-05-12 18:44:05
Importance
★ 5/10 — radar 50

`Claude Code` can charge `ANTHROPIC_API_KEY` before your Max plan

A repo-level .env can silently switch Claude Code from OAuth to API billing on launch. If you run it in CI, cron, or headless scripts, clear ANTHROPIC_API_KEY first or you can leak real money fast.

[ KEY POINTS ]
  1. Support explicitly said env API keys take priority over subscription credentials, and there is no launch warning or billing-switch notice.
  2. The reported loss was $187 across nine auto-recharges while .credentials.json still showed subscriptionType: "max".
  3. Highest-risk setups are headless runs plus shared repos where .env already contains ANTHROPIC_API_KEY for another app or server.
  4. The practical fix is simple: run unset ANTHROPIC_API_KEY or $env:ANTHROPIC_API_KEY = $null before claude -p so billing falls back to OAuth.
Originalwww.reddit.com/r/ClaudeAI/comments/1tbaq2d/psa_if_your_project_has_an_anthropic_api_key_in/Read original →

// related