Commit 304fd58
fix(magnitude-core): fix cumulative token counting in ModelHarness._reportUsage()
The _reportUsage() method was incorrectly overwriting prevTotalInputTokens
and prevTotalOutputTokens instead of accumulating them. This caused the
tokensUsed event to emit inflated token counts (10-15x higher than actual
API usage) when using non-Anthropic providers (e.g., openai-generic).
Changed assignment operators from = to += to properly track cumulative
token usage across multiple LLM calls.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent dedb7c6 commit 304fd58
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
174 | | - | |
| 173 | + | |
| 174 | + | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
0 commit comments