Skip to content

Commit 3c5fbca

Browse files
cursoragenterenozen
andcommitted
docs: document storedCost in JSON output
Describe the storedCost model breakdown field, link it from the auto cost mode's mixed-data rule, and list it among the fields --no-cost removes. Refs #1898 Co-authored-by: erenozen <[email protected]>
1 parent 4d65369 commit 3c5fbca

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎docs/guide/cost-modes.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ccusage daily
2626

2727
1. **Pre-calculated costs available** → Uses Claude's `costUSD` values
2828
2. **No pre-calculated costs** → Calculates from token counts using model pricing
29-
3. **Mixed data** → Uses the best method for each entry
29+
3. **Mixed data** → Uses the best method for each entry; JSON output reports the stored part of each model's cost as [`storedCost`](/guide/json-output#stored-costs)
3030

3131
#### Best for:
3232

‎docs/guide/json-output.md‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ccusage daily --json --no-cost
2727
ccusage blocks --json --no-cost
2828
```
2929

30-
This removes cost fields such as `totalCost`, `costUSD`, and nested `cost` values while keeping token, model, date, block, burn-rate, and projection fields.
30+
This removes cost fields such as `totalCost`, `costUSD`, `storedCost`, and nested `cost` values while keeping token, model, date, block, burn-rate, and projection fields.
3131

3232
## Unpriced Models
3333

@@ -286,6 +286,22 @@ ccusage daily --sections daily,monthly,session --by-agent --json
286286
}
287287
```
288288

289+
## Stored Costs
290+
291+
In `auto` [cost mode](/guide/cost-modes), an entry's `cost` can add together costs stored in the agent's logs (such as Claude's `costUSD`) and costs calculated from the pricing table. Each `modelBreakdowns` entry where at least one record used its stored cost carries `storedCost`, the part of `cost` that came from stored values; `cost - storedCost` is the calculated part. Entries without stored costs omit the key, and `calculate` and `display` modes never emit it.
292+
293+
```json
294+
{
295+
"modelName": "claude-sonnet-4-20250514",
296+
"inputTokens": 1500,
297+
"outputTokens": 100,
298+
"cacheCreationTokens": 20,
299+
"cacheReadTokens": 30,
300+
"cost": 0.503084,
301+
"storedCost": 0.5
302+
}
303+
```
304+
289305
## JSON Structure
290306

291307
### Daily Reports (Standard)

0 commit comments

Comments
 (0)