sprag-cli 3.99.1 → 3.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/claude-price.js +3 -2
- package/src/cost.js +152 -35
- package/src/net-saving.js +4 -4
- package/src/route-scan.js +13 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprag-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.100.0",
|
|
4
4
|
"description": "Model-delegation router for Claude Code and Codex: lookups, checks and test runs go to cheaper models, documents go in as compact Markdown, and a live statusline shows spend and savings.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/claude-price.js
CHANGED
|
@@ -10,8 +10,9 @@ import { estimateCost, estimateCostAcross } from './cost.js';
|
|
|
10
10
|
import { gatewayPriceFor } from './litellm-models.js';
|
|
11
11
|
import { gatewayBase } from './gateway-auth.js';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// `at` is when the tokens were spent; list prices are looked up for that time.
|
|
14
|
+
export function sessionCost(totals, model, { env = process.env, now, at } = {}) {
|
|
15
|
+
if (!gatewayBase(env)) return estimateCost(totals, model, { at });
|
|
15
16
|
const price = gatewayPriceFor(model, env, now);
|
|
16
17
|
return price ? estimateCost(totals, model, { price }) : null;
|
|
17
18
|
}
|
package/src/cost.js
CHANGED
|
@@ -16,125 +16,239 @@ import { priceForPrompt } from './gateway-prices.js';
|
|
|
16
16
|
// `totals.long` (see parser.js) rather than relying on session-wide sums.
|
|
17
17
|
export const LONG_PROMPT_THRESHOLD = 100_000;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// Each tier lists its rate cards oldest first, with the date each took effect
|
|
20
|
+
// (`from`, a UTC YYYY-MM-DD; null = since the model launched). A price change
|
|
21
|
+
// or a correction is a new row, never an edit of an old one, so a run is
|
|
22
|
+
// always priced at the rate that applied when it happened (#15).
|
|
23
|
+
const PRICE_HISTORY = {
|
|
20
24
|
// Fable 5.1 / Mythos 5.1 — same prices as Fable 5 except cache reads, which
|
|
21
25
|
// drop to $0.25.
|
|
22
|
-
'claude-fable-5-1': {
|
|
26
|
+
'claude-fable-5-1': [{
|
|
27
|
+
from: null,
|
|
23
28
|
input: 10.0,
|
|
24
29
|
cacheWrite5m: 12.5,
|
|
25
30
|
cacheWrite1h: 20.0,
|
|
26
31
|
cacheRead: 0.25,
|
|
27
32
|
output: 50.0,
|
|
28
|
-
},
|
|
33
|
+
}],
|
|
29
34
|
// Fable 5 / Mythos 5 — premium tier above Opus ($10/$50). Cache write
|
|
30
35
|
// rates follow the standard multipliers (1.25x input for 5m, 2x for 1h),
|
|
31
36
|
// cache read is 0.1x input.
|
|
32
|
-
'claude-fable-5': {
|
|
37
|
+
'claude-fable-5': [{
|
|
38
|
+
from: null,
|
|
33
39
|
input: 10.0,
|
|
34
40
|
cacheWrite5m: 12.5,
|
|
35
41
|
cacheWrite1h: 20.0,
|
|
36
42
|
cacheRead: 1.0,
|
|
37
43
|
output: 50.0,
|
|
38
|
-
},
|
|
44
|
+
}],
|
|
39
45
|
// Opus 5.5 — cheaper than the Opus 4.5-5 tier below.
|
|
40
|
-
'claude-opus-5-5': {
|
|
46
|
+
'claude-opus-5-5': [{
|
|
47
|
+
from: null,
|
|
41
48
|
input: 4.0,
|
|
42
49
|
cacheWrite5m: 5.0,
|
|
43
50
|
cacheWrite1h: 8.0,
|
|
44
51
|
cacheRead: 0.2,
|
|
45
52
|
output: 20.0,
|
|
46
|
-
},
|
|
53
|
+
}],
|
|
47
54
|
// Opus 4.5+ (new pricing tier — includes 4.5, 4.6, 4.7, 4.8, and future)
|
|
48
|
-
'claude-opus-new': {
|
|
55
|
+
'claude-opus-new': [{
|
|
56
|
+
from: null,
|
|
49
57
|
input: 5.0,
|
|
50
58
|
cacheWrite5m: 6.25,
|
|
51
59
|
cacheWrite1h: 10.0,
|
|
52
60
|
cacheRead: 0.5,
|
|
53
61
|
output: 25.0,
|
|
54
|
-
},
|
|
62
|
+
}],
|
|
55
63
|
// Opus 4 / 4.1 / Opus 3 (legacy premium pricing)
|
|
56
|
-
'claude-opus-legacy': {
|
|
64
|
+
'claude-opus-legacy': [{
|
|
65
|
+
from: null,
|
|
57
66
|
input: 15.0,
|
|
58
67
|
cacheWrite5m: 18.75,
|
|
59
68
|
cacheWrite1h: 30.0,
|
|
60
69
|
cacheRead: 1.5,
|
|
61
70
|
output: 75.0,
|
|
62
|
-
},
|
|
71
|
+
}],
|
|
63
72
|
// Sonnet 5 — standard price is $2/$10. The rise to $3/$15 planned for
|
|
64
73
|
// 2026-09-01 was cancelled, so this is not an introductory rate.
|
|
65
|
-
'claude-sonnet-5': {
|
|
74
|
+
'claude-sonnet-5': [{
|
|
75
|
+
from: null,
|
|
66
76
|
input: 2.0,
|
|
67
77
|
cacheWrite5m: 2.5,
|
|
68
78
|
cacheWrite1h: 4.0,
|
|
69
79
|
cacheRead: 0.2,
|
|
70
80
|
output: 10.0,
|
|
71
|
-
},
|
|
72
|
-
// Sonnet 5.5 —
|
|
73
|
-
|
|
81
|
+
}],
|
|
82
|
+
// Sonnet 5.5 — launched 2026-09-28 with Sonnet 5's prices. Cache reads were
|
|
83
|
+
// cut from $0.20 to $0.10 on 2026-10-07 ("We've lowered the price of prompt
|
|
84
|
+
// cache reads on Claude Sonnet 5.5 from $0.20 USD to $0.10 USD", platform
|
|
85
|
+
// release notes); every other rate is unchanged.
|
|
86
|
+
'claude-sonnet-5-5': [{
|
|
87
|
+
from: null,
|
|
88
|
+
input: 2.0,
|
|
89
|
+
cacheWrite5m: 2.5,
|
|
90
|
+
cacheWrite1h: 4.0,
|
|
91
|
+
cacheRead: 0.2,
|
|
92
|
+
output: 10.0,
|
|
93
|
+
}, {
|
|
94
|
+
from: '2026-10-07',
|
|
74
95
|
input: 2.0,
|
|
75
96
|
cacheWrite5m: 2.5,
|
|
76
97
|
cacheWrite1h: 4.0,
|
|
77
98
|
cacheRead: 0.1,
|
|
78
99
|
output: 10.0,
|
|
79
|
-
},
|
|
100
|
+
}],
|
|
80
101
|
// Sonnet 4 / 4.5 / 4.6 / 3.7
|
|
81
|
-
'claude-sonnet': {
|
|
102
|
+
'claude-sonnet': [{
|
|
103
|
+
from: null,
|
|
82
104
|
input: 3.0,
|
|
83
105
|
cacheWrite5m: 3.75,
|
|
84
106
|
cacheWrite1h: 6.0,
|
|
85
107
|
cacheRead: 0.3,
|
|
86
108
|
output: 15.0,
|
|
87
|
-
},
|
|
109
|
+
}],
|
|
88
110
|
// Haiku 5.5, prompt <= LONG_PROMPT_THRESHOLD tokens.
|
|
89
|
-
'claude-haiku-5-5': {
|
|
111
|
+
'claude-haiku-5-5': [{
|
|
112
|
+
from: null,
|
|
90
113
|
input: 0.1,
|
|
91
114
|
cacheWrite5m: 0.125,
|
|
92
115
|
cacheWrite1h: 0.2,
|
|
93
116
|
cacheRead: 0.01,
|
|
94
117
|
output: 0.5,
|
|
95
|
-
},
|
|
118
|
+
}],
|
|
96
119
|
// Haiku 5.5, prompt > LONG_PROMPT_THRESHOLD tokens. Not returned by
|
|
97
120
|
// detectPricingTier: estimateCost applies it to `totals.long` only.
|
|
98
|
-
'claude-haiku-5-5-long': {
|
|
121
|
+
'claude-haiku-5-5-long': [{
|
|
122
|
+
from: null,
|
|
99
123
|
input: 0.5,
|
|
100
124
|
cacheWrite5m: 0.625,
|
|
101
125
|
cacheWrite1h: 1.0,
|
|
102
126
|
cacheRead: 0.05,
|
|
103
127
|
output: 2.5,
|
|
104
|
-
},
|
|
128
|
+
}],
|
|
105
129
|
// Haiku 4.5
|
|
106
|
-
'claude-haiku-4-5': {
|
|
130
|
+
'claude-haiku-4-5': [{
|
|
131
|
+
from: null,
|
|
107
132
|
input: 1.0,
|
|
108
133
|
cacheWrite5m: 1.25,
|
|
109
134
|
cacheWrite1h: 2.0,
|
|
110
135
|
cacheRead: 0.1,
|
|
111
136
|
output: 5.0,
|
|
112
|
-
},
|
|
137
|
+
}],
|
|
113
138
|
// Haiku 3.5
|
|
114
|
-
'claude-haiku-3-5': {
|
|
139
|
+
'claude-haiku-3-5': [{
|
|
140
|
+
from: null,
|
|
115
141
|
input: 0.8,
|
|
116
142
|
cacheWrite5m: 1.0,
|
|
117
143
|
cacheWrite1h: 1.6,
|
|
118
144
|
cacheRead: 0.08,
|
|
119
145
|
output: 4.0,
|
|
120
|
-
},
|
|
146
|
+
}],
|
|
121
147
|
// Haiku 3 (deprecated)
|
|
122
|
-
'claude-haiku-3': {
|
|
148
|
+
'claude-haiku-3': [{
|
|
149
|
+
from: null,
|
|
123
150
|
input: 0.25,
|
|
124
151
|
cacheWrite5m: 0.3,
|
|
125
152
|
cacheWrite1h: 0.5,
|
|
126
153
|
cacheRead: 0.03,
|
|
127
154
|
output: 1.25,
|
|
128
|
-
},
|
|
155
|
+
}],
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/** Milliseconds for a `from` date, or -Infinity for "since launch". */
|
|
159
|
+
const fromMs = (from) => (from ? Date.parse(`${from}T00:00:00Z`) : -Infinity);
|
|
160
|
+
|
|
161
|
+
const toMs = (at) => {
|
|
162
|
+
if (at === undefined || at === null) return Date.now();
|
|
163
|
+
const n = typeof at === 'number' ? at : Date.parse(at);
|
|
164
|
+
return Number.isFinite(n) ? n : Date.now();
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The rate card of a tier in effect at `at` (ms or a date string; default
|
|
169
|
+
* now): the newest row whose `from` is not after it. A time before the first
|
|
170
|
+
* dated row gets the first row, since that is the earliest price known.
|
|
171
|
+
*/
|
|
172
|
+
export function ratesAt(tier, at) {
|
|
173
|
+
const rows = PRICE_HISTORY[tier];
|
|
174
|
+
if (!rows) return null;
|
|
175
|
+
const t = toMs(at);
|
|
176
|
+
let pick = rows[0];
|
|
177
|
+
for (const r of rows) if (fromMs(r.from) <= t) pick = r;
|
|
178
|
+
return pick;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Every dated row of a tier, oldest first (for audits and the upstream watch). */
|
|
182
|
+
export function priceHistory(tier) {
|
|
183
|
+
return (PRICE_HISTORY[tier] || []).map((r) => ({ ...r }));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// What a bare alias meant over time: the model Claude Code sent for it from
|
|
187
|
+
// each date on, oldest first. An alias moves to a new model on launch day, so
|
|
188
|
+
// a run recorded as `opus` is priced as the Opus that was current then, not
|
|
189
|
+
// the oldest Opus in the table (#13).
|
|
190
|
+
// Dates are the launch days in the platform release notes
|
|
191
|
+
// (https://platform.claude.com/docs/en/release-notes/overview); Claude Code
|
|
192
|
+
// moved its aliases on or shortly after them. A time before the first row
|
|
193
|
+
// resolves to the first row.
|
|
194
|
+
const ALIAS_HISTORY = {
|
|
195
|
+
opus: [
|
|
196
|
+
{ from: '2025-05-22', model: 'claude-opus-4-20250514' },
|
|
197
|
+
{ from: '2025-08-05', model: 'claude-opus-4-1-20250805' },
|
|
198
|
+
{ from: '2025-11-24', model: 'claude-opus-4-5-20251101' },
|
|
199
|
+
{ from: '2026-02-05', model: 'claude-opus-4-6' },
|
|
200
|
+
{ from: '2026-04-16', model: 'claude-opus-4-7' },
|
|
201
|
+
{ from: '2026-05-28', model: 'claude-opus-4-8' },
|
|
202
|
+
{ from: '2026-07-24', model: 'claude-opus-5' },
|
|
203
|
+
{ from: '2026-09-22', model: 'claude-opus-5-5' },
|
|
204
|
+
],
|
|
205
|
+
sonnet: [
|
|
206
|
+
{ from: '2025-05-22', model: 'claude-sonnet-4-20250514' },
|
|
207
|
+
{ from: '2025-09-29', model: 'claude-sonnet-4-5-20250929' },
|
|
208
|
+
{ from: '2026-02-17', model: 'claude-sonnet-4-6' },
|
|
209
|
+
{ from: '2026-06-30', model: 'claude-sonnet-5' },
|
|
210
|
+
{ from: '2026-09-28', model: 'claude-sonnet-5-5' },
|
|
211
|
+
],
|
|
212
|
+
haiku: [
|
|
213
|
+
{ from: null, model: 'claude-3-5-haiku-20241022' },
|
|
214
|
+
{ from: '2025-10-15', model: 'claude-haiku-4-5-20251001' },
|
|
215
|
+
{ from: '2026-10-07', model: 'claude-haiku-5-5' },
|
|
216
|
+
],
|
|
217
|
+
fable: [
|
|
218
|
+
{ from: '2026-06-09', model: 'claude-fable-5' },
|
|
219
|
+
{ from: '2026-09-01', model: 'claude-fable-5-1' },
|
|
220
|
+
],
|
|
129
221
|
};
|
|
130
222
|
|
|
223
|
+
// Spellings that name an alias rather than a model: the bare family, its
|
|
224
|
+
// `[1m]` form, and the Claude Code shorthands that resolve to a family.
|
|
225
|
+
const ALIAS_OF = { opus: 'opus', opusplan: 'opus', sonnet: 'sonnet', haiku: 'haiku', fable: 'fable', best: 'fable' };
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* The model a bare alias stood for at `at`, or null when `model` is not an
|
|
229
|
+
* alias (a full id passes through untouched at the call site).
|
|
230
|
+
*/
|
|
231
|
+
export function resolveAlias(model, at) {
|
|
232
|
+
if (typeof model !== 'string') return null;
|
|
233
|
+
const key = ALIAS_OF[model.trim().toLowerCase().replace(/\[1m\]$/, '')];
|
|
234
|
+
const rows = key && ALIAS_HISTORY[key];
|
|
235
|
+
if (!rows || rows.length === 0) return null;
|
|
236
|
+
const t = toMs(at);
|
|
237
|
+
let pick = null;
|
|
238
|
+
for (const r of rows) if (fromMs(r.from) <= t) pick = r;
|
|
239
|
+
return (pick || rows[0]).model;
|
|
240
|
+
}
|
|
241
|
+
|
|
131
242
|
/**
|
|
132
243
|
* Detect pricing tier from Claude model identifier.
|
|
133
244
|
* Examples: 'claude-opus-4-7', 'claude-sonnet-4-5', 'claude-haiku-4-5'.
|
|
245
|
+
* A bare alias (`opus`, `sonnet[1m]`) is first resolved to the model it meant
|
|
246
|
+
* at `at` (default now).
|
|
134
247
|
*/
|
|
135
|
-
export function detectPricingTier(model) {
|
|
248
|
+
export function detectPricingTier(model, { at } = {}) {
|
|
136
249
|
if (!model) return 'claude-sonnet';
|
|
137
|
-
const
|
|
250
|
+
const resolved = resolveAlias(model, at);
|
|
251
|
+
const m = (resolved || model).toLowerCase();
|
|
138
252
|
|
|
139
253
|
// Fable 5 / Mythos 5 — must be checked before the generic fallback:
|
|
140
254
|
// without this, 'claude-fable-5' fell through to the Sonnet tier and
|
|
@@ -283,10 +397,13 @@ function tokensToMillions(n) {
|
|
|
283
397
|
* ephemeral5m — portion of cacheCreation billed at 5m rate (1.25x input)
|
|
284
398
|
* ephemeral1h — portion of cacheCreation billed at 1h rate (2x input)
|
|
285
399
|
* output — output tokens
|
|
400
|
+
*
|
|
401
|
+
* `at` (ms or a date string, default now) is when the tokens were spent: the
|
|
402
|
+
* list price is the one in effect then (see ratesAt).
|
|
286
403
|
*/
|
|
287
|
-
export function estimateCost(totals, model, { price } = {}) {
|
|
404
|
+
export function estimateCost(totals, model, { price, at } = {}) {
|
|
288
405
|
if (price) return estimateCostAtPrice(totals, price);
|
|
289
|
-
const tier = detectPricingTier(model);
|
|
406
|
+
const tier = detectPricingTier(model, { at });
|
|
290
407
|
|
|
291
408
|
// Haiku 5.5 prices each request by its own prompt length, so the long-prompt
|
|
292
409
|
// part (`totals.long`, same shape) is priced at the long rates and the rest
|
|
@@ -294,8 +411,8 @@ export function estimateCost(totals, model, { price } = {}) {
|
|
|
294
411
|
let c;
|
|
295
412
|
if (tier === 'claude-haiku-5-5' && totals.long) {
|
|
296
413
|
const short = subtractTotals(totals, totals.long);
|
|
297
|
-
const a = priceTotals(short,
|
|
298
|
-
const b = priceTotals(totals.long,
|
|
414
|
+
const a = priceTotals(short, ratesAt(tier, at));
|
|
415
|
+
const b = priceTotals(totals.long, ratesAt('claude-haiku-5-5-long', at));
|
|
299
416
|
c = {
|
|
300
417
|
actual: a.actual + b.actual,
|
|
301
418
|
noCacheCost: a.noCacheCost + b.noCacheCost,
|
|
@@ -303,7 +420,7 @@ export function estimateCost(totals, model, { price } = {}) {
|
|
|
303
420
|
write1h: a.write1h + b.write1h,
|
|
304
421
|
};
|
|
305
422
|
} else {
|
|
306
|
-
c = priceTotals(totals,
|
|
423
|
+
c = priceTotals(totals, ratesAt(tier, at));
|
|
307
424
|
}
|
|
308
425
|
const { actual, noCacheCost, scenario5mCost, write1h } = c;
|
|
309
426
|
|
package/src/net-saving.js
CHANGED
|
@@ -49,11 +49,11 @@ export function priceSource(env = process.env) {
|
|
|
49
49
|
* touches. Cache writes are taken at the 5-minute rate, the cheaper of the two.
|
|
50
50
|
* null when any of them has no price.
|
|
51
51
|
*/
|
|
52
|
-
export function unitRates(model, { env = process.env } = {}) {
|
|
52
|
+
export function unitRates(model, { env = process.env, at } = {}) {
|
|
53
53
|
if (!model) return null;
|
|
54
54
|
const rate = (totals) => {
|
|
55
55
|
let c;
|
|
56
|
-
try { c = sessionCost({ ...ZERO, ...totals }, model, { env }); } catch { return null; }
|
|
56
|
+
try { c = sessionCost({ ...ZERO, ...totals }, model, { env, at }); } catch { return null; }
|
|
57
57
|
return c ? c.actual / RATE_SCALE : null;
|
|
58
58
|
};
|
|
59
59
|
const cacheRead = rate({ cacheRead: RATE_SCALE });
|
|
@@ -67,7 +67,7 @@ export function unitRates(model, { env = process.env } = {}) {
|
|
|
67
67
|
* What a run's tokens cost on a model, in USD, to better than a cent. null when
|
|
68
68
|
* the model has no price on this path.
|
|
69
69
|
*/
|
|
70
|
-
export function exactCost(totals, model, { env = process.env } = {}) {
|
|
70
|
+
export function exactCost(totals, model, { env = process.env, at } = {}) {
|
|
71
71
|
if (!model) return null;
|
|
72
72
|
const scale = (t) => {
|
|
73
73
|
const out = {};
|
|
@@ -77,7 +77,7 @@ export function exactCost(totals, model, { env = process.env } = {}) {
|
|
|
77
77
|
const scaled = scale(totals);
|
|
78
78
|
if (totals.long) scaled.long = scale(totals.long);
|
|
79
79
|
let c;
|
|
80
|
-
try { c = sessionCost(scaled, model, { env }); } catch { return null; }
|
|
80
|
+
try { c = sessionCost(scaled, model, { env, at }); } catch { return null; }
|
|
81
81
|
return c ? c.actual / COST_SCALE : null;
|
|
82
82
|
}
|
|
83
83
|
|
package/src/route-scan.js
CHANGED
|
@@ -377,11 +377,17 @@ export function worthDelegating(tier, rank) {
|
|
|
377
377
|
* negative. null means a side has no price (a gateway session whose /model/info
|
|
378
378
|
* table lacks the model), which is unpriced, not zero.
|
|
379
379
|
*/
|
|
380
|
+
/** When a run spent its tokens, for the dated price lookup; undefined means now. */
|
|
381
|
+
const runTime = (run) => (Number.isFinite(run?.startedAt) ? run.startedAt : Number.isFinite(run?.endedAt) ? run.endedAt : undefined);
|
|
382
|
+
|
|
380
383
|
export function runSaving(run, mainModel, { env = process.env } = {}) {
|
|
381
384
|
if (!run.model || !mainModel) return null;
|
|
382
385
|
const totals = runTotals(run);
|
|
383
|
-
|
|
384
|
-
|
|
386
|
+
// Priced at the rates in effect when the run happened, so a later price
|
|
387
|
+
// change does not rewrite a saving already earned (#15).
|
|
388
|
+
const at = runTime(run);
|
|
389
|
+
const actual = sessionCost(totals, run.model, { env, at });
|
|
390
|
+
const counterfactual = sessionCost(totals, mainModel, { env, at });
|
|
385
391
|
if (!actual || !counterfactual) return null;
|
|
386
392
|
return counterfactual.actual - actual.actual;
|
|
387
393
|
}
|
|
@@ -403,8 +409,9 @@ export function runSavingDetail(run, mainModel, info, { env = process.env } = {}
|
|
|
403
409
|
const v3 = (() => {
|
|
404
410
|
if (!info || !Array.isArray(run.perCall) || run.perCall.length === 0) return null;
|
|
405
411
|
if (!Number.isFinite(info.resultChars)) return null;
|
|
406
|
-
const
|
|
407
|
-
const
|
|
412
|
+
const at = runTime(run);
|
|
413
|
+
const rates = unitRates(mainModel, { env, at });
|
|
414
|
+
const subActual = exactCost(runTotals(run), run.model, { env, at });
|
|
408
415
|
if (!rates || subActual === null) return null;
|
|
409
416
|
// A background launch returns only an acknowledgement; the report that
|
|
410
417
|
// follows is the run's final message.
|
|
@@ -431,7 +438,7 @@ export function runSavingDetail(run, mainModel, info, { env = process.env } = {}
|
|
|
431
438
|
*/
|
|
432
439
|
export function runCost(run) {
|
|
433
440
|
if (!run.model) return null;
|
|
434
|
-
const actual = sessionCost(runTotals(run), run.model);
|
|
441
|
+
const actual = sessionCost(runTotals(run), run.model, { at: runTime(run) });
|
|
435
442
|
return actual ? actual.actual : null;
|
|
436
443
|
}
|
|
437
444
|
|
|
@@ -967,7 +974,7 @@ export async function runRouteScan({ days = 14, trace = null } = {}) {
|
|
|
967
974
|
startedAt: e.run.startedAt ?? null,
|
|
968
975
|
cfCarry: detail.cfCarry,
|
|
969
976
|
overhead: detail.overhead,
|
|
970
|
-
firstWrite: detail.basis === 'v3' ? (e.run.perCall[0].newIn * (unitRates(baseline)?.write ?? 0)) : 0,
|
|
977
|
+
firstWrite: detail.basis === 'v3' ? (e.run.perCall[0].newIn * (unitRates(baseline, { at: runTime(e.run) })?.write ?? 0)) : 0,
|
|
971
978
|
calls: e.run.calls,
|
|
972
979
|
C: e.info?.C ?? null,
|
|
973
980
|
N: e.info?.N ?? null,
|