package protocol type RunCounts struct { Total int `json:"total"` Succeeded int `json:"succeeded"` Failed int `json:"failed"` Canceled int `json:"canceled"` Interrupted int `json:"interrupted"` Active int `json:"active"` AverageSeconds float64 `json:"average_seconds"` } type PipelineUsage struct { PipelineID int64 `json:"pipeline_id"` Name string `json:"name"` RunCounts } type DailyUsage struct { Date string `json:"date"` Runs int `json:"runs"` } // UsageTotals is the summed reported model usage over all stored run history. It // is summed from the same per-step usage rows the per-run figures use, so the // history-wide totals equal the sum of the per-run totals. A stage that reported // no cost counts in CostUnknownStages and contributes no fabricated or zero cost; // a stage that reported only a total (Pi) contributes to TokensTotal but not to // the in/out split, and SplitKnown is true only when every token-reporting stage // reported a split. type UsageTotals struct { TokensTotal int64 `json:"tokens_total"` TokensIn int64 `json:"tokens_in,omitempty"` TokensOut int64 `json:"tokens_out,omitempty"` SplitKnown bool `json:"split_known"` CostUSD float64 `json:"cost_usd,omitempty"` Stages int `json:"stages"` TokensKnownStages int `json:"tokens_known_stages"` SplitUnknownStages int `json:"split_unknown_stages,omitempty"` CostKnownStages int `json:"cost_known_stages"` CostUnknownStages int `json:"cost_unknown_stages,omitempty"` // The cache/reasoning components, as in RunUsage. TokensReasoning int64 `json:"tokens_reasoning,omitempty"` CacheRead int64 `json:"cache_read,omitempty"` CacheWrite int64 `json:"cache_write,omitempty"` CacheKnown bool `json:"cache_known,omitempty"` CacheKnownStages int `json:"cache_known_stages,omitempty"` } type UsageStats struct { RunCounts Pipelines []PipelineUsage `json:"pipelines"` Days []DailyUsage `json:"days"` // Usage is the history-wide sum of the per-run reported usage. It is absent // for a database with no recorded model usage (including a pre-upgrade one). Usage *UsageTotals `json:"usage,omitempty"` }