MCPcopy
hub / github.com/claude-code-best/claude-code / formatTotalCost

Function formatTotalCost

src/cost-tracker.ts:229–245  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227}
228
229export function formatTotalCost(): string {
230 const costDisplay =
231 formatCost(getTotalCostUSD()) +
232 (hasUnknownModelCost()
233 ? ' (costs may be inaccurate due to usage of unknown models)'
234 : '')
235
236 const modelUsageDisplay = formatModelUsage()
237
238 return chalk.dim(
239 `Total cost: ${costDisplay}\n` +
240 `Total duration (API): ${formatDuration(getTotalAPIDuration())}
241Total duration (wall): ${formatDuration(getTotalDuration())}
242Total code changes: ${getTotalLinesAdded()} ${getTotalLinesAdded() === 1 ? 'line' : 'lines'} added, ${getTotalLinesRemoved()} ${getTotalLinesRemoved() === 1 ? 'line' : 'lines'} removed
243${modelUsageDisplay}`,
244 )
245}
246
247function round(number: number, precision: number): number {
248 return Math.round(number * precision) / precision

Callers 2

fFunction · 0.85
callFunction · 0.85

Calls 9

formatCostFunction · 0.85
getTotalCostUSDFunction · 0.85
hasUnknownModelCostFunction · 0.85
formatModelUsageFunction · 0.85
getTotalAPIDurationFunction · 0.85
getTotalDurationFunction · 0.85
getTotalLinesAddedFunction · 0.85
getTotalLinesRemovedFunction · 0.85
formatDurationFunction · 0.50

Tested by

no test coverage detected