今日已更新 305 条资讯 | 累计 19865 条内容
关于我们

Adaptive Thinking Killed My Token Budget Code: Migrating Off budget_tokens

Pavel Espitia 2026年07月14日 23:36 2 次阅读 来源:Dev.to

I had a tidy little helper that computed a thinking budget based on input size. Something like "give the model 30% of the context as thinking room." It worked great on Opus 4.5. Then I tried to point it at Opus 4.8 and got a 400. The whole concept I had built around is gone in the current models. Here is what replaced it and how I migrated. What broke The old pattern looked like this: // Opus 4.5 and earlier const response = await client . messages . create ({ model : " claude-opus-4-5 " , max_tokens : 16000 , thinking : { type : " enabled " , budget_tokens : 8000 }, messages , }); On Opus 4.7, 4.8, and Fable 5, thinking: { type: "enabled", budget_tokens: N } returns a 400. The fixed token budget is dead. The replacement is adaptive thinking, where the model decides how much to think, plus an effort knob that controls overall token spend. // Opus 4.8 const response = await client . messages . create ({ model : " claude-opus-4-8 " , max_tokens : 16000 , thinking : { type : " adaptive " }, output_config : { effort : " high " }, // low | medium | high | xhigh | max messages , }); Why this is actually better (after I got over it) My old budget code was a guess dressed up as a calculation. I had no real basis for "30% of context." I picked it because it felt reasonable and the outputs looked fine. Adaptive thinking moves that decision to the model, which sees the actual problem. The mental model shift: budget_tokens controlled how much the model could think. effort controls how much it thinks and acts . They are not the same axis, so there is no clean 1:1 mapping. I stopped trying to translate "8000 tokens" into an effort level and instead picked based on the workload. How I chose effort levels After running my own evals, here is where I landed: Workload Effort Notes Classification, routing low Fast, scoped, not intelligence-sensitive Most app traffic medium to high The balance point Coding and agentic loops xhigh Best for these; it is the Claude Code default Correctness

本文内容来源于互联网,版权归原作者所有
查看原文