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
calculateTotalsCalculates total token usage and cost across multiple usage data entries
getTotalTokensCalculates the sum of all token types (input, output, cache creation, cache read)
createTotalsObjectCreates a complete totals object by adding total token count to existing totals

Released under the MIT License.