Include token_count events in non-interactive session files
What feature would you like to see?
Interactive sessions in Codex CLI don't emit token_count events to session JSONL files, making it impossible for third-party tools like @ccusage/codex to track token usage.
Current Behavior
When running Codex interactively (not via codex exec), the session files only contain:
session_metaturn_contextresponse_itemevent_msgwith types likeuser_message,turn_aborted
Missing: event_msg with payload.type: "token_count"
Expected Behavior
Based on issue #5276, Codex should emit token_count events like:
{
"timestamp": "...",
"type": "event_msg",
"payload": {
"type": "token_count",
"info": {
"total_token_usage": { "input_tokens": ..., "output_tokens": ..., ... },
"last_token_usage": { ... }
}
}
}
Environment
- Codex CLI: 0.88.0
- macOS Darwin 25.2.0
- Model: gpt-5.2-codex
Use Case
Third-party usage tracking tools (ccusage, etc.) rely on parsing session files to provide cost analysis without requiring API admin keys. Without token_count events, these tools report "No Codex usage data found."
Additional Information
I've verified this across multiple interactive sessions - none contain token_count events. The sessions were short but included both completed and aborted turns.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗