Rescue OpenClaw stuck? Gateway, auth, tunnel, and VPS troubleshooting. Get help →
← Back to Blog

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.

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

Next useful step

Read next

Caveman Mode for Claude Code: Cut Output Tokens 61-75% (2026)
Caveman Mode is a CLAUDE.md snippet that strips preambles, summaries, and filler to cut Claude Code output tokens 61-75% — about $100-140/month saved with no loss of code quality.
Restart Claude Code Sessions at 200K Tokens (Save Up to 80%) (2026)
Every Claude Code message resends the full conversation. Past 200K tokens the cost per message balloons. Restarting with a handoff doc cut one developer's bill from $1,600 to $320.
ENABLE_TOOL_SEARCH: Cut Claude Code's 45K-Token Tool Tax (2026)
By default Claude Code injects every tool definition each turn — about 45K tokens. ENABLE_TOOL_SEARCH lazy-loads them, dropping per-turn context to ~20K and saving $50-100/month.