Skip to content

Per-agent JSON reports should include modelBreakdowns #1391

Description

@ben-vargas

What do you want to change?

Add the modelBreakdowns array to the JSON output of the per-agent subcommands (ccusage pi daily --json, ccusage opencode session --json, etc.). The unified commands already emit it, and the per-agent table view already renders the same data with --breakdown — the per-agent JSON serializer is the one output path that drops it.

Why?

I'm consuming per-agent JSON from a script and hit a wall: the rows give me modelsUsed and a summed totalCost, but no way to know what each model cost. And it's not something I can compute on my side — the split depends on ccusage's pricing data, cache-tier rates, and dedupe. The only workaround is re-parsing the raw session files and redoing the cost math ccusage already did.

Since the breakdown is already computed for every row (the table proves it), emitting it in JSON is free and makes per-agent output consistent with the unified output.

How? (optional)

One addition to the shared serializer (agent_summary_json), mirroring how summary_json does it. Purely additive — no existing key changes. I'd leave the codex-native serializer alone since it has its own models shape.

I have this implemented with tests (snapshot + fixture assertions with real pricing) and can open a PR.

Activity

  1. pullfrog commented on Jul 4, 2026

    @pullfrog
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions