Show token usage breakdown at the end of codex exec
Summary
Human-readable codex exec output currently prints only one effective token count when a run finishes.
It should show the same detailed token summary as interactive Codex: effective total, non-cached input, cached input, output, and reasoning output.
User impact
A single combined number does not show whether usage came from new context, poor cache reuse, generated output, or reasoning.
Users must select --json in advance and process JSONL to obtain information already available internally.
Current behavior
A completed human-readable run ends with output similar to:
tokens used
1,234
The displayed value is the blended total: non-cached input plus output. Cached input and reasoning output are hidden.
Expected behavior
Show the detailed breakdown, for example:
Token usage: total=1,234 input=900 (+ 5,000 cached) output=334 (reasoning 120)
The exact layout may retain the existing codex exec section style, but its fields and accounting semantics should match interactive Codex.
Minimal reproduction
- Run
codex exec "Reply with one sentence.". - Wait for completion.
- Observe that the final token summary contains only one number.
- Compare with interactive Codex or the
turn.completed.usageevent fromcodex exec --json.
Notes from code/docs review
The human-output processor retains the full ThreadTokenUsage, but reduces it to blended_total() before printing.
The JSONL processor already exposes input, cached-input, output, and reasoning-output fields. The interactive CLI already formats these values into the requested summary. No protocol or backend change appears necessary.
Why this is not covered by existing issues
- #28083 requests the same breakdown for
/goalcompletion, which uses a different output path. - #16037 requests machine-readable
/statusoutput;codex exec --jsonalready provides these fields. - #20311 requests service-tier metadata in JSONL logs, not human-readable completion output.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗