ccusage / data-loader / calculateContextTokens
Function: calculateContextTokens()
ts
function calculateContextTokens(transcriptPath): Promise<
| null
| {
inputTokens: number;
percentage: number;
contextLimit: number;
}>;
Calculate context tokens from transcript file using improved JSONL parsing Based on the Python reference implementation for better accuracy
Parameters
Parameter | Type | Description |
---|---|---|
transcriptPath | string | Path to the transcript JSONL file |
Returns
Promise
< | null
| { inputTokens
: number
; percentage
: number
; contextLimit
: number
; }>
Object with context tokens info or null if unavailable