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

Use -p with JSON output in scripts to get the cost of each run

What it does

Non-interactive -p with --output-format json returns total_cost_usd, is_error and num_turns, handy for batch jobs and cost tracking.

How

claude -p "Summarize this repo's README" --output-format json

Read result and total_cost_usd from the JSON.

How much to trust this

Applies to≥ 2.0.28
VerifiedOct 17, 2026 · v2.1.296 · tested locally
本机实际运行,返回 JSON 含 total_cost_usd
Depends on-p--output-format
Source