Codex compacts on its own once a conversation reaches the token limit you choose. Here is what that choice costs, based on 26 real sessions.对话达到你设定的 token 上限时,Codex 会自动压缩。这个选择要花多少钱,下面用 26 个真实会话来回答。
Each card is the cheapest trigger that keeps compaction within a share of your working time. They change when you move the speed slider under the chart.每张卡片是在压缩时间不超过你工作时间某个比例的前提下,最省钱的触发点。拖动图表下方的速度滑块,它们会跟着变。
Blue is what one million billed tokens of your usage costs at each trigger. Orange is the share of working time spent compacting. Hover or tap the chart to read any trigger. The shaded bands show the likely range.蓝线是在各个触发点下,用量里每一百万个计费 token 的花费。橙线是用在压缩上的工作时间占比。把鼠标移到图上或点一下,就能读出任意触发点的数值。浅色带是可能的范围。
Costs use DeepSeek Flash prices per million tokens: input $0.15, cache hit $0.003, output $0.60.费用按 DeepSeek Flash 的价格计算(每百万 token:输入 $0.15,缓存命中 $0.003,输出 $0.60)。
Cost is per 1M tokens billed with the mix seen in these sessions: 98.5% cache reads, 0.0% cache writes (1 hour), 0.0% cache writes (5 minutes), 1.2% plain input, 0.3% output.费用按每 100 万个计费 token 计算,构成与这些会话一致:缓存读取 98.5%、缓存写入(1 小时)0.0%、缓存写入(5 分钟)0.0%、普通输入 1.2%、输出 0.3%。
In short: we replayed real sessions at every trigger and added up what they would have cost and how long compaction would have taken.简单说:我们用真实使用记录在每个触发点上重放一遍,把费用和压缩耗时加起来。
26 independent work sessions, plus the latest stretch of the analysis session after its last compaction, 2,933 deduplicated requests and about 7.0 hours of work. 9 measured compactions calibrate the model. Smoke tests, test sessions and the sessions used to time compaction are left out. Where Codex compacted a session for real, the compaction request is dropped and the stretches before and after are joined into one uncompacted stream, so the replay decides where compactions happen.26 个独立工作会话,外加分析会话最后一次压缩之后的那一段,共 2,933 个去重请求,约 7.0 小时的工作。9 次实测压缩用来校准模型。冒烟测试、测试会话和用来测压缩耗时的会话都没有计入。会话里 Codex 真实压缩过的地方,压缩请求本身被去掉,前后两段接成一条没有压缩的请求流,由重放来决定在哪里压缩。
The chart does not show the total bill of the sessions, because that would grow with the amount of history. Every cost is the replay cost at that trigger divided by the billed tokens of the real history (620 million), times one million. The divisor is one fixed number per model, not the token count of each replay. The reference million therefore has the real billing mix: 98.5% cache reads, 0.0% cache writes (1 hour), 0.0% cache writes (5 minutes), 1.2% plain input and 0.3% output. Costs are comparable between models and between amounts of history.图上不是这些会话的总账单,因为总账单会随历史数据的多少而变。每个费用都是该触发点下重放得到的总费用,除以真实历史的计费 token 数(620 百万),再乘以一百万。除数是每个模型固定的一个数,不是每次重放的 token 数。所以这一百万 token 的构成与真实计费一致:缓存读取 98.5%、缓存写入(1 小时)0.0%、缓存写入(5 分钟)0.0%、普通输入 1.2%、输出 0.3%。这样不同模型、不同数据量之间的费用可以直接比较。
The cost of one request comes first. Then ordinary requests and compactions are added up over the whole workload.先算一次请求的费用,再把普通请求和压缩在整个工作负载上加起来。
xContext tokens in one request.一次请求里的上下文 token 数。yOutput tokens of that request, billed at the output price.这次请求输出的 token 数,按输出价格计费。cShare of a request's input that hits the prompt cache.请求输入中命中提示缓存的比例。p_m / p_c / p_oPrice per token of uncached input, cached input and output.未缓存输入、缓存输入和输出的每 token 价格。αCached input price divided by uncached input price; DeepSeek Flash: 0.02.缓存输入价格除以未缓存输入价格;DeepSeek Flash 为 0.02。ρOutput price divided by uncached input price; DeepSeek Flash: 4.输出价格除以未缓存输入价格;DeepSeek Flash 为 4。BEffective price of one ordinary context token, after the cache hit rate.考虑缓存命中率后,一个普通上下文 token 的有效价格。C / KC is the compaction input in tokens. K is the part of it that comes from the cache.C 是压缩输入的 token 数,K 是其中来自缓存的部分。T / RT is the compaction trigger; R is the context right after a compaction.T 是压缩触发点;R 是刚压缩完时的上下文大小。ΔHow many tokens the context grows after each ordinary request, on average.每个普通请求之后,上下文平均增长多少 token。GSummary tokens actually written, and billed, in one compaction.一次压缩实际写出并计费的摘要 token 数。βShare of the compaction input that hits the cache.压缩输入中命中缓存的比例。aSeconds per uncached input token, fitted on the measured compactions.每个未缓存输入 token 的处理时间,单位是秒,由实测压缩拟合。vHow fast the summary is written, in tokens per second. The slider changes this one.摘要的生成速度,单位是 token 每秒。滑块调的就是它。N_c / t_c / WNumber of compactions, time of one compaction, and working time without compaction.压缩次数、单次压缩耗时,以及不含压缩的工作时间。α makes keeping a long context cheap.缓存输入越便宜,触发点越高。α 越小,保留长上下文越划算。Δ makes low triggers compact over and over.增长越快,触发点越高。Δ 越大,低触发点就会一次又一次压缩。G makes each compaction cost more.摘要越长,触发点越高。G 越大,每次压缩越贵。v makes each compaction last longer, so fewer of them fit in your time budget.写得越慢,触发点越高。v 越小,每次压缩越久,在你的时间预算里就容不下那么多次。The time model is fitted to 9 compactions: R² = 0.98. Summary size alone gives 0.95, input size alone gives 0.20. The closed-form formula explains the direction of each effect. The chart itself comes from the replay, which keeps the real order of requests, the real growth and the real moments of compaction.时间模型用 9 次压缩拟合,R² = 0.98;只用摘要大小是 0.95,只用输入大小是 0.20。闭式公式用来解释每个因素的影响方向,图上的曲线来自重放,保留了真实的请求顺序、上下文增长和压缩时点。