Skip to content

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

FunctionDescription
getTotalTokensCalculates the total number of tokens across all token types Supports both raw usage data format and aggregated data format
calculateTotalsCalculates total token usage and cost across multiple usage data entries
createTotalsObjectCreates a complete totals object by adding total token count to existing totals

Released under the MIT License.