Cost Tracking & Command History
Session cost tracking and command history with paste support.
Cost Tracking
cost-tracker.ts
Tracks and persists all API costs, token usage, and duration metrics.
Key Functions
TypeScript
// Accumulate per-model costs
addToTotalSessionCost(model, usage, costUSD)
// Persist to project config (for session resumption)
saveCurrentSessionCosts()
// Restore costs when resuming a session
restoreCostStateForSession(sessionId)
// Human-readable summary
formatTotalCost()
// → "Total: $0.42 | Input: 50K | Output: 10K | Cache: 200K | Web: 3"