What happened?
As explained by codex
• ccusage is counting Codex transcript records as if they were unique API calls. On
this system, that is not valid.
The short version: Codex forked/subagent session files copy parent history into each
child JSONL. For 2026-06-21, I found 99 Codex session files, and 98 of them contain
the same parent session id. A large child file starts with two session_meta records,
one for the child and one for the parent, then immediately replays thousands of
token_count rows at the child creation timestamp. One file alone has 14,741
token_count rows and a cumulative total_token_usage ending at about 2.19 billion.
So bunx ccusage codex daily --since 20260621 --until 20260621 sees those copied rows
as same-day usage. I ran the equivalent native binary offline and it reports:
totalTokens: 44,867,297,211
costUSD: 33,780.93
That number is inflated because it is summing duplicated serialized history, not
actual sampling events. The better source is Codex’s logs_2.sqlite “post sampling
token usage” events, then matching those to the relevant last_token_usage entries.
Using that method, yesterday looked like about 13.52M actual tokens and roughly
US$16.32 at GPT-5.5 API pricing with cached-input pricing.
Steps to reproduce
fork codex the ccusage
Expected behavior
No response
Version
No response
What happened?
As explained by codex
• ccusage is counting Codex transcript records as if they were unique API calls. On
this system, that is not valid.
The short version: Codex forked/subagent session files copy parent history into each
child JSONL. For 2026-06-21, I found 99 Codex session files, and 98 of them contain
the same parent session id. A large child file starts with two session_meta records,
one for the child and one for the parent, then immediately replays thousands of
token_count rows at the child creation timestamp. One file alone has 14,741
token_count rows and a cumulative total_token_usage ending at about 2.19 billion.
So bunx ccusage codex daily --since 20260621 --until 20260621 sees those copied rows
as same-day usage. I ran the equivalent native binary offline and it reports:
totalTokens: 44,867,297,211
costUSD: 33,780.93
That number is inflated because it is summing duplicated serialized history, not
actual sampling events. The better source is Codex’s logs_2.sqlite “post sampling
token usage” events, then matching those to the relevant last_token_usage entries.
Using that method, yesterday looked like about 13.52M actual tokens and roughly
US$16.32 at GPT-5.5 API pricing with cached-input pricing.
Steps to reproduce
fork codex the ccusage
Expected behavior
No response
Version
No response