ccusage / calculate-cost
calculate-cost
Fileoverview
Cost calculation utilities for usage data analysis
This module provides functions for calculating costs and aggregating token usage across different time periods and models. It handles both pre-calculated costs and dynamic cost calculations based on model pricing.
Functions
Function | Description |
---|---|
getTotalTokens | Calculates the total number of tokens across all token types Supports both raw usage data format and aggregated data format |
calculateTotals | Calculates total token usage and cost across multiple usage data entries |
createTotalsObject | Creates a complete totals object by adding total token count to existing totals |