codeburn/packages/cli
iamtoruk 8a812abfe5 fix(codex): stop double-billing reasoning, price cache writes at the explicit rate only
Port of #1078 (plus its #1084 hardening) onto feat/core-extraction, whose
pricing seam moved out of the provider decoder.

Fix A: OpenAI bills reasoning tokens as part of output_tokens, not on top of
it. `billableOutputTokens` in models.ts is the single source of truth for the
claude+codex carve-out; the host pricing pass and cachedCallToApiCall (the
cold/warm twins) and the models/audit display sums all route through it.
codexCredits loses its `reasoningTokens` param, which added the same
double-count back on.

Fix B: the core codex decoder reads `cache_write_input_tokens` and clamps it
into the uncached input, but leaves the bucket split to the host: only a model
whose pricing source publishes a real cache-write rate
(`cacheWriteCostIsExplicit`) may move tokens into the cache-write bucket, since
buildCosts fabricates 1.25x input when a source omits one and OpenAI charges
nothing extra before gpt-5.6. The pricing cache file is versioned so a file
written by a pre-fix binary can't read that flag back as undefined.

Cache ladder: codex results cache 12 -> 13, codex parse version gains
`-codex-pricing-v1` (the bucket move does not self-heal on read), daily cache
27 -> 28.
2026-08-21 14:44:46 -07:00
..
src fix(codex): stop double-billing reasoning, price cache writes at the explicit rate only 2026-08-21 14:44:46 -07:00
tests fix(codex): stop double-billing reasoning, price cache writes at the explicit rate only 2026-08-21 14:44:46 -07:00
package.json chore: hold workspace versions at 0.9.20, defer the bump to release 2026-08-21 10:38:17 -07:00
tsconfig.json chore(workspace): move CLI to packages/cli, add @codeburn/core skeleton (phase 1) 2026-07-26 10:19:33 -07:00
tsup.config.ts chore(workspace): move CLI to packages/cli, add @codeburn/core skeleton (phase 1) 2026-07-26 10:19:33 -07:00
vitest.config.ts test(cli): restore CI timeout headroom and lock-suite quarantine lost in packages/cli split 2026-08-21 08:28:55 -07:00