Expose session cost in statusLine JSON

Resolved 💬 3 comments Opened Jan 12, 2026 by davidrimshnick Closed Jan 12, 2026

Feature Request

Is your feature request related to a problem?

When using a custom statusLine command, I'd like to display the cumulative session cost. Currently, the JSON passed to the statusLine command includes token counts (input_tokens, output_tokens, cache_creation_input_tokens, cache_read_input_tokens) but not the actual session cost.

Attempting to calculate cost from these tokens doesn't match /cost output because:

  • Token counts represent current context state, not cumulative API usage
  • Agent subprocesses (Task tool) costs aren't captured
  • The calculation requires knowing which model was used for each call

Describe the solution you'd like

Add a totalCost or sessionCost field to the JSON passed to custom statusLine commands:

{
  "model": {...},
  "input_tokens": 1234,
  "output_tokens": 5678,
  "sessionCost": 2.45,
  ...
}

This would allow statusLine scripts to accurately display session cost without trying to replicate the internal cost tracking logic.

Describe alternatives you've considered

  • Calculating cost from token counts (inaccurate due to reasons above)
  • Tracking cumulative deltas in a state file (still misses subprocess costs)
  • Not showing cost in statusLine and using /cost manually

Additional context

The /cost command already tracks this data internally - this request is simply to expose it in the statusLine JSON payload.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗