ccusage / data-loader / calculateContextTokens
Function: calculateContextTokens()
ts
function calculateContextTokens(
transcriptPath,
modelId?,
offline?): 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 | Default value | Description |
|---|---|---|---|
transcriptPath | string | undefined | Path to the transcript JSONL file |
modelId? | string | undefined | - |
offline? | boolean | false | - |
Returns
Promise< | null | { inputTokens: number; percentage: number; contextLimit: number; }>
Object with context tokens info or null if unavailable