feat: add agent cost reporting

This commit is contained in:
2026-07-09 20:29:56 +08:00
parent fc5a5365d8
commit 716101eed0
9 changed files with 275 additions and 7 deletions
+5
View File
@@ -247,6 +247,10 @@ model AgentRun {
summary String?
inputTokens Int?
outputTokens Int?
/// Provider/gateway-reported cost in USD. Null means this run has no trusted cost fact.
costUsd Decimal? @db.Decimal(18, 8)
/// Semantic source of costUsd, e.g. provider_reported. Not a pricing-estimate fallback.
costSource String?
metadata Json
error String?
startedAt DateTime @default(now())
@@ -261,6 +265,7 @@ model AgentRun {
fileChanges AgentFileChange[] @relation("runFileChanges")
@@index([projectId, status])
@@index([projectId, finishedAt])
@@index([sessionId])
@@index([requestedByUserId])
@@index([updatedAt])