bestmodelfor.ai
Data updated 2026-10-18USD/CNY 6.6862 ECB 2026-10-1639 official prices · 27 plans · 20 tips

← Tool tips

Verified Claude Code

Cap script spend with --max-budget-usd, but leave headroom

What it does

--max-budget-usd only works with -p. In our test a 0.05 USD cap was exceeded on the very first turn (cold prompt cache, ~0.105 USD) and the run ended as an error with no result. Leave headroom for the first-turn cache cost.

How

claude -p "..." --output-format json --max-budget-usd 0.5

is_error: true in the result means the cap was hit.

How much to trust this

Applies to≥ 2.0.28
VerifiedOct 17, 2026 · v2.1.296 · tested locally
本机实测:0.05 美元上限在第一轮被突破(花费约 0.105,is_error=true)
Depends on--max-budget-usd-p
Source