feat(statestore): record a usage row for every model call

Task agent runs and MCP sampling record against their task (billed to the
task's org); gateway chat turns, titles, sampling and curators record
against the system org. Rows carry source, workflow, step, alias,
provider/model and tokens for later chargeback.
This commit is contained in:
sam committed 2026-10-10 18:32:43 +11:00
1 parent 12b9a57404
commit e4ea2eaabc
31 files changed
+1068 -322

No files matched your search

@@ -260,6 +260,23 @@ type Message struct {
Media []byte
}
type ModelUsage struct {
ID int64
OrgID string
Source string
TaskID int64
Attempt int64
Workflow string
Step string
Alias string
Provider string
Model string
InputTokens int64
OutputTokens int64
CachedTokens int64
At time.Time
}
type Org struct {
ID string
Name string