v6

latestOpenAPI 3.1.0raw.githubusercontent.com2026-08-01485121699.8 KB

Get Cost History

Return cost history for chart visualization.

Two response modes share one endpoint:

  • GET /costs/history?hours=24&granularity=hour (web GUI sparkline) - returns a flat [{ts, usd}] array bucketed from cost-tracker usages over the last hours window.
  • GET /costs/history or ?envelope=1 (legacy/CLI) - returns the original {history, trend, burn_rate_*, history_days} envelope built from .sdd/metrics/cost_history.jsonl daily snapshots.

The sparkline branch lets the GUI feed recharts directly without unwrapping a .history field.

get/costs/history

Query parameters

hoursinteger nullable
granularitystring
envelopeinteger

Response

Successful Response

{"stackTrail":"paths:/costs/history:get:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}