ccusage / calculate-cost / getTotalTokens
Function: getTotalTokens()
ts
function getTotalTokens(tokens): number;
Calculates the sum of all token types (input, output, cache creation, cache read)
Parameters
Parameter | Type | Description |
---|---|---|
tokens | TokenData | Token data containing different token counts |
Returns
number
Total number of tokens across all types