codex - 💡(How to fix) Fix Add "service_tier" to JSONL token usage logs [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20311Fetched 2026-05-01 05:44:10
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
0
Participants
Timeline (top)
labeled ×5unlabeled ×3

Code Example

{
  "type": "token_count",
  "info": {
    "last_token_usage": { "...": "..." },
    "total_token_usage": { "...": "..." },
    "service_tier": "priority"
  }
}
RAW_BUFFERClick to expand / collapse

What variant of Codex are you using?

CLI/App

What feature would you like to see?

The current JSONL files persist token usage via event_msg / token_count, including input, cached input, output, reasoning output, and total tokens.

Notably missing however is something like service_tier to understand if it was a normal or fast request.

This could be used to accurately estimate token usage and cost.

Minimal useful shape:

{
  "type": "token_count",
  "info": {
    "last_token_usage": { "...": "..." },
    "total_token_usage": { "...": "..." },
    "service_tier": "priority"
  }
}

Even adding service_tier to TurnContextItem or TokenCountEvent would be enough.

The service tier appears to already be logged temporarily in other logs, but they are not stable enough to use.

Additional information

Community tools like ccusage and OpenUsage calculate cost to provide an idea of how incredibly valuable the Codex subscription actually is.

It is however completely inaccurate, due to not knowing if a request was priority or not.

extent analysis

TL;DR

Adding a service_tier field to the JSONL files, such as in the info object of the token_count event, would allow for accurate estimation of token usage and cost.

Guidance

  • The current JSONL files lack a service_tier field, making it difficult to accurately estimate token usage and cost.
  • Adding this field to the info object of the token_count event, as shown in the minimal useful shape example, would provide the necessary information.
  • The service_tier information is already logged temporarily in other logs, but these logs are not stable enough to use.
  • Community tools like ccusage and OpenUsage could benefit from this addition, as they currently provide inaccurate cost calculations due to the lack of service_tier information.

Example

{
  "type": "token_count",
  "info": {
    "last_token_usage": { "...": "..." },
    "total_token_usage": { "...": "..." },
    "service_tier": "priority"
  }
}

Notes

The exact implementation details of adding the service_tier field are not specified, and it is unclear what the possible values for this field would be (e.g., "priority", "normal", etc.).

Recommendation

Apply workaround: Add the service_tier field to the JSONL files to enable accurate estimation of token usage and cost. This would provide the necessary information for community tools to calculate costs accurately.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Add "service_tier" to JSONL token usage logs [1 participants]