Add last-request and cache fields to Usage (N3 WP6)
Why: the loop now emits Last* and cache token usage; the product run record needs the same fields for display and accounting (additive JSON, old records deserialize as zero values). Evidence: GOWORK=off go build + go test green. Impact: additive only. Refs: Agent-Native#35, N3 plan WP6
This commit is contained in:
@@ -208,6 +208,12 @@ type Usage struct {
|
|||||||
TotalTokens int `json:"totalTokens"`
|
TotalTokens int `json:"totalTokens"`
|
||||||
DurationMs float64 `json:"durationMs"`
|
DurationMs float64 `json:"durationMs"`
|
||||||
ToolCalls int `json:"toolCalls"`
|
ToolCalls int `json:"toolCalls"`
|
||||||
|
// 以下四项是 N3 的计费拆分(additive;旧记录为零值省略):
|
||||||
|
// Last* 是最近一次请求的用量(上一请求),Cache* 是缓存命中累计。
|
||||||
|
LastPromptTokens int `json:"lastPromptTokens,omitempty"`
|
||||||
|
LastCompletionTokens int `json:"lastCompletionTokens,omitempty"`
|
||||||
|
CacheReadTokens int `json:"cacheReadTokens,omitempty"`
|
||||||
|
CacheWriteTokens int `json:"cacheWriteTokens,omitempty"`
|
||||||
// Model 是实际给出这段用量的模型。空表示当时没有记录。
|
// Model 是实际给出这段用量的模型。空表示当时没有记录。
|
||||||
Model string `json:"model,omitempty"`
|
Model string `json:"model,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user