30成本/模型路由

L3P1

Anthropic 三档模型(2026-05 价格):

Haiku  $0.25 input / $1.25 output per M token  - 分类、autocomplete
Sonnet $3    input / $15   output per M token  - 主力 agent
Opus   $15   input / $75   output per M token  - 复杂推理

纯用 Sonnet 跑全流程是浪费。生产 harness 会做分层路由:

Haiku:分类("用户这句是问题还是指令?")、autocomplete 候选生成、permission 决策的快速判断、message 摘要。

Sonnet:主力 agent loop、tool use、code generation。

Opus:debug 卡住时升级、关键架构决策、Evaluator(高准确率需求)。

Cursor 内部:Haiku 做 inline autocomplete 候选,Sonnet 做 agent task,Opus 做 chat 模式的复杂问题。这一套能把同样产品的成本砍 50% 以上。

监控:每个 user task 的总成本、每个模型的调用次数、cache hit rate。warn 阈值:单 task > $0.50,单用户日 > $5。

速查
"怎么把 agent 成本降一半?"——三招叠加:(1) prompt caching 命中率拉到 80%+,(2) Haiku 做轻任务路由,(3) tool description 瘦身减少每次 input token。
参考: Anthropic Pricing(模型价格以官网为准)