Skip to content

Add reasoning token usage on json output #5276

@savva312

Description

@savva312

What feature would you like to see?

Currenly when calling codex cli using exec --json you get the usage like below

{
    "type": "turn.completed",
    "usage": {
        "input_tokens": 26549,
        "cached_input_tokens": 22272,
        "output_tokens": 1590
    }
}

but its missing the reasoning token count.

While this information is available in the session file that is created,

{
    "timestamp": "2025-10-17T05:54:20.209Z",
    "type": "event_msg",
    "payload": {
        "type": "token_count",
        "info": {
            "total_token_usage": {
                "input_tokens": 26549,
                "cached_input_tokens": 22272,
                "output_tokens": 1590,
                "reasoning_output_tokens": 1152,
                "total_tokens": 28139
            },
            "last_token_usage": {
                "input_tokens": 6245,
                "cached_input_tokens": 5376,
                "output_tokens": 407,
                "reasoning_output_tokens": 320,
                "total_tokens": 6652
            },
            "model_context_window": 272000
        },
        "rate_limits": {
            "primary": null,
            "secondary": null
        }
    }
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions