cron Jobs Running claude -p May Be Billed via API, Not Subscription
12/03/2026 — 12/03, 20:18·1 sources (all)·1 reports (all)
Key takeaways
- A developer write-up warns that Claude Code picks up ANTHROPIC_API_KEY whenever it is present in the environment, and non-interactive -p run…
Background & analysis
On December 3, 2026, a developer post on DEV Community described a billing pitfall for people running claude -p from cron while on a Pro or Max plan. According to the post, the usual cause of an unexpected API bill is that ANTHROPIC_API_KEY is set in the environment where the command runs.
Claude Code selects a single credential when several are available, following a fixed order, and ANTHROPIC_API_KEY ranks above the subscription login obtained through /login. In interactive mode, the tool asks once whether to use the key; in non-interactive mode such as -p, it does not ask. As a result, a scheduled cron job can end up billed through the API rather than drawing on the Pro or Max subscription.
The post suggests two fixes: remove the key from that command line, or switch to a CLAUDE_CODE_OAUTH_TOKEN generated by setup-token. The report reflects the developer's account only; the material contains no response from Anthropic and no further developments, so the matter currently rests at this explanation and the two suggested workarounds.
AI-generated from 1 reports · updated 2 days ago
Related AI tools
- Heat index
- 25
- All sources
- 1
- All reports
- 1
- First seen
- 2 days ago
Reports on this story headlines open the original
If you run claude -p from cron on a Pro or Max plan and still see API charges, the cause is usually an ANTHROPIC_API_KEY set in that environment: Claude Code prefers the key over your subscription login and never asks in non-interactive mode. Unset the key for that command or switch to a setup-token instead.
DEV Community · AIAI score 63
Other stories people are talking about
- Heat index 49Claude Code limits are token-based; author suggests Haiku or API for heavy use1 sources
- Heat index 40Anthropic Publishes 47-Page Report on Claude Use and Well-Being1 sources
- Heat index 95SurgeAnthropic says Claude produced a counterexample to the invariant subspace problem1 sources
- Heat index 44Developer compares prompt caching in Claude and OpenAI1 sources
- Heat index 39claude-guard proxies Claude Code to mask sensitive terms locally1 sources
How is heat calculated?About the methodHide
Heat counts how many independent sources covered a story in the last 48 hours: one source counts once no matter how many posts it published, decaying with a 24-hour half-life. What ranks first is what many people are talking about.
This page aggregates public feeds. Headlines and summaries are machine-organized and remain the property of the original authors; verify important facts at the source. If you believe a headline or summary infringes your rights, email the contact address in the footer with the page URL and basis of your claim, and we will remove or replace it after review.
- Surge
- Discussion rising fast
- New
- First report within 6 hours
- Rising
- Still gathering discussion

