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

17
internal/domain/cost.go Normal file
View File

@@ -0,0 +1,17 @@
package domain
type CostSource string
const (
CostSourceNone CostSource = ""
CostSourceProvider CostSource = "provider"
CostSourceConfiguredZero CostSource = "configured_zero"
CostSourceMixed CostSource = "mixed"
)
type ObservedCost struct {
Value float64
Known bool
Complete bool
Source CostSource
}

View File

@@ -99,6 +99,7 @@ type RunResult struct {
EffectiveModelParams ExecutionTarget
InputHashes map[string]string
Usage TokenUsage
CostUSD ObservedCost
StartTime time.Time
EndTime time.Time
Duration time.Duration
@@ -328,6 +329,7 @@ type GenerateResponse struct {
Content string
Usage TokenUsage
UsagePresence *TokenUsagePresence
CostUSD *float64
}
// TokenUsagePresence records which token fields a provider reported.

View File

@@ -76,6 +76,7 @@ type ExecutionGroupSummary struct {
TransientRetries uint64
RepairCalls uint64
Usage ObservedTokenUsage
CostUSD ObservedCost
}
// ExecutionEvent contains metadata only; it carries no mutable containers or
@@ -101,6 +102,7 @@ type ExecutionEvent struct {
StatusCode int
RetriesExhausted bool
Usage ObservedTokenUsage
CostUSD ObservedCost
Attempts uint64
TransientRetries uint64
RepairCalls uint64