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.
What do you want to change?
Add the
modelBreakdownsarray 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
modelsUsedand a summedtotalCost, 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 howsummary_jsondoes it. Purely additive — no existing key changes. I'd leave the codex-native serializer alone since it has its ownmodelsshape.I have this implemented with tests (snapshot + fixture assertions with real pricing) and can open a PR.