Token usage: keep cache/reasoning split, count only recorded steps, cost only when positive; captures fixture, docs and notes
This commit is contained in:
@@ -1448,6 +1448,10 @@ func stageUsage(snapshot stage.BudgetSnapshot) *protocol.StageUsage {
|
||||
usage.TokensTotal = snapshot.UsedTokens
|
||||
if snapshot.SplitKnown {
|
||||
usage.TokensIn, usage.TokensOut, usage.SplitKnown = snapshot.TokensInput, snapshot.TokensOutput, true
|
||||
// The rest of the component split is kept too: for a caching harness
|
||||
// most of the total is cache reads, which a client shows as cached
|
||||
// rather than fresh tokens.
|
||||
usage.TokensReasoning, usage.CacheRead, usage.CacheWrite, usage.CacheKnown = snapshot.TokensReasoning, snapshot.CacheRead, snapshot.CacheWrite, true
|
||||
}
|
||||
}
|
||||
if snapshot.USDKnown {
|
||||
|
||||
Reference in New Issue
Block a user