Fix the claude -p $1,800 API Bill Trap (2026)
The `claude -p` print-mode flag silently bills through the API even when you are on a paid Max or Pro plan. One documented overnight run turned a $200 subscription into an $1,800 API bill.
Bleeding money on Claude Code or OpenClaw?
We apply the full cost checklist live and set up monitoring. See training and cost-audit options →
The fix in one line: before any claude -p call, check claude config get auth.mode. If it returns subscription, do not use -p unless you explicitly want API billing — the flag routes through the metered API regardless of your plan. For scripted workflows, either run interactive mode through a pseudo-tty or set a hard cap with --max-budget-usd. GitHub issue #37686 documents the $1,800 overnight incident.
Why claude -p bills your card
claude -p (print mode) is designed to run non-interactively and pipe output, which is why it uses API billing — even if you have a Max or Pro subscription active. It is not a bug in the traditional sense; the flag is documented to use API mode. The problem is that almost nobody reads that line, so an overnight or looped -p run quietly racks up metered API charges against your credit card instead of drawing on your flat-rate plan.
The scary version is a script that loops claude -p unattended. By morning you can be thousands of dollars in, with no cap in place to stop it.
Check your auth mode before every -p run
claude config get auth.mode # Returns: "subscription" or "api"
If it says subscription and you run -p, you are about to pay per-token on top of your plan. The rule: on a subscription, never use -p unless you actually want API billing.
Put a hard cap on any run
Even once you know the rule, add a circuit breaker so a bad loop can never destroy your budget:
claude --max-budget-usd 5.00 --agent ship-feature
The flag aborts the run when the cost crosses $5. Pair it with ccusage (npx ccusage@latest) in your statusline so the running dollar amount is always visible, and with workspace rate limits in the Anthropic Console for a second layer.
OpenClaw users: any agent you wire to Claude through the OpenClaw gateway inherits the same auth mode and flags. Check auth.mode on the host and avoid -p in scheduled OpenClaw jobs unless you have set a budget cap.
Related cost guides
- OpenClaw Costs Guide (all 10 fixes) — the full cost-optimization hub
- Caveman Mode for Claude Code — cut output tokens 61-75%
- Restart Claude Code sessions at 200K tokens — the up-to-80% behavior fix
Need help?
If you have already been burned or want a spending-safe setup, we audit your Claude Code / OpenClaw config, apply the top fixes, and add cost monitoring in one session. See training and cost-audit options →
Get guides like this in your inbox every Wednesday.
No spam. Unsubscribe anytime.
You'll probably need this again.
Press Cmd+D (Mac) or Ctrl+D (Windows) to bookmark this page.
Need OpenClaw fixed live?
Remote rescue sessions for gateway, auth, tunnel, VPS, and model access problems.
See Rescue Session