Define observed cost values and aggregation

This commit is contained in:
2026-11-22 18:24:33 +00:00
parent 3d82cad2c9
commit 6ed0e037c4
13 changed files with 215 additions and 2 deletions

View File

@@ -298,6 +298,8 @@ type RunResult struct {
InputHashes map[string]string `json:"input_hashes,omitempty"`
// Usage is the token accounting reported by the LLM client.
Usage TokenUsage `json:"usage"`
// CostUSD is the observed charge subtotal across dispatched attempts.
CostUSD ObservedCost `json:"cost_usd"`
// StartTime is the UTC time immediately before ordinary Run preparation or
// after RunPrepared claims its handle.
StartTime time.Time `json:"start_time,omitempty"`
@@ -692,6 +694,8 @@ type GenerateResponse struct {
// UsagePresence states which usage fields were reported, including zeros.
// Nil uses the legacy observation fallback described by LLMClient.
UsagePresence *TokenUsagePresence `json:"usage_presence,omitempty"`
// CostUSD is an optional reported charge; a pointer to zero reports zero.
CostUSD *float64 `json:"cost_usd,omitempty"`
}
// TokenUsagePresence identifies provider-reported token counts for observation.