Breaking Changes
- Added
totalTokensfield toUsagetype: All code that constructsUsageobjects must now include thetotalTokensfield. This field represents the total tokens processed by the LLM (input + output + cache). For OpenAI and Google, this uses native API values (total_tokens,totalTokenCount). For Anthropic, it's computed asinput + output + cacheRead + cacheWrite.
Details
- Added comprehensive test covering 13 providers (Anthropic, OpenAI Completions/Responses, Google, xAI, Groq, Cerebras, z.ai, and 5 OpenRouter backends)
- Fixed openai-completions to compute totalTokens consistently when reasoning tokens are present
- Updated
calculateContextTokens()in compaction.ts to usetotalTokensfield
Closes #130