Maliyet ve Performans Orta
Bütçe Sınırı Davranışı
--max-budget-usd'nin nasıl çalıştığını anlayın: turlar arasında kontrol edilir, üretim ortasında değil
Komut
"color:#9CA3AF;font-style:italic"># This $0.001 budget will be overshot: $ "color:#7C5CFC">claude -p "Write a detailed essay" "color:#d97757">--output-format json "color:#d97757">--max-budget-usd 0.001 "color:#9CA3AF;font-style:italic"># Result: $0.152 actual spend (152x overshoot!)
Yanıt
{
"subtype": "error_max_budget_usd",
"is_error": false,
"total_cost_usd": 0.152,
"result": "",
"modelUsage": {
"claude-opus-4-6": { "outputTokens": 5446, "costUSD": 0.152 }
}
} Ayrıştırma Kodu
059669">">const data = JSON.parse(output); 059669">">if (data.subtype === 059669059669">">'error_max_budget_usd') { 059669">">// Controlled stop, not a crash (is_error: false) 059669">">console.warn(059669">`Budget exceeded: $${data.total_cost_usd}`); // result may be empty — the turn that exceeded was the last }
Tuzaklar
! $0.001 bütçe $0.15 gerçek harcamaya yol açabilir — bütçe üretim ortasında değil turlar ARASINDA kontrol edilir
! Minimum Opus çağrısı sistem prompt yükü nedeniyle yaklaşık $0.016'dır — bunun altında bütçe ayarlamak her zaman başarısız olur