外部精选
What a task costs on Opus 5.5
本文来自外部来源,不是黄奕彬的原创文章。本站提供原文入口,并在采集端生成 AI 结构化摘要、解读与中文翻译(如有),一切以原文为准。
阅读原文(claude.dev)结构化摘要 AI 生成
背景与问题
面向使用 Claude Code 的开发者:用户买的是「完成任务」而不是 token,token 数只是模型为达成目标消耗的结果。两个单价相同的模型,因轮次与重试不同,同一任务总价可以差很多。文章要回答三个问题:典型任务在 Opus 5.5 上花多少钱、哪些设置影响成本及幅度、如何自查会话用量。前提是按 API 片价与计费机制推算,数字含演示成分。
方法或内容
拆解 Claude Code 任务循环的四个成本因子:
- 轮次:每轮重发至今全部会话,轮次越少输入越少
- 缓存读:大部分重发内容按远低于输入价的缓存读计费
- 输出 token:单价为输入价 5 倍,thinking 计入输出
- 模型:决定每个 token 的单价
以 Opus 5.5 API 片价(输入 $4/M、输出 $20/M、缓存读 $0.20/M)构造可交互示例,含两模型同 token 数对比(Fig B/C)、effort 阶梯、选模型、prompt-audit、缓存与压缩等省费建议,并给出用 /usage 实测的方法。
关键发现 / 结果
- 示例任务:上下文 20K→120K,40 轮约 2.8M 输入、90% 缓存命中约 $1.62;25 轮约 1.75M、约 $1.02;同一 2.8M 无缓存要 $11.20,96% 命中约 $0.99
- 60K 输出计 $1.20;输出 token 单价为缓存读的 100 倍
- 对比
Opus 5:输入/输出降 20%,缓存读降 60%(读率从输入价 1/10 降至 1/20);订阅限额约多用 25%;Pro/Max/Team/按席 Enterprise 的 5 小时限额上调,另有可自选时机的限额重置(Settings > Usage) - 同 token 数会话 $3.50→$2.40(约 −31%);按 10 任务/天、22 工作日折算每月省 $242(仅价格因素)
- 「运行成本低 40%」为估算:默认 medium 下每任务用更少 token 叠加降价,非单价降 40%
- 迁移基准(44 工单,
Opus 4.8→Opus 5.5低 effort)省约 18%,prompt-audit再省 9% - 企业均值约 $13/开发者/活跃日,90% 用户低于 $30/日
结论与意义
作者结论:任务成本由工作形态(轮次数、缓存命中率、输出量)决定的程度不亚于单价;一切省 token 的手段都可能以一次重试为代价,需要权衡。适用边界:文中数字多为片价推算或单一基准,作者反复强调要在自己的代码库实测——跑同一任务对比两模型的轮次、输出与 /usage 成本,并称这是最重要的一条。
AI 解读 AI 生成
方法:按「时空变量」分析(时间 / 空间 / 变量,严格区分包含、相关与因果),对象包括原文作者、署名人员与关键技术及其实际原理;结论用「元反空」(元思考、反思考、空思考、综合)整理。
时间:何时发生,现在是否仍成立
来源日期为 2026-09-25 12:00 UTC,即北京时间 2026-09-25 20:00。文中多处价格标注「按今日定价」(如缓存写费率、fast mode),企业日均花费也注明「针对当前模型」,说明具体数字随定价与模型迭代可能过期。
计费机制本身(每轮重发、前缀缓存、thinking 计入输出)在机制未变的前提下现在仍可能成立,但应以官方 docs 为准。
空间:谁的环境 / 场景
适用于在 Claude Code 中用 Opus 5.5(需 v2.1.280 或更高版本)跑 agent 循环任务的开发者;计价基于 API 片价。也覆盖 Pro/Max/Team/Enterprise 订阅用户(限额视角,非账单)。
在 Amazon Bedrock、Google Cloud Agent Platform 或 Claude apps gateway 上部分结论不同,如切换 effort 会清空缓存。示例形态假设典型长会话、高缓存命中。
变量:实际改变了什么
相对 Opus 5 实际改变的有:
- 价格:输入/输出降 20%,缓存读降 60%,读率从输入价的 1/10 降至 1/20
- 订阅:限额约多用 25%;Pro/Max/Team/按席 Enterprise 的 5 小时限额上调,合格订阅者获一次可自选时机的限额重置(Settings > Usage)
- 行为:
Opus 5.5回复前总是思考;默认 effort 由 high 改为 medium(同档位每轮思考多于Opus 5);长任务结束时输出改动/发现/所需事项的报告
区分:包含 ≠ 相关 ≠ 因果
有明确机制或因果证据的:轮次多→输入多(每轮重发);缓存命中率高→输入便宜;超时、换模型、改工具定义/系统提示、压缩、云平台上改 effort→触发缓存重写;thinking 是输出的一部分,故 effort 抬高账单。
仅为相关或估算、无因果保证的:「省 40%」假设默认档每任务 token 更少,随任务而异;prompt-audit 的 18%/9% 来自单一基准(44 工单),作者明言是示例;−31% 基于演示 token 数与 91% 命中率。结尾报告「可以省钱」(减少重跑)是作者推断,未给数据。
对象:作者/署名与关键技术原理
作者/署名:Addy Osmani(仅来自结构化署名字段;字段重复列出同一姓名。正文另致谢审阅者 Michael Segner、Kacie Jenkins、Molly Vorwerck,非署名作者)
- 任务循环:模型读会话→调工具→读结果,循环至完成;每轮重发至今全部会话,这是成本随轮次增长的机制
- prompt caching:按前缀命中;
Opus 5.5上读为输入价 5%,写为 1.25×(5 分钟)或 2×(1 小时)输入价,命中免费续期 - effort 档位:low/medium/high/xhigh 加单会话 max,决定每轮思考、文本与工具调用的花费
- 测量与控制命令:
/usage(同/cost)、/effort、/model、/compact、/clear、/autocompact、/rewind、claude update、/claude-api prompt-audit - subagent:各自上下文窗口、回传摘要,可用
CLAUDE_CODE_SUBAGENT_MODEL设模型;fast mode 最高 2.5 倍速、2 倍价
元反空综合结论
元:本文明面在算账,本质解决「agent 编程的单位经济」——把任务成本拆成可操作杠杆(轮次、缓存、输出、模型、effort),使人能预测并控制开销。
- 反:最可能失效或有边界的主张——一切标注「今日定价」的费率(片价本身、缓存写、fast mode);−31% 与每月 $242 依赖演示 token 数与 91% 命中率;「省 40%」建立在默认档 token 更少的假设上,开放性任务差异最大但无保证;
prompt-audit收益来自单一基准(44 工单);云平台上切 effort 清缓存,相关建议不适用。 - 空:去掉叙事后剩余的必要事实——
Opus 5.5/Fable 5.1片价表、缓存读写计费规则、effort 默认 medium、任务循环每轮重发全上下文、/usage等测量手段存在。 - 综合:这是一份机制扎实的成本控制指南,其框架(四因子+实测法)比任何具体数字更耐久;作者自己也把「跑一个真实任务并对比
/usage」列为最重要建议。
中文译文 AI 生成
一个任务的成本,与一次重试的成本
你一开始想买的并不是几百万个 token。你想要的是实现一个功能、完成一次迁移,或者跑一个任务。token 数量只是模型完成这些事所需要消耗的部分。
单价相同的两个模型,在同一个任务上的花费可能相差很大。一个把代码读一遍。另一个读了代码、尝试修复、再读一遍。这些步骤中的每一步都是一轮,而每一轮都会重新发送到目前为止的整个对话。所以需要更多轮的模型花费更多,即使单价相同。
读完这篇文章,你应该能回答关于你自己工作的三个问题:
- 我在 Opus 5.5 上的典型任务花费多少?
- 哪些设置会改变这一点,改变多少?
- 我如何查看自己的会话用量?
我想先说明一个权衡:每一种省 token 的方式,都可能让你付出任务无法完成的代价。更低的 effort、更小的模型或更少的上下文,确实都能省 token。但一次重试的花费会超过这些节省。这篇文章试图给每个权衡标上价格。
这里有些数字是牌价,有些是基于牌价构建的示意。图中的数据是可交互的,阅读时可以自行修改输入。这些是尽力而为的示意,请务必查阅我们的文档并核对你自己 的计算。
一个任务花费多少?
Claude Code 中的一个任务是一个循环。模型读取对话,调用工具,读取结果,然后不断循环直到完成。每绕循环一圈就是一次请求。有四个因素决定这个循环的成本。
- 轮数。每一轮都会重新发送到目前为止的整个对话。轮数越少,处理的输入就越少。
- 缓存读取。一轮重新发送的内容,大部分是模型在上一轮已经看过的文本。它按缓存读取计费,价格只有输入价格的一小部分。
- 输出 token 类型。最贵的 token,是输入价格的五倍。Thinking 按输出计费,所以一个在得出答案前推理更少的模型花费更少。
- 模型。每个模型有自己的价格,列在定价页面上,所以你选择的模型决定了每个 token 的价格。
我们的示例使用 Opus 5.5 的 API 牌价:每百万输入 token $4,每百万输出 token $20,每百万缓存读取 $0.20。和下文的计算器一样,示例将缓存输入按读取价格计费,其余按输入价格计费,且不含缓存写入。token 数量为示意值。
轮数
假设一个任务以 20K token 的上下文开始,随着模型读取文件和工具结果增长到 120K。在 40 轮时,平均每轮发送约 70K token。整个任务约需 2.8M 输入 token,尽管对话从未超过 120K。在 90% 从缓存读取的情况下,输入花费约 $1.62。
同一个任务用 25 轮完成,处理约 1.75M token,输入花费约 $1.02。
一轮的花费超过它新增的 token,因为它要重发之前的一切。所以最便宜的一轮是你不需要的那一轮。
一个能减少轮数的习惯,是给模型一种检查自己工作的方式。比如一个可运行的测试、一次构建,或一个调用 endpoint 的脚本。能检查自己工作的模型会更早发现错误。
一个一次性收集所需信息、并批量调用工具的模型,重发的次数也更少。
缓存读取
同样 2.8M 输入 token,如果完全没有来自缓存,花费 $11.20。命中率为 90% 时花费 $1.62,96% 时约 $0.99。没有其他设置能如此大幅度地影响输入成本。一个稳定的会话本身就能保持高命中率。我在本文后面会介绍一些避免破坏缓存的做法。
输出 token
在 Opus 5.5 上,一个输出 token 的价格是一个缓存读取的 100 倍。一个典型任务的 60K 输出 token 花费 $1.20,相当于从缓存读取 6M token。输出包含 thinking。你要为全部输出付费,即使 Claude Code 只向你展示摘要。
这就是为什么 effort——它主要改变模型思考的多少——对账单影响如此之大。
模型
缓存读取更便宜的模型,主要对长会话有帮助。输出更便宜的模型,主要对需要大量推理的任务有帮助。
Opus 5.5 改变了什么
两件事变了:价格,以及模型完成的工作量。
每一条价格都更低了。输入和输出 token 比 Opus 5 便宜 20%。缓存读取便宜 60%。输入价格下降,读取费率也随之下降,从输入价格的十分之一降到二十分之一。图 A 对比了两个模型每百万 token 的价格。这些是 API 牌价。
在 Pro、Max 或 Team 计划上,Opus 5.5 更低的价格会传导到你的额度,包括缓存上下文,所以它们能比 Opus 5 多用约 25%。缓存读取的额外削减是 API 价格变化。
另外,Pro、Max、Team 和按席位计费的 Enterprise 计划的五小时额度提升了,符合条件的订阅者可获得一次可自主选择时机使用的额度重置。你可以在网页端或 Claude Desktop 的 Settings > Usage 下找到它,而不是在终端的 Claude Code 里。重置适用于你的整个账户,包括 Claude Code。
图 A 每百万 token 的 API 牌价。
在 API key 上,缓存读取价格的削减对 Claude Code 影响最大。一个长的 agentic 会话的大部分输入都是缓存读取。在下文图 B 定价的会话中,缓存一项从 $1.00 降到 $0.40,是账单上降幅最大的一项。
你能省多少取决于你工作的形态。一个以缓存读取为主的会话,输入最多可省 60%。一个没有缓存、回答很长的简短问题,最多可省 20%,因为输出占主导。大多数 Claude Code 任务介于两者之间。下面的计算器会显示你的情况。
你可能见过“Opus 5.5 的运行成本比 Opus 5 低 40%”的说法。那是我们对按 token 计费、默认设置下典型工作负载的估算。它假设 Opus 5.5 在 medium 默认档位下,每个任务使用更少的 token,叠加在更低的价格之上,所以并不是 token 价格降了 40%。
token 价格就是图 A 中的那些,图 B 展示的是价格变化单独产生的效果。
Opus 5.5 在一次回答上可能使用更多 token,因为它总是在回复前先思考。我们预期用户在 Opus 5.5 上能完成更多工作,但这因任务而异,所以请在你自己的工作上衡量。
Fig C 比较了两个模型每个任务的成本。这部分比价格更依赖于你自己的工作。
在范围明确的任务上,两个模型以大致相同的轮数完成,你得到的只是降价。差距在开放式任务上应该最大,因为模型可能在错误的想法上花费许多轮。没有任何单一数字适用于每个代码库,所以请自行衡量(见最后一节)。
长时间运行以一份报告收尾。Opus 5.5 在结束一次长运行时会报告它改了什么、发现了什么,以及需要你做什么。当你能看到发生了什么时,重新运行会话的次数会更少,这也能省钱。
相同任务的并排对比
Fig B 用相同的 token 数量为两个模型上的一次会话定价。因此差异只是价格变化,别无其他。
切换模型进行对比。这些 token 数量仅作示例。
$3.50,按 Opus 5 API 目录价
- 缓存读取 2.0M $1.00
- 新输入 200K $1.00
- 输出 60K $1.50
- Opus 5 总计 $3.50
FIG B 两个模型使用相同 token 的示例会话,因此这只是价格变化本身。
这份单据包含 /usage 为一次会话显示的三行。按 token 数计,缓存读取是最大的一项,为 2M。输出按 token 数计最小、按费用计却最大。
新输入介于两者之间。它涵盖每个文件的首次读取以及每个新的工具结果。
Fig B 给两个模型相同的 token 数量,因此它只显示价格变化。你自己的会话在 Opus 5.5 上可能使用更多或更少的 token。按这种方式计价,该会话的成本约低 31%。
一次有记录的运行引入了第二种效应,即模型所做工作量的变化。在有错误开端的任务上,差距应当扩大。
试试你自己的数字
设置你的某个任务所使用的数量,或者从预设开始。这些预设颇具示例性,但我仍建议你自己做计算。缓存输入按缓存读取价格计费,新输入按输入价格计费,因此缓存滑块显示了差距中有多少来自缓存读取。
要从真实会话填充这些滑块,请在任务结束时运行 /usage。Session 区块给出输入、输出和缓存数据。最后一个滑块是你对 Opus 5.5 在你的任务上少做多少工作的假设。
仅看价格变化时保持为 0%。要根据你自己的工作进行设置,方法如下:在 Opus 5 和 Opus 5.5 上运行同一任务,比较轮数和输出 token。Measure it yourself 一文会带你走一遍流程,Reading a session 说明了在 /usage 中要查看什么。
- 输入 token 2.2M:所有轮次中发送给模型的一切,无论是否缓存。
- 缓存读取 91%
- 输出 token 60K:包含思考,思考按输出计费。
- 每日任务数 10
- Opus 5.5 上的 token 变化(你的假设)0%:仅看价格时保持为 0%。Opus 5.5 使用的 token 可能比 Opus 5 更多或更少,请在你自己的任务上衡量。
- Opus 5,这些 token $3.50,每月 $770
- Opus 5.5,这些 token $2.40,每月 $528
- 按 API 目录价的变化 −31%,每月少 $242,仅凭价格
Opus 5,这些 token:$3.50。Opus 5.5,这些 token:$2.40。按 API 目录价的变化:−31%,每月少 $242,仅凭价格。
FIG C 一个月按 22 个工作日计。API 目录价。
在 Pro、Max 或 Team 套餐上,这不是账单。无批量或用量折扣,缓存写入未计入(见 caching)。
最大化会话价值的技巧
Opus 5.5 更低的价格使每个 token 花费更少。你如何运行会话决定了你使用多少 token,以下这些步骤会有帮助。
在更换模型之前先调高 effort
Effort 设定了模型每轮花费多少 token 的总体倾向:它的思考、它写下的文本,以及它的工具调用。在较低的 effort 下,它进行更少的工具调用,且保持更短。
Opus 5.5 有四个级别(low、medium、high 和 xhigh),另有用于单个会话的 max。在下方选择一个级别,即可查看何时使用它以及设置它的命令。
Medium:用于范围明确的日常工作
范围清晰的日常工作。它每轮的思考比 high 少,因此每轮成本更低。
- 任务范围明确时从这里开始
/effort medium/effort status/model/usage
FIG D 级别按每轮思考量从最少到最多排列。
Claude Code 为每个模型设置默认级别,/effort status 显示你的当前级别。对于范围明确的日常工作,试试 medium。当 medium 陷入停滞时,试试 high。
它每轮的花费比 medium 多,但少于换用更大的模型。将 low 用于机械性工作,比如重命名或在多个文件间应用一个已知模式。
在 Opus 5.5 上默认是 medium,比 Opus 5 的默认级别 high 低一级。级别在每个模型上并不意味着相同的思考量。在给定级别下,Opus 5.5 每轮的思考比 Opus 5 多,在 xhigh 和 max 上尤其如此。
所以不要沿用你为 Opus 5 选择的级别。从 medium 开始,把 xhigh 和 max 留给你已衡量出收益的工作。
理解 effort 定价的一个粗略方式:假设 high 在一个任务中增加 20K 思考 token。在 Opus 5.5 上这是 $0.40。一个十轮的重试循环,在 100K 缓存上下文下、总计 10K 输出 token,成本大致相同。
因此在能省下一次重试的任务上,high 是划算的。在 medium 本可一次完成的任务上,它就浪费了。
当 medium 只修复一层时
你需要更多 effort 的最清晰迹象,是一个修复停留在单层。
假设 API 处理器中的一个字段被重命名。在 medium 下,模型更新了处理器,处理器的测试通过了,而客户端仍在发送旧字段。它做了被要求的事。
它只是没有读到足够远,没找到第二个调用方。在 high 下,它会在写之前花更多轮阅读调用点,并在一次处理中修改两个层。
一次检查就能抓住同一个 bug。如果模型能运行一个穿过客户端的测试,那么在编写该字段的那一轮,旧字段就会让这个测试失败——即便只处于 medium 档位。所以在提高 effort 之前,先检查模型是否有办法验证自己的工作。
运行一次测试的代价是一轮及其输出。更高的 effort 会为每一轮都增加思考。
如果提升 effort 档位并增加检查仍然无效,那就换用更大的模型。
会话中途更改 effort
在 Claude Code 中,运行带档位的 /effort,例如 /effort high。/effort status 会打印当前档位。你可以在任务中途更改,新档位会应用到下一次请求。
在使用 API key 或 Claude 订阅的 Opus 5.5 上,更改 effort 会保留缓存。你可以为某个困难步骤调高,之后再调低,而不必重写对话。
在 Amazon Bedrock、Google Cloud 的 Agent Platform 或 Claude apps gateway 上,更改 effort 仍会清除已缓存的对话,下一次请求要为全部内容支付 cache-write 价格。
Opus 5.5 的 thinking 始终开启,因此没有可更改的 thinking 设置。
为你的工作选择合适的模型
模型选择决定了会话中每个 token 的价格,因此它对账单的影响比 effort 更大。它的影响范围也更广。每个继承主模型的 subagent 也继承了它的价格。
大多数日子需要三个模型:一个用于查询的小模型,一个用于你密切监督的工作的 Opus 5.5,以及一个用于最困难任务的更大模型。
将 Opus 5.5 作为日常主力
在你监督的工作中使用 Opus 5.5:跨越几个文件的功能开发、调试,以及带后续修改的代码审查。你会阅读它所做的事情,在它偏离时介入,因此循环保持简短。
升级到 Fable 5.1
当结果比 token 价格更重要时,就升级到 Fable 5.1。例如你不会监督的长时运行、代码库中没有现成模式可循的问题,以及需要协调许多 subagent 的大型改动。
不要等到第三次失败。如果 Opus 5.5 在 xhigh 档位两次撞上同一个问题,就切换过去,问题解决后再切回来。对于交互式工作,Opus 5.5 更为合适,因为它延迟更低、成本更少。
Fable 5.1 的标价为每百万输入 token $10、每百万输出 token $50,是 Opus 5.5 价格的两倍半。它的 cache 读取成本为每百万 $0.25,仅为 Opus 5.5 费率的 1.25 倍,因为读取按其输入价格的 0.025 倍计费。
因此,差距在长时、重度使用 cache 的运行中最小,在写入量大的任务中最大。
在自然的停顿处切换。缓存属于先前的模型,所以新模型上的第一轮要为整个对话支付写入价格。先运行 /compact,或者带着一份简短的书面计划开启新会话,以让那一轮更小。
运行带别名或模型名称的 /model 来切换。/model 还会把你的选择保存为新会话的默认值,所以在困难部分完成后切回来。
降级用于查询
降级到 Sonnet 或 Haiku 用于查询,而不是用于编写代码:搜索和总结的 subagent、阅读日志和测试输出,以及“这是在哪里定义的”这类问题。对于跨越许多文件的机械性编辑,保留 Opus 5.5 并将 effort 设为 low。这样编辑仍留在编写你其余代码的那个模型上,而每轮成本更低。
要让某个 subagent 使用更小的模型,在其定义中设置 model: haiku 或 model: sonnet。要让每个 subagent 都使用同一个模型,设置 CLAUDE_CODE_SUBAGENT_MODEL 环境变量。
subagent 定义中指定的模型会覆盖该变量。没有模型设置的 subagent 会运行在你的主模型上,除非设置了该变量。
每个 subagent 在自己的 context window 中运行并交回一份摘要,因此它的文件读取不会进入你的主对话。它仍需为自己的 token 付费,所以模型设置决定了这笔开销的代价。
Agent teams 是一项实验性功能,会将这种消耗成倍放大。每个队友都是一个独立的 Claude Code 实例,拥有自己的 context window,并且在退出前会持续消耗 token。当队友在 plan mode 中运行时,我们的成本文档将一个 team 的 token 用量估计为标准会话的约七倍。
保持团队规模小,保持每个任务自包含,并在队友完成自己的部分后将它们关闭。
权衡在于:误读搜索结果的小模型会让主模型去追错误的文件,而主模型要为这次绕路买单。让小模型承担错误容易发现的工作,比如查找文件、运行测试和阅读日志。
把判断决策保留在主模型上。opusplan 别名以另一种方式拆分工作:Opus 在 plan mode 中制定计划,Sonnet 执行该计划。这将代码编辑放在了 Sonnet 上,与上面的建议相反。在把它设为默认之前,先在你自己的任务上做测量。
迁移时检查你的提示词
为旧模型编写的指令可能让 Opus 5.5 写得更多并重复工具调用。在 Claude Code 中运行 /claude-api prompt-audit,检查你的 Claude Code 配置(例如你的 skills 和 CLAUDE.md 文件)中是否存在这些提示反模式。它还会检查你在 Claude Platform 上构建的应用的代码。
我们在一次从 Opus 4.8 迁移到 Opus 5.5 的过程中测试了这一点,使用了一个包含 44 张工单的内部客户支持基准,其提示词中包含上述模式中的几种。以 low effort 迁移到 Opus 5.5 后,该基准的成本降低了约 18%。
运行 prompt-audit 又将其降低了 9%,降至比 Opus 4.8 起点低约 25% 的水平。
审计移除了导致模型写得更多并重复工具调动的仪式性指令:一个强制性的六步流程、一条 scratchpad 规则、一条 verify-twice 规则,以及相互矛盾的指令。
该结果来自单一基准,因此请把它当作一个例子,而不是一个可预期的数字。运行审计,然后在一个真实任务上前后对比 /usage(参见 Measure it yourself)。
缓存与压缩
Claude Code 会替你处理缓存和压缩。你如何运行会话,决定了它们能节省多少。
缓存的工作原理
Claude Code 会对请求中重复出现的部分进行缓存,例如 system prompt、工具定义以及到目前为止的对话。
在 Opus 5.5 上,缓存读取的费用是全新输入 token 的 5%。按今天的定价,写入缓存的费用高于全新读取:五分钟缓存为输入价格的 1.25 倍,一小时缓存为输入价格的两倍。每次命中都会免费重置存活时间。
在 Claude Code 中,存活时间取决于你的付费方式。使用 Claude 订阅时为一小时。使用 API key 或云服务商时默认为五分钟,而订阅一旦开始动用 usage credits,就会降到五分钟。
在 120K token 的上下文下,Opus 5.5 上一次五分钟写入的费用约为 $0.60,一次读取约为 $0.02。一次写入的费用相当于 25 次读取。在 API key 下,六分钟的咖啡休息会把下一次 $0.02 的读取变成 $0.60 的写入。
同样大小的一小时写入费用约为 $0.96,在 API 上你可以支付这笔溢价来覆盖一天中的空档。
会话形态与命中率
缓存存储的是一个前缀,因此它只能复用请求中从头开始与上一个请求相匹配的部分。
平稳的会话每一轮都向对话末尾追加内容,从而保持较高的命中率。任何改变请求前部内容的行为都会降低命中率。修改工具定义会清空整个缓存,而修改 system prompt 会从该点开始清空缓存,这几乎等于清空了全部内容。
在实际使用中,以下情况会出现缓存写入:
- 你暂停的时间超过缓存存活时间;
- 你在 Amazon Bedrock、Google Cloud 的 Agent Platform 或某个网关上更改 effort,在这些平台上该级别属于缓存匹配内容的一部分;
- 你在对话中首次开启 fast mode,这会改变缓存匹配内容的一部分;
- 你连接或断开 MCP 服务器,这可能改变每个请求开始时加载的内容;
- 你切换模型,因为新模型从空缓存开始;
- 对话被压缩,这会改写缓存所匹配的历史。
因此,请在会话开始时完成这些设置,并在会话运行期间保持不动。
为什么长会话每轮成本更高
每一轮都会重新发送整个上下文,因此即使缓存是热的,上下文越大,每一轮的费用也越高。在 20K token 的上下文下,Opus 5.5 上一轮的缓存读取费用约为 $0.004。在 150K 下约为 $0.03,该规模的 30 轮仅读取就要花费 $0.90。
同样 30 轮在 20K 下约为 $0.12。在 Claude 4.6 及之后的模型上,更大的上下文窗口不会改变每个 token 的价格,因此成本完全来自重新发送对话。
这些上下文中有许多是先前工作遗留的内容:一小时前的堆栈跟踪、一个你已处理完的文件、一次你后来已修复的测试运行的输出。这些内容在每一轮仍会被发送。
压缩、/compact 与 /clear
当会话接近其上下文上限时,Claude Code 会对较早的历史进行摘要,使后续各轮发送的内容更少。运行 /autocompact 并传入一个 token 数量,可以改变触发前上下文会被填满到什么程度。
有两个命令可以让你自己完成这件事。/clear 会清空对话且不产生任何费用,所以当你转向无关工作时可以使用它。
/compact 保持连续性,费用为一次请求。它会读取它所摘要的对话,并且你可以指定要保留的内容,例如 /compact keep the failing test names and the schema change。
在 150K token 下进行压缩,粗略价格约为 $0.25。这包括读取、几千个输出 token 的摘要,以及在缩短后的上下文上的一次新缓存写入。之后的每一轮大约节省 $0.025 的读取费用,因此压缩在大约十轮内即可回本。
临结束前才进行的压缩,其花费会超过它节省的费用。
这个价格假设缓存是热的。当缓存是热的时,摘要请求会从中读取对话,因此请在休息之前压缩,而不是休息之后。超过缓存存活时间的休息之后,同一条 /compact 会再次读取整个对话并将其写回缓存。
在五分钟缓存下的 150K token,仅输入就约为 $0.75。如果你走上了一条想放弃的路线,可以改为 /rewind 到更早的一轮。当缓存是热的时,这会返回到一个已经缓存过的前缀。
摘要还会丢失细节。在调试会话中途进行压缩,可能会丢掉那一条真正要紧的日志。请在自然的停顿处进行压缩;当下一步依赖于某个具体内容时,请在 /compact 指令中说明。
输入之前加载了什么
你的 CLAUDE.md 文件会在每个会话开始时加载到上下文中,因此其中的每一行都是每一轮重新发送内容的一部分。费用文档建议将其保持在 200 行以内。
MCP 工具定义是延迟加载的。只有工具名称和服务器说明会在开始时加载,完整定义则在其工具被使用时加载。运行 /mcp 可以查看哪些服务器已连接,并关掉你未在使用的那些。
账单的其余部分
该表格列出了影响 Claude Code 会话的其他计费规则,并在存在相应文档之处附上了链接。
Fast mode 运行 Opus 5.5 的速度最多快 2.5 倍,价格为标准价格的两倍:每百万输入 token $8,每百万输出 token $40。在 Claude 订阅中,它计入 usage credits,而不是你的套餐限额。
开启后的第一个请求会对整个对话按 fast-mode 输入价格计费,且不经过缓存。所以请在会话开始时开启它,而不是在会话进行到深处。
账单计算的内容
- 缓存有效期:在 Claude Code 中,订阅方式下为一小时;使用 API key 或云服务商时为五分钟,订阅一旦动用 usage credits 后也为五分钟。每次命中都会重置该有效期。API 提供一小时缓存,但写入价格更高。参见 Costs 文档(Claude Code 有效期)和 prompt caching 文档
- 缓存写入:按当前 API 定价,五分钟缓存为输入价格的 1.25 倍,一小时缓存为 2 倍。参见 Pricing 文档
- Thinking:按输出 token 计费,包括未返回给你的思考内容。参见 Extended thinking 文档
- Effort:作用于每个输出 token:文本、工具调用和思考。参见 Effort 文档
- 自动压缩:在上下文窗口接近上限时运行。带 token 数的
/autocompact可设置阈值。参见 Context window 文档 - 子代理与代理团队:子代理在自己的上下文窗口中工作并返回摘要。plan mode 中的代理团队使用的 token 约为一次标准会话的 7 倍。参见 Context window and costs 文档
- Batch API:通过 Message Batches API 发送的请求,输入和输出 token 均为半价。参见 Batch processing 文档
- 当前的典型支出:平均值:企业部署中每位开发者每个活跃日约 $13。对 90% 的用户,成本保持在每个活跃日 $30 以下。这两个数字均针对当前模型。参见公开文档的 costs 页面(企业平均值和 90% 上界)
自己动手测量
本文中的数字只是示例。你的代码库、提示词和习惯各不相同,因此请在你自己的任务上测量成本。以下是查看方法。
在会话中运行 /usage,/cost 的作用相同。Session 区块显示 token 用量以及按目录价格估算的美元成本。一行 prompt-cache 信息显示你的输入有多少来自缓存。
在 Pro、Max、Team 或 Enterprise 套餐上,同一界面还会显示你的套餐用量条。美元数字是在你的机器上按目录价格计算的,因此在订阅方式下它只是你所完成工作量的参考,而不是账单。
把同一个任务运行两次。Opus 5.5 需要 Claude Code v2.1.280 或更高版本,所以先运行 claude update。从你的待办任务中挑选,而不是玩具示例。
用 /model 在 Opus 5 和 Opus 5.5 之间切换。记录每次运行的轮数、输出 token 和成本。做完三四个任务之后再下结论。
对于团队,使用使用量和成本报告。Claude Code Analytics API 提供每位用户的估算成本。Usage and Cost API 按模型以及缓存与未缓存 token 拆分支出。
试试 effort 阶梯。把一个困难任务先以 medium 再以 high 运行。把一个机械性任务以 low 运行。
解读一次会话
在任务结束时检查 /usage 中的三项内容。
缓存占比。对较长的会话来说,它应该较高。如果偏低,请查找是否有长时间暂停、模型切换、中途连接的 MCP server,或云服务商/网关上的 effort 变更。
prompt cache 那一行常常会指出上一次未命中的可能原因。
输出与输入之比。小改动产生大量输出通常意味着 effort 级别对该任务过高,或者模型在重试。
总输入与对话大小之比。如果总量是对话大小的许多倍,说明这个会话进行了很多轮,值得阅读对话找出循环在哪里重复。
作为基线,Claude Code 的 costs 文档给出企业部署的平均值约为每位开发者每个活跃日 $13,且 90% 的用户低于每个活跃日 $30。成本远高于你自己正常水平的会话值得复查。
牢记
- 对范围明确的日常工作使用 medium effort。
- 给模型一种检查自己工作的办法,并在 plan mode 中启动跨文件的改动。
- 当 medium 停滞不前时,把 effort 提高到 high。使用 API key 或订阅时,这一变更会保留你的缓存。在云服务商或网关上,请在间歇时变更。
- 如果 xhigh 两次撞上同一个问题,切换到 Fable 5.1。问题解决后再切回来。
- 把搜索和读日志的子代理放到 Sonnet 或 Haiku 上。代码编辑保持在 Opus 5.5 上。
- 让长会话保持推进,使其缓存保持温热。
- 在不相关的任务之间使用
/clear,在间歇时使用/compact并注明要保留什么。 - 最重要的一条:在每个模型上各运行一个真实任务,比较
/usage报告的内容。你自己的数字才是可信的。
希望这篇文章对你有帮助。如果你的额度在 Opus 5.5 上没有比在 Opus 5 上撑得更久,请用 /feedback 告诉我们。
延伸阅读:Manage costs effectively · Model configuration · Choosing a Claude model and effort level in Claude Code · Effort · Prompt caching · Maximizing the value of your Claude Code sessions
感谢 Michael Segner、Kacie Jenkins 和 Molly Vorwerck 的审阅。
展开原文提取正文(采集端自动提取,可能有缺失)
THE COST OF A TASK, AND THE COST OF A RETRY You don't set out to buy millions of tokens. You set out to build a feature, finish a migration, or run a task. The token count is whatever the model needed to get there. Two models with the same cost per token can cost very different amounts on the same task. One reads the code once. The other reads it, tries a fix, and reads it again. Each of those steps is a turn, and each turn resends the conversation so far. So the model that needs more turns costs more, even at the same price. By the end of this post you should be able to answer three questions about your own work:
What do my typical tasks cost me on Opus 5.5? Which settings change that, and by how much? How do I check my own session usage?
The tradeoff I want to share upfront is that every way to spend fewer tokens can also cost you a finished task. Lower effort, a smaller model, or less context can all certainly save tokens. A retry costs more than those savings. This post attempts to put a price on each tradeoff. Some numbers here are list prices, and some are illustrations built from them. The figures are interactive, so change the inputs as you read. These are best effort illustrations, so be sure to check our docs and your own math. WHAT DOES A TASK COST? A task in Claude Code is a loop. The model reads the conversation, calls a tool, reads the result, and goes round again until it's done. Each trip round the loop is one request. Four things set what the loop costs. Turns. Every turn resends the conversation so far. Fewer turns means less input processed. Cache reads. Most of what a turn resends is text the model saw on the previous turn. It's billed as a cache read, at a small fraction of the input price. Output token type. The most expensive tokens, at five times the input price. Thinking is billed as output, so a model that reasons less on the way to the answer costs less. Model. Each model has its own prices, listed on the pricing page, so the model you pick sets the price of every token. Our examples use Opus 5.5 API list prices: $4 per million input tokens, $20 per million output tokens and $0.20 per million cache reads. Like the calculator further down, the examples bill cached input at the read price and everything else at the input price, and leave out cache writes. The token counts are illustrations. Turns Let’s say a task starts with 20K tokens of context and grows to 120K as the model reads files and tool results. At 40 turns, the average turn sends about 70K tokens. That's about 2.8M input tokens for the task, though the conversation never grew past 120K. With 90% read from cache, the input costs about $1.62. The same task in 25 turns processes about 1.75M tokens and costs about $1.02 in input. A turn costs more than the tokens it adds, because it resends everything before it. So the cheapest turn is the one you don't need. One habit that can cut turns is giving the model a way to check its work. For example, a test to run, a build, or a script that calls the endpoint. A model that can check its own work finds its mistakes earlier. A model that gathers what it needs in one pass, and batches its tool calls, pays the resend fewer times too. Cache reads The same 2.8M input tokens cost $11.20 if none come from cache. At a 90% hit rate they cost $1.62, and at 96% about $0.99. No other setting moves input cost this much. A steady session keeps a high hit rate on its own. I cover some actions to avoid breaking your cache later in this post. Output tokens On Opus 5.5, an output token costs 100 times a cache read. The 60K output tokens of a typical task cost $1.20, the same as reading 6M tokens from cache. Output includes thinking. You pay for all of it, even when Claude Code only shows you a summary. That's why effort, which mostly changes how much the model thinks, moves the bill so much. Model A model with cheaper cache reads mostly helps long sessions. One with cheaper output mostly helps tasks that need a lot of reasoning. WHAT CHANGED IN OPUS 5.5 Two things changed: the price, and how much work the model does. Every price line is lower. Input and output tokens are 20% cheaper than on Opus 5. Cache reads are 60% cheaper. The input price falls, and the read rate falls with it, from a tenth of the input price to a twentieth. Fig A compares the two models per million tokens. These are API list prices. On a Pro, Max or Team plan, the lower Opus 5.5 price is passed on to your limits, including cached context, so they go about 25% further than on Opus 5. The extra cut on cache reads is an API price change. Separately, five-hour limits went up on Pro, Max, Team and seat-based Enterprise plans, and eligible subscribers get a limit reset to use when they choose. You'll find it under Settings > Usage on the web or in Claude Desktop, not in Claude Code in your terminal. A reset applies across your account, Claude Code included. FIG AAPI list price per million tokens. On an API key, the cache-read price cut matters most for Claude Code. A long agentic session spends most of its input on cache reads. In the session priced in Fig B below, the cache line falls from $1.00 to $0.40, the largest drop on the receipt. How much you save depends on the shape of your work. A session that is mostly cache reads can save up to 60% on input. A short question with no cache and a long answer can save up to 20%, because output dominates it. Most Claude Code tasks sit between the two. The calculator below shows where yours sits. You may have seen that Opus 5.5 costs 40% less to run than Opus 5. That's our estimate for typical workloads billed by token, at default settings. It assumes Opus 5.5 uses fewer tokens per task at its medium default, on top of the lower prices, so it isn't a 40% cut to the price of a token. The token prices are the ones in Fig A, and Fig B shows what the price change does on its own. Opus 5.5 can use more tokens on an answer, because it always thinks before it replies. We expect people to get more done on Opus 5.5, but it varies by task, so measure it on your own work. Fig C compares cost per task on the two models. This part depends on your work far more than the price does. On a well-scoped task, both models finish in about the same number of turns, and the price cut is all you get. The gap should be biggest on open-ended tasks, where a model can spend many turns on the wrong idea. No single number holds for every codebase, so measure it (see the last section). Long runs end with a report. Opus 5.5 closes a long run with what it changed, what it found, and what it needs from you. That can save money too, because you rerun a session less often when you can see what happened. THE SAME TASKS SIDE-BY-SIDE Fig B prices one session on both models with the same token counts. So the difference is the price change and nothing else. Switch models to compare. The token counts are illustrative. $3.50at Opus 5 API list pricesRead from cache 2.0M$1.00Fresh input 200K$1.00Output 60K$1.50Total, Opus 5$3.50FIG BIllustrative session with the same tokens on both models, so this is the price change alone. The receipt has the three lines /usage shows for a session. Cache reads are the biggest line by tokens, at 2M. Output is the smallest by tokens and the biggest by cost. Fresh input sits between them. It covers the first read of each file and each new tool result. Fig B gives both models the same token counts, so it shows the price change alone. Your own sessions can use more or fewer tokens on Opus 5.5. Priced that way, the session costs about 31% less. A recorded run adds the second effect, the change in how much work the model does. On a task with a false start, the gap should widen. Try your own numbers Set what one of your tasks uses, or start from a preset. The presets are pretty illustrative but I’d still recommend doing your own math. Cached input bills at the cache-read price and fresh input at the input price, so the cache slider shows how much of the gap comes from cache reads. To fill the sliders from a real session, run /usage at the end of a task. The Session block gives input, output and cache figures. The last slider is your assumption about how much less work Opus 5.5 does on your tasks. Leave it at 0% for the price change alone. To set it from your own work, here's how: run the same task on Opus 5 and on Opus 5.5, and compare turns and output tokens. Measure it yourself walks through it, and Reading a session shows what to check in /usage. Input tokens2.2MEverything sent to the model across all turns, cached or not.Read from cache91%Output tokens60KIncludes thinking, which is billed as output.Tasks per day10Token change on Opus 5.5 (your assumption)0%Leave at 0% for price alone. Opus 5.5 can use more or fewer tokens than Opus 5, so measure it on your own tasks.Opus 5, these tokens$3.50$770 a monthOpus 5.5, these tokens$2.40$528 a monthChange at API list prices−31%$242 less a month, from price aloneOpus 5, these tokens: $3.50. Opus 5.5, these tokens: $2.40. Change at API list prices: −31%, $242 less a month, from price alone.FIG CA month is 22 working days. API list prices. On a Pro, Max or Team plan, this is not a bill. No batch or volume discounts, and cache writes are not counted (see caching). TIPS FOR MAXIMIZING THE VALUE OF YOUR SESSION Opus 5.5’s lower price makes each token cost less. How you run a session decides how many tokens you use, and these steps help. Raise effort before you change models Effort sets a general disposition for how many tokens the model spends on each turn: its thinking, the text it writes, and its tool calls. At lower effort it makes fewer tool calls and keeps them shorter. Opus 5.5 has four levels (low, medium, high and xhigh), plus max for a single session. Pick a level below to see when to use it and the command that sets it. Medium: for well-scoped daily workDay-to-day work with a clear scope. It thinks less per turn than high, so each turn costs less.Start here when the task is well scoped./effort medium/effort status/model/usageFIG DLevels run from least to most thinking per turn. Claude Code sets a default level for each model, and /effort status shows yours. Try medium for well-scoped, day-to-day work. When medium stalls, try high. It spends more per turn than medium, but less than moving to a bigger model. Use low for mechanical work, like renames or applying a known pattern across files. On Opus 5.5 the default is medium, one level below Opus 5's default of high. Levels don't mean the same amount of thinking on every model. At a given level, Opus 5.5 thinks more per turn than Opus 5, most of all at xhigh and max. So don't carry over a level you chose for Opus 5. Start at medium, and keep xhigh and max for work where you've measured a gain. A rough way to think about effort pricing: say high adds 20K thinking tokens across a task. On Opus 5.5 that's $0.40. A retry loop of ten turns at 100K of cached context, with 10K output tokens in total, costs about the same. So high pays for itself on a task where it saves one retry. On a task medium would have finished the first time, it's wasted. When medium fixes one layer The clearest sign you need more effort is a fix that stops at one layer. Say a field is renamed in an API handler. At medium, the model updates the handler, the handler's tests pass, and the client still sends the old field. It did what it was asked. It just didn't read far enough to find the second caller. At high, it spends more turns reading call sites before it writes, and it changes both layers in one pass. A check can catch the same bug. If the model can run a test that goes through the client, the old field fails that test on the turn it was written, at medium. So before you raise effort, check whether the model has a way to check its work. A test run costs one turn and its output. More effort adds thinking to every turn. If upgrading effort levels and adding checks doesn’t work, then switch to a bigger model. Changing effort mid-session In Claude Code, run /effort with a level, for example /effort high. /effort status prints the current level. You can change it mid-task, and the new level applies to the next request. On Opus 5.5 with an API key or a Claude subscription, changing effort keeps the cache. You can raise it for one hard step and lower it again without rewriting the conversation. On Amazon Bedrock, Google Cloud's Agent Platform or a Claude apps gateway, a change of effort still clears the cached conversation, and the next request pays the cache-write price on all of it. Thinking is always on for Opus 5.5, so there's no thinking setting to change. Choose the right model for your work Model choice sets the price of every token in a session, so it moves the bill more than effort does. It also reaches further. Every subagent that inherits the main model inherits its price too. Most days need three models: a small one for lookups, Opus 5.5 for work you supervise closely, and a bigger one for the hardest tasks.
Opus 5.5 as the daily driver Use Opus 5.5 for work you supervise: feature work across a few files, debugging, and code review with follow-up edits. You read what it does and step in when it drifts, so the loop stays short. Moving up to Fable 5.1 Move up to Fable 5.1 when the result matters more than the token price. For example long runs you won't supervise, problems with no existing pattern in the codebase, and large changes that coordinate many subagents. Don't wait for a third failure. If Opus 5.5 on xhigh hits the same problem twice, switch, and switch back once it's solved. For interactive work, Opus 5.5 is a better fit as it has lower latency and costs less. Fable 5.1 lists at $10 per million input tokens and $50 per million output, two and a half times the Opus 5.5 price. Its cache reads cost $0.25 per million, only 1.25 times the Opus 5.5 rate, because they bill at 0.025 times its input price. So the gap is smallest on a long, cache-heavy run, and largest on a task that writes a lot. Switch at a natural break. The cache belongs to the previous model, so expect the first turn on the new model to pay the write price on the whole conversation. Run /compact first, or start a fresh session with a short written plan, to make that turn smaller. Run /model with an alias or a model name to switch. /model also saves your choice as the default for new sessions, so switch back when the hard part is done. Moving down for lookups Move down to Sonnet or Haiku for lookups, not for writing code: subagents that search and summarize, reading logs and test output, and "where is this defined" questions. For a mechanical edit across many files, keep Opus 5.5 and set effort to low. The edit stays on the model that writes the rest of your code, at a lower cost per turn. To put a subagent on a smaller model, set model: haiku or model: sonnet in its definition. To put every subagent on one model, set the CLAUDE_CODE_SUBAGENT_MODEL environment variable. A model named in a subagent's definition overrides the variable. A subagent with no model setting runs on your main model, unless the variable is set. Each subagent runs in its own context window and hands back a summary, so its file reads stay out of your main conversation. It still pays for its own tokens, so the model setting decides what that spend costs. Agent teams, an experimental feature, multiply this. Each teammate is a separate Claude Code instance with its own context window, and it keeps using tokens until it exits. Our costs docs put a team at about seven times the tokens of a standard session when teammates run in plan mode. Keep teams small, keep each task self-contained, and shut teammates down when their part is done. The tradeoff: a small model that misreads a search result sends the main model after the wrong file, and the main model pays for the detour. Keep the small model on work where a mistake is cheap to spot, like finding files, running tests and reading logs. Keep judgment calls on the main model. The opusplan alias splits the work a different way: Opus plans in plan mode, and Sonnet carries out the plan. That puts the code edits on Sonnet, the opposite of the advice above. Measure it on your own tasks before you make it a default. Check your prompts when you migrate Instructions written for an older model can make Opus 5.5 write more and repeat tool calls. Run /claude-api prompt-audit in Claude Code to check your Claude Code setup, such as your skills and CLAUDE.md file, for these prompting anti-patterns. It also checks the code of an app you build on the Claude Platform. We tested this on a migration from Opus 4.8 to Opus 5.5, using an internal customer support benchmark of 44 tickets whose prompt had several of these patterns. The move to Opus 5.5, at low effort, cut the benchmark's cost by about 18%. Running prompt-audit cut it by a further 9%, to about 25% below the Opus 4.8 starting point. The audit removed ritual instructions that made the model write more and repeat tool calls: a mandatory six-step procedure, a scratchpad rule, a verify-twice rule, and instructions that contradicted each other. That result comes from one benchmark, so treat it as an example rather than a number to expect. Run the audit, then compare /usage on a real task before and after (see Measure it yourself). Caching and compaction Claude Code handles caching and compaction for you. How you run a session decides how much they save. How the cache works Claude Code caches the parts of a request that repeat, such as the system prompt, tool definitions, and the conversation so far. On Opus 5.5 a cached read costs 5% of a fresh input token. Writing to the cache costs more than a fresh read, at 1.25 times the input price for a five-minute cache and twice the input price for a one-hour cache, on today's pricing. Each hit resets the lifetime at no charge. In Claude Code the lifetime depends on how you pay. On a Claude subscription it's an hour. On an API key or a cloud provider it's five minutes by default, and a subscription drops to five minutes once it's drawing on usage credits. At 120K tokens of context, a five-minute write on Opus 5.5 costs about $0.60 and a read about $0.02. One write costs as much as 25 reads. On an API key, a six-minute coffee break turns the next $0.02 read into a $0.60 write. A one-hour write at the same size costs about $0.96, and on the API you can pay that premium to cover the gaps in your day. Session shape and hit rate The cache stores a prefix, so it can reuse only the part of a request that matches the previous one from the start. A steady session appends to the end of the conversation on every turn and keeps its hit rate high. Anything that changes an earlier part of the request lowers it. Changing the tool definitions clears the whole cache, and a change to the system prompt clears it from that point on, which is almost everything. In practice, expect a cache write when:
You pause longer than the cache lifetime; You change effort on Amazon Bedrock, Google Cloud's Agent Platform or a gateway, where the level is part of what the cache matches; You turn on fast mode for the first time in a conversation, which changes part of what the cache matches; You connect or disconnect an MCP server, which can change what loads at the start of each request; You switch models, since the new model starts from an empty cache; and The conversation is compacted, which rewrites the history the cache matched.
So set these up when the session starts, and leave them alone while it works. Why long sessions cost more per turn Every turn resends the whole context, so a turn costs more as the context grows, even with a warm cache. At 20K tokens of context a turn's cache read costs about $0.004 on Opus 5.5. At 150K it costs about $0.03, and 30 turns at that size spend $0.90 on reads alone. The same 30 turns at 20K cost about $0.12. On Claude 4.6 and later models a bigger context window doesn't change the price per token, so the cost comes entirely from resending the conversation. Much of that context is left over from earlier work: a stack trace from an hour ago, a file you've finished with, the output of a test run you've since fixed. It's all still sent on every turn. Compaction, /compact and /clear When a session gets close to its context limit, Claude Code summarizes older history so later turns send less. Run /autocompact with a token count to change how full the context gets before that happens. Two commands let you do this yourself. /clear empties the conversation and costs nothing, so use it when you move to unrelated work. /compact keeps continuity and costs one request. It reads the conversation it summarizes, and you can say what to keep, for example /compact keep the failing test names and the schema change. A rough price for compacting at 150K tokens is about $0.25. That's the read, a summary of a few thousand output tokens, and a new cache write on the shorter context. Each later turn saves about $0.025 in reads, so the compaction pays for itself within about ten turns. A compaction just before you finish costs more than it saves. That price assumes a warm cache. While the cache is warm, the summary request reads the conversation from it, so compact before a break, not after one. After a break longer than the cache lifetime, the same /compact reads the whole conversation again and writes it back to the cache. At 150K tokens on a five-minute cache, the input alone comes to about $0.75. If you've gone down a path you want to drop, /rewind to an earlier turn instead. While the cache is warm, that returns to a prefix that's already cached. The summary also loses detail. A compaction in the middle of a debugging session can drop the one log line that mattered. Compact at a natural break, and when the next step depends on something specific, say so in the /compact instruction. What loads before you type Your CLAUDE.md file loads into the context at the start of every session, so each line in it is part of what every turn resends. The costs docs suggest keeping it under 200 lines. MCP tool definitions are deferred. Only tool names and server instructions load at the start, and a full definition loads when its tool is used. Run /mcp to see which servers are connected, and turn off the ones you aren't using. The rest of the bill The table lists the other billing rules that affect a Claude Code session, with a link to the docs where one exists. Fast mode runs Opus 5.5 up to 2.5 times faster, at twice the standard price: $8 per million input tokens and $40 per million output. On a Claude subscription it's billed to usage credits, not your plan limits. The first request after you turn it on pays the fast-mode input price on the whole conversation, uncached. So turn it on at the start of a session, not deep into one. What the bill countsHow it worksCache lifetimeIn Claude Code, one hour on a subscription; five minutes on an API key or cloud provider, or once a subscription draws on usage credits. Each hit resets the lifetime. The API offers a one-hour cache at a higher write price. Costs docs (Claude Code lifetime) and prompt caching docsCache writes1.25× the input price for a five-minute cache and 2× for a one-hour cache, on today's API pricing. Pricing docsThinkingBilled as output tokens, including thinking that isn't returned to you. Extended thinking docsEffortApplies to every output token: text, tool calls and thinking. Effort docsAuto-compactionRuns as the context window nears its limit. /autocompact with a token count sets the threshold. Context window docsSubagents and agent teamsA subagent works in its own context window and returns a summary. Agent teams in plan mode use about 7× the tokens of a standard session. Context window and costs docsBatch APIHalf price on input and output tokens for requests sent through the Message Batches API. Batch processing docsTypical spend todayAverage: about $13 per developer per active day across enterprise deployments. For 90% of users, cost stays below $30 per active day. Both figures are for current models. Public docs, costs page (enterprise average and 90% bound) MEASURE IT YOURSELF The figures in this post are illustrations. Your codebase, prompts and habits are different, so measure cost on your own tasks. Here's how to check.
In a session, run /usage. /cost does the same thing. The Session block shows token use and an estimated dollar cost at list price. A prompt-cache line shows how much of your input came from cache. On a Pro, Max, Team or Enterprise plan, the same screen shows your plan usage bars. The dollar figure is computed on your machine at list price, so on a subscription it is a guide to how much work you did, not a bill. Run the same task twice. Opus 5.5 needs Claude Code v2.1.280 or later, so run claude update first. Pick something from your backlog, not a toy example. Use /model to switch between Opus 5 and Opus 5.5. Note turns, output tokens and cost for each run. Do three or four tasks before you draw a conclusion. For a team, use the usage and cost reports. The Claude Code Analytics API gives estimated cost per user. The Usage and Cost API breaks spend down by model and by cached versus uncached tokens. Try the effort ladder. Run one hard task at medium and then at high. Run one mechanical task at low.
Reading a session Check three things in /usage at the end of a task.
Cache share. For a long session it should be high. If it's low, look for a long pause, a model switch, an MCP server connected partway through or, on a cloud provider or gateway, a change of effort. The prompt cache line often names the likely cause of the last miss. Output against input. A lot of output on a small change usually means the effort level is too high for the task, or the model is retrying. Total input against the size of the conversation. If the total is many times the size of the conversation, the session took many turns, and the conversation is worth reading to find where the loop repeated.
For a baseline, the Claude Code costs docs give an average across enterprise deployments of about $13 per developer per active day, and under $30 per active day for 90% of users. A session that costs well above your own normal level is worth reviewing. KEEP IN MIND
Use medium effort for well-scoped daily work. Give the model a way to check its work, and start changes that span files in plan mode. When medium stalls, raise effort to high. With an API key or a subscription the change keeps your cache. On a cloud provider or gateway, change it at a break. If xhigh hits the same problem twice, switch to Fable 5.1. Switch back once it's solved. Put search and log-reading subagents on Sonnet or Haiku. Keep code edits on Opus 5.5. Keep a long session moving, so its cache stays warm. Use /clear between unrelated tasks, and /compact at a break with a note on what to keep. The one that matters most: run one real task on each model and compare what /usage reports. Your own numbers are the ones to trust.
I hope this post was helpful. If your limits don’t go further on Opus 5.5 than on Opus 5, tell us with /feedback. Further reading: Manage costs effectively · Model configuration · Choosing a Claude model and effort level in Claude Code · Effort · Prompt caching · Maximizing the value of your Claude Code sessions With thanks to Michael Segner, Kacie Jenkins and Molly Vorwerck for their reviews.
原文入口
阅读原文(claude.dev)原文将在新窗口打开。收录时间不是内容更新时间;正文、译文与解读的版权归原作者/来源所有,本站仅作个人阅读辅助并保留原文入口;页面时间均为北京时间。
了解来源批准与收录规则