GPT-5.6 cache_write_tokens are dropped from TokenUsage and rollout JSONL
What version of Codex CLI is running?
codex-cli 0.144.1
What subscription do you have?
Not relevant to this source-level parsing issue.
Which model were you using?
gpt-5.6-sol
What platform is your computer?
Platform independent; confirmed in the current source.
What terminal emulator and version are you using?
Not applicable. This is a usage parsing and telemetry issue rather than a terminal-specific issue.
What issue are you seeing?
GPT-5.6 Responses report cache writes inusage.input_tokens_details.cache_write_tokens, but Codex currently drops
this field while parsing usage.
The current SSE response parser only declares cached_tokens:
The downstream TokenUsage structure also has no cache-write field:
Because unknown Serde fields are ignored, cache_write_tokens is discarded
before TokenCount events, app-server/SDK usage events, and rollout/session
JSONL are produced.
This creates an observability gap for GPT-5.6. Cache reads can be measured
through cached_input_tokens, but cache writes cannot be measured even though
GPT-5.6 cache writes are billed at 1.25x the uncached input-token rate.
This report concerns usage telemetry only. Server-side billing may still be
correct.
What steps can reproduce the bug?
- Run Codex with
gpt-5.6-sol. - Generate requests eligible for prompt caching.
- Inspect
token_countevents in the resulting rollout/session JSONL. - Observe that usage includes:
input_tokenscached_input_tokensoutput_tokensreasoning_output_tokenstotal_tokens
- Observe that
cache_write_tokensis never represented. - Inspect the SSE parser and
TokenUsagedefinitions linked above; neither
structure has a field capable of preserving the API value.
OpenAI documents cache_write_tokens here:
https://developers.openai.com/api/docs/guides/prompt-caching
What is the expected behavior?
Codex should preserve cache-write usage as an optional, backward-compatible
field through the complete usage path:
ResponseCompletedInputTokensDetails.cache_write_tokensTokenUsage.cache_write_tokens- total/last-token usage aggregation
TokenCountevents- app-server and SDK usage events
- rollout/session JSONL
Tests should cover deserialization, accumulation, serialization, and compatibility
with responses or old rollout records that do not contain the field.
Additional information
A related observability concern was previously raised in a comment on the
forked-subagent cache-lineage issue:
https://github.com/openai/codex/issues/24704#issuecomment-4937276202
A separate issue seems useful because cache-write telemetry affects all GPT-5.6
usage, independently of subagent fork behavior.