Record the model that served a run's usage
Why: a fallback chain can answer with a different model than the one that was requested, and usage has to name the model that actually served. Evidence: go test . Impact: the field is omitted when empty, so existing usage JSON stays the same. Refs: feature/durable-rewind Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -201,6 +201,8 @@ type Usage struct {
|
||||
TotalTokens int `json:"totalTokens"`
|
||||
DurationMs float64 `json:"durationMs"`
|
||||
ToolCalls int `json:"toolCalls"`
|
||||
// Model 是实际给出这段用量的模型。空表示当时没有记录。
|
||||
Model string `json:"model,omitempty"`
|
||||
}
|
||||
|
||||
// ---- 工件 ----
|
||||
|
||||
@@ -54,6 +54,7 @@ export type RunPhase = 'thinking' | 'acting' | 'responding' | 'finalizing' | 'do
|
||||
export interface Usage {
|
||||
promptTokens: number; completionTokens: number; totalTokens: number;
|
||||
durationMs: number; toolCalls: number;
|
||||
model?: string;
|
||||
}
|
||||
|
||||
export interface Run {
|
||||
|
||||
Reference in New Issue
Block a user