fix: record zero usage

This commit is contained in:
Michael
2026-04-06 20:19:42 +08:00
parent ada8e2905e
commit 8b9dbe10f0
2 changed files with 97 additions and 3 deletions
@@ -69,9 +69,6 @@ func (r *UsageReporter) publishWithOutcome(ctx context.Context, detail usage.Det
detail.TotalTokens = total
}
}
if detail.InputTokens == 0 && detail.OutputTokens == 0 && detail.ReasoningTokens == 0 && detail.CachedTokens == 0 && detail.TotalTokens == 0 && !failed {
return
}
r.once.Do(func() {
usage.PublishRecord(ctx, r.buildRecord(detail, failed))
})