@foldrun/core 12.0.3 → 12.2.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.
@@ -39,6 +39,7 @@ export interface EgressGrant {
39
39
  secrets: Record<string, {
40
40
  value: string;
41
41
  hosts: string[];
42
+ supply?: SupplyGrant;
42
43
  }>;
43
44
  /** Secret name → the vault entry it came from, as secret-health keys it:
44
45
  * "account:NAME" or "workspace:<ws>:NAME". Two workspaces each holding an
@@ -173,4 +174,16 @@ export declare function proxyModelEnv(env: Record<string, string | undefined>, l
173
174
  * granting the name to `host`. Longest values first, so one that contains
174
175
  * another is replaced whole. */
175
176
  export declare function unsubstitute(text: string, knownSecrets: Record<string, string>, host: string, grant: EgressGrant): string;
177
+ /** A grant of one of the PLATFORM's model keys ("foldrun's models",
178
+ * model-supply.ts). It carries no value: the proxy reads the key from its
179
+ * own environment per request, so the key is never in a lease, never in
180
+ * Redis and never in the pod. The proxy fills it only in the provider's
181
+ * auth header on the provider's model routes, and meters every call it
182
+ * makes (foldrun-platform model-gateway.ts) — the bill comes from there,
183
+ * not from what the step reports. */
184
+ export interface SupplyGrant {
185
+ provider: string;
186
+ }
187
+ /** Grant the platform's key for `provider` under `name`, to its host. */
188
+ export declare function addSupplyGrant(grant: EgressGrant, name: string, provider: string, host: string): void;
176
189
  export declare function addGrant(grant: EgressGrant, name: string, value: string, host: string): void;
@@ -130,9 +130,27 @@ export function unsubstitute(text, knownSecrets, host, grant) {
130
130
  }
131
131
  return out;
132
132
  }
133
+ /** Grant the platform's key for `provider` under `name`, to its host. */
134
+ export function addSupplyGrant(grant, name, provider, host) {
135
+ const h = host.toLowerCase();
136
+ const existing = grant.secrets[name];
137
+ // A name already granted as an ordinary secret is never turned into the
138
+ // platform's key, nor the other way round: two meanings under one name
139
+ // is how a value would be filled where it was not meant to be.
140
+ if (existing && existing.supply?.provider !== provider)
141
+ throw new Error(`egress: ${name} is already granted as another credential`);
142
+ if (existing) {
143
+ if (!existing.hosts.includes(h))
144
+ existing.hosts.push(h);
145
+ }
146
+ else
147
+ grant.secrets[name] = { value: "", hosts: [h], supply: { provider } };
148
+ }
133
149
  export function addGrant(grant, name, value, host) {
134
150
  const h = host.toLowerCase();
135
151
  const existing = grant.secrets[name];
152
+ if (existing?.supply)
153
+ throw new Error(`egress: ${name} is the platform's model key and cannot be granted a value`);
136
154
  if (existing) {
137
155
  if (!existing.hosts.includes(h))
138
156
  existing.hosts.push(h);
@@ -0,0 +1,34 @@
1
+ import { type WireFormat } from "./providers.ts";
2
+ export type SupplyProviderName = "anthropic" | "openai" | "gemini" | "openrouter";
3
+ export interface SupplyProvider {
4
+ name: SupplyProviderName;
5
+ /** The preset the step's provider block is built from (providers.ts). */
6
+ preset: string;
7
+ format: WireFormat;
8
+ /** The one host the key is granted to. */
9
+ host: string;
10
+ /** Where the platform's key lives, in the worker's and the proxy's
11
+ * environment. Never in the vault, never in a lease. */
12
+ env: string;
13
+ /** The header the key may be filled in, and its exact shape: the whole
14
+ * value of x-api-key, or "Bearer <key>" in authorization. Anywhere else —
15
+ * the URL, the body, another header — is refused. */
16
+ auth: "x-api-key" | "bearer";
17
+ /** Paths (the URL's pathname, exact) a call is metered on: POST only. */
18
+ metered: string[];
19
+ /** Paths that cost nothing and may pass unmetered (GET model lists, a
20
+ * free token count). Anything not listed in either is refused. */
21
+ free: {
22
+ method: "GET" | "POST";
23
+ path: string;
24
+ }[];
25
+ }
26
+ export declare const SUPPLY_PROVIDERS: Record<SupplyProviderName, SupplyProvider>;
27
+ export declare const SUPPLY_PROVIDER_NAMES: SupplyProviderName[];
28
+ export declare function isSupplyProvider(name: unknown): name is SupplyProviderName;
29
+ /** The placeholder name a supply grant is filed under in a step's lease. */
30
+ export declare const SUPPLY_KEY_NAME = "FOLDRUN_SUPPLY_KEY";
31
+ /** The provider block a step on foldrun's models runs with: the preset's
32
+ * endpoint and format, the operator's tier map, and the key as a
33
+ * placeholder only. */
34
+ export declare function supplyProviderBlock(provider: SupplyProviderName, tiers: Partial<Record<"fast" | "default" | "max", string>>): Record<string, unknown>;
@@ -0,0 +1,81 @@
1
+ // "foldrun's models": the platform's own keys for a few providers, which a
2
+ // hosted account may choose instead of bringing its own (3 Nov 2026).
3
+ //
4
+ // One table, read by both halves:
5
+ // - the runner (core) builds the step's provider block from it and grants
6
+ // the key to the egress proxy as a supply grant (egress.ts SupplyGrant),
7
+ // so the key never reaches the pod;
8
+ // - the proxy's model gateway (foldrun-platform model-gateway.ts) fills
9
+ // that grant only in the provider's auth header, on the provider's model
10
+ // routes, and meters every call — the bill comes from the gateway.
11
+ //
12
+ // A provider here is offered only where the platform holds its key
13
+ // (`env`), the operator lists it, and the price list names the model.
14
+ import { providerPreset } from "./providers.js";
15
+ export const SUPPLY_PROVIDERS = {
16
+ anthropic: {
17
+ name: "anthropic",
18
+ preset: "anthropic",
19
+ format: "anthropic",
20
+ host: "api.anthropic.com",
21
+ env: "FOLDRUN_SUPPLY_ANTHROPIC_API_KEY",
22
+ auth: "x-api-key",
23
+ metered: ["/v1/messages"],
24
+ free: [
25
+ { method: "POST", path: "/v1/messages/count_tokens" },
26
+ { method: "GET", path: "/v1/models" },
27
+ ],
28
+ },
29
+ openrouter: {
30
+ name: "openrouter",
31
+ preset: "openrouter",
32
+ format: "anthropic",
33
+ host: "openrouter.ai",
34
+ env: "FOLDRUN_SUPPLY_OPENROUTER_API_KEY",
35
+ auth: "bearer",
36
+ metered: ["/api/v1/messages"],
37
+ free: [{ method: "GET", path: "/api/v1/models" }],
38
+ },
39
+ openai: {
40
+ name: "openai",
41
+ preset: "openai",
42
+ format: "openai",
43
+ host: "api.openai.com",
44
+ env: "FOLDRUN_SUPPLY_OPENAI_API_KEY",
45
+ auth: "bearer",
46
+ metered: ["/v1/chat/completions"],
47
+ free: [{ method: "GET", path: "/v1/models" }],
48
+ },
49
+ gemini: {
50
+ name: "gemini",
51
+ preset: "gemini",
52
+ format: "openai",
53
+ host: "generativelanguage.googleapis.com",
54
+ env: "FOLDRUN_SUPPLY_GEMINI_API_KEY",
55
+ auth: "bearer",
56
+ metered: ["/v1beta/openai/chat/completions"],
57
+ free: [{ method: "GET", path: "/v1beta/openai/models" }],
58
+ },
59
+ };
60
+ export const SUPPLY_PROVIDER_NAMES = Object.keys(SUPPLY_PROVIDERS);
61
+ export function isSupplyProvider(name) {
62
+ return typeof name === "string" && Object.hasOwn(SUPPLY_PROVIDERS, name);
63
+ }
64
+ /** The placeholder name a supply grant is filed under in a step's lease. */
65
+ export const SUPPLY_KEY_NAME = "FOLDRUN_SUPPLY_KEY";
66
+ /** The provider block a step on foldrun's models runs with: the preset's
67
+ * endpoint and format, the operator's tier map, and the key as a
68
+ * placeholder only. */
69
+ export function supplyProviderBlock(provider, tiers) {
70
+ const p = SUPPLY_PROVIDERS[provider];
71
+ const preset = providerPreset(p.preset);
72
+ if (!preset?.baseUrl)
73
+ throw new Error(`model supply: no preset endpoint for ${provider}`);
74
+ return {
75
+ name: p.preset,
76
+ base_url: preset.baseUrl,
77
+ format: p.format,
78
+ token: `\${${SUPPLY_KEY_NAME}}`,
79
+ ...(Object.keys(tiers).length ? { models: tiers } : {}),
80
+ };
81
+ }
@@ -2256,8 +2256,15 @@ mayDefer) {
2256
2256
  // An account refused the platform's credential (below) is never shown
2257
2257
  // running on it: the record said "Claude login token" on a step that
2258
2258
  // was then refused for having no key (FOL-14, 18 Oct 2026).
2259
- const noKey = !providerLabel && !platform.platformKeyAllowed(tenant);
2260
- const credential = providerLabel || noKey ? null : resolveModelCredential(isolatedRun() ? platformModelEnv() : process.env);
2259
+ // Whether the PRIMARY call rides the platform's credential: only a block
2260
+ // with a base_url fills providerEnv. A block with just a fallback: has a
2261
+ // label ("platform (fallback: …)") yet its first call is the platform's,
2262
+ // so it is judged here by the env, never by the label — the label let it
2263
+ // past the refusal below and recorded it as "provider:", which the meter
2264
+ // bills at $0 (3 Nov 2026).
2265
+ const primaryOnPlatform = Object.keys(providerEnv).length === 0;
2266
+ const noKey = primaryOnPlatform && !platform.platformKeyAllowed(tenant);
2267
+ const credential = !primaryOnPlatform || noKey ? null : resolveModelCredential(isolatedRun() ? platformModelEnv() : process.env);
2261
2268
  step.credential = credential ? credential.label : noKey ? "none — this account has no model key" : `provider: ${providerLabel}`;
2262
2269
  // Core's own Docker container has no login to fall back to (below):
2263
2270
  // there, "none set" is refused with what to do, not described.
@@ -2272,7 +2279,7 @@ mayDefer) {
2272
2279
  // operator's key, and not failed later by a provider.
2273
2280
  if (!platform.platformKeyAllowed(tenant)) {
2274
2281
  const own = Object.values(providerSecrets).concat(Object.values(providerEnv));
2275
- if (!providerLabel) {
2282
+ if (primaryOnPlatform) {
2276
2283
  push("error", `no model key: this account runs on its own API key, and none is set. Add one in Settings → Model ` +
2277
2284
  `(or \`foldrun account model set <provider> --key …\`), or write a provider: block in AGENTS.md`);
2278
2285
  step.status = "failed";
@@ -1705,6 +1705,12 @@ export declare function stoppedByText(run: Pick<RunRecord, "stoppedBy"> | null |
1705
1705
  */
1706
1706
  export declare function runDisplayStatus(run: Pick<RunRecord, "status" | "stopRequested">): string;
1707
1707
  export declare function runCost(run: RunRecord): number;
1708
+ /** Whether a step's tokens are the platform's to bill: it ran on the
1709
+ * platform's own model credential, not the account's key ("provider: …" —
1710
+ * a provider: block, or Settings → Model), which the provider bills. The
1711
+ * meter, the Usage page and the ledger split all ask this one question, so
1712
+ * what a page shows is what was charged. */
1713
+ export declare function stepBillsTokens(s: Pick<StepRecord, "credential">): boolean;
1708
1714
  /**
1709
1715
  * What a finished run consumed, in the units the format itself has — the
1710
1716
  * shape ledger.ts prices. Structural, not an import, because ledger.ts
package/dist/src/store.js CHANGED
@@ -3248,6 +3248,14 @@ export function runDisplayStatus(run) {
3248
3248
  export function runCost(run) {
3249
3249
  return run.steps.reduce((sum, s) => sum + (s.costUsd ?? 0), 0);
3250
3250
  }
3251
+ /** Whether a step's tokens are the platform's to bill: it ran on the
3252
+ * platform's own model credential, not the account's key ("provider: …" —
3253
+ * a provider: block, or Settings → Model), which the provider bills. The
3254
+ * meter, the Usage page and the ledger split all ask this one question, so
3255
+ * what a page shows is what was charged. */
3256
+ export function stepBillsTokens(s) {
3257
+ return !(s.credential ?? "").startsWith("provider:");
3258
+ }
3251
3259
  /**
3252
3260
  * What a finished run consumed, in the units the format itself has — the
3253
3261
  * shape ledger.ts prices. Structural, not an import, because ledger.ts
@@ -3278,7 +3286,7 @@ export function runMeter(run) {
3278
3286
  if (s.carriedFrom)
3279
3287
  continue;
3280
3288
  steps += 1;
3281
- if (!(s.credential ?? "").startsWith("provider:"))
3289
+ if (stepBillsTokens(s))
3282
3290
  tokenCostUsd += s.costUsd ?? 0;
3283
3291
  const secs = s.computeSecs ?? 0;
3284
3292
  computeSecs += secs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foldrun/core",
3
- "version": "12.0.3",
3
+ "version": "12.2.0",
4
4
  "description": "Agents are just folders. The format, the runner, the checks.",
5
5
  "license": "FSL-1.1-ALv2",
6
6
  "type": "module",
package/src/egress.ts CHANGED
@@ -106,7 +106,7 @@ export interface LeaseWho {
106
106
 
107
107
  export interface EgressGrant {
108
108
  /** Secret name → the hosts that secret may be substituted for. */
109
- secrets: Record<string, { value: string; hosts: string[] }>;
109
+ secrets: Record<string, { value: string; hosts: string[]; supply?: SupplyGrant }>;
110
110
  /** Secret name → the vault entry it came from, as secret-health keys it:
111
111
  * "account:NAME" or "workspace:<ws>:NAME". Two workspaces each holding an
112
112
  * API_KEY are two credentials, and one's refusal must not paint the
@@ -260,9 +260,34 @@ export function unsubstitute(text: string, knownSecrets: Record<string, string>,
260
260
  return out;
261
261
  }
262
262
 
263
+ /** A grant of one of the PLATFORM's model keys ("foldrun's models",
264
+ * model-supply.ts). It carries no value: the proxy reads the key from its
265
+ * own environment per request, so the key is never in a lease, never in
266
+ * Redis and never in the pod. The proxy fills it only in the provider's
267
+ * auth header on the provider's model routes, and meters every call it
268
+ * makes (foldrun-platform model-gateway.ts) — the bill comes from there,
269
+ * not from what the step reports. */
270
+ export interface SupplyGrant {
271
+ provider: string;
272
+ }
273
+
274
+ /** Grant the platform's key for `provider` under `name`, to its host. */
275
+ export function addSupplyGrant(grant: EgressGrant, name: string, provider: string, host: string): void {
276
+ const h = host.toLowerCase();
277
+ const existing = grant.secrets[name];
278
+ // A name already granted as an ordinary secret is never turned into the
279
+ // platform's key, nor the other way round: two meanings under one name
280
+ // is how a value would be filled where it was not meant to be.
281
+ if (existing && existing.supply?.provider !== provider) throw new Error(`egress: ${name} is already granted as another credential`);
282
+ if (existing) {
283
+ if (!existing.hosts.includes(h)) existing.hosts.push(h);
284
+ } else grant.secrets[name] = { value: "", hosts: [h], supply: { provider } };
285
+ }
286
+
263
287
  export function addGrant(grant: EgressGrant, name: string, value: string, host: string): void {
264
288
  const h = host.toLowerCase();
265
289
  const existing = grant.secrets[name];
290
+ if (existing?.supply) throw new Error(`egress: ${name} is the platform's model key and cannot be granted a value`);
266
291
  if (existing) {
267
292
  if (!existing.hosts.includes(h)) existing.hosts.push(h);
268
293
  // A name granted again with a different value is a rotation: the
@@ -0,0 +1,109 @@
1
+ // "foldrun's models": the platform's own keys for a few providers, which a
2
+ // hosted account may choose instead of bringing its own (3 Nov 2026).
3
+ //
4
+ // One table, read by both halves:
5
+ // - the runner (core) builds the step's provider block from it and grants
6
+ // the key to the egress proxy as a supply grant (egress.ts SupplyGrant),
7
+ // so the key never reaches the pod;
8
+ // - the proxy's model gateway (foldrun-platform model-gateway.ts) fills
9
+ // that grant only in the provider's auth header, on the provider's model
10
+ // routes, and meters every call — the bill comes from the gateway.
11
+ //
12
+ // A provider here is offered only where the platform holds its key
13
+ // (`env`), the operator lists it, and the price list names the model.
14
+
15
+ import { providerPreset, type WireFormat } from "./providers.ts";
16
+
17
+ export type SupplyProviderName = "anthropic" | "openai" | "gemini" | "openrouter";
18
+
19
+ export interface SupplyProvider {
20
+ name: SupplyProviderName;
21
+ /** The preset the step's provider block is built from (providers.ts). */
22
+ preset: string;
23
+ format: WireFormat;
24
+ /** The one host the key is granted to. */
25
+ host: string;
26
+ /** Where the platform's key lives, in the worker's and the proxy's
27
+ * environment. Never in the vault, never in a lease. */
28
+ env: string;
29
+ /** The header the key may be filled in, and its exact shape: the whole
30
+ * value of x-api-key, or "Bearer <key>" in authorization. Anywhere else —
31
+ * the URL, the body, another header — is refused. */
32
+ auth: "x-api-key" | "bearer";
33
+ /** Paths (the URL's pathname, exact) a call is metered on: POST only. */
34
+ metered: string[];
35
+ /** Paths that cost nothing and may pass unmetered (GET model lists, a
36
+ * free token count). Anything not listed in either is refused. */
37
+ free: { method: "GET" | "POST"; path: string }[];
38
+ }
39
+
40
+ export const SUPPLY_PROVIDERS: Record<SupplyProviderName, SupplyProvider> = {
41
+ anthropic: {
42
+ name: "anthropic",
43
+ preset: "anthropic",
44
+ format: "anthropic",
45
+ host: "api.anthropic.com",
46
+ env: "FOLDRUN_SUPPLY_ANTHROPIC_API_KEY",
47
+ auth: "x-api-key",
48
+ metered: ["/v1/messages"],
49
+ free: [
50
+ { method: "POST", path: "/v1/messages/count_tokens" },
51
+ { method: "GET", path: "/v1/models" },
52
+ ],
53
+ },
54
+ openrouter: {
55
+ name: "openrouter",
56
+ preset: "openrouter",
57
+ format: "anthropic",
58
+ host: "openrouter.ai",
59
+ env: "FOLDRUN_SUPPLY_OPENROUTER_API_KEY",
60
+ auth: "bearer",
61
+ metered: ["/api/v1/messages"],
62
+ free: [{ method: "GET", path: "/api/v1/models" }],
63
+ },
64
+ openai: {
65
+ name: "openai",
66
+ preset: "openai",
67
+ format: "openai",
68
+ host: "api.openai.com",
69
+ env: "FOLDRUN_SUPPLY_OPENAI_API_KEY",
70
+ auth: "bearer",
71
+ metered: ["/v1/chat/completions"],
72
+ free: [{ method: "GET", path: "/v1/models" }],
73
+ },
74
+ gemini: {
75
+ name: "gemini",
76
+ preset: "gemini",
77
+ format: "openai",
78
+ host: "generativelanguage.googleapis.com",
79
+ env: "FOLDRUN_SUPPLY_GEMINI_API_KEY",
80
+ auth: "bearer",
81
+ metered: ["/v1beta/openai/chat/completions"],
82
+ free: [{ method: "GET", path: "/v1beta/openai/models" }],
83
+ },
84
+ };
85
+
86
+ export const SUPPLY_PROVIDER_NAMES = Object.keys(SUPPLY_PROVIDERS) as SupplyProviderName[];
87
+
88
+ export function isSupplyProvider(name: unknown): name is SupplyProviderName {
89
+ return typeof name === "string" && Object.hasOwn(SUPPLY_PROVIDERS, name);
90
+ }
91
+
92
+ /** The placeholder name a supply grant is filed under in a step's lease. */
93
+ export const SUPPLY_KEY_NAME = "FOLDRUN_SUPPLY_KEY";
94
+
95
+ /** The provider block a step on foldrun's models runs with: the preset's
96
+ * endpoint and format, the operator's tier map, and the key as a
97
+ * placeholder only. */
98
+ export function supplyProviderBlock(provider: SupplyProviderName, tiers: Partial<Record<"fast" | "default" | "max", string>>): Record<string, unknown> {
99
+ const p = SUPPLY_PROVIDERS[provider];
100
+ const preset = providerPreset(p.preset);
101
+ if (!preset?.baseUrl) throw new Error(`model supply: no preset endpoint for ${provider}`);
102
+ return {
103
+ name: p.preset,
104
+ base_url: preset.baseUrl,
105
+ format: p.format,
106
+ token: `\${${SUPPLY_KEY_NAME}}`,
107
+ ...(Object.keys(tiers).length ? { models: tiers } : {}),
108
+ };
109
+ }
package/src/runner.ts CHANGED
@@ -2449,8 +2449,15 @@ async function runStep(
2449
2449
  // An account refused the platform's credential (below) is never shown
2450
2450
  // running on it: the record said "Claude login token" on a step that
2451
2451
  // was then refused for having no key (FOL-14, 18 Oct 2026).
2452
- const noKey = !providerLabel && !platform.platformKeyAllowed(tenant);
2453
- const credential = providerLabel || noKey ? null : resolveModelCredential(isolatedRun() ? platformModelEnv() : process.env);
2452
+ // Whether the PRIMARY call rides the platform's credential: only a block
2453
+ // with a base_url fills providerEnv. A block with just a fallback: has a
2454
+ // label ("platform (fallback: …)") yet its first call is the platform's,
2455
+ // so it is judged here by the env, never by the label — the label let it
2456
+ // past the refusal below and recorded it as "provider:", which the meter
2457
+ // bills at $0 (3 Nov 2026).
2458
+ const primaryOnPlatform = Object.keys(providerEnv).length === 0;
2459
+ const noKey = primaryOnPlatform && !platform.platformKeyAllowed(tenant);
2460
+ const credential = !primaryOnPlatform || noKey ? null : resolveModelCredential(isolatedRun() ? platformModelEnv() : process.env);
2454
2461
  step.credential = credential ? credential.label : noKey ? "none — this account has no model key" : `provider: ${providerLabel}`;
2455
2462
  // Core's own Docker container has no login to fall back to (below):
2456
2463
  // there, "none set" is refused with what to do, not described.
@@ -2465,7 +2472,7 @@ async function runStep(
2465
2472
  // operator's key, and not failed later by a provider.
2466
2473
  if (!platform.platformKeyAllowed(tenant)) {
2467
2474
  const own = Object.values(providerSecrets).concat(Object.values(providerEnv));
2468
- if (!providerLabel) {
2475
+ if (primaryOnPlatform) {
2469
2476
  push(
2470
2477
  "error",
2471
2478
  `no model key: this account runs on its own API key, and none is set. Add one in Settings → Model ` +
package/src/store.ts CHANGED
@@ -4382,6 +4382,15 @@ export function runCost(run: RunRecord): number {
4382
4382
  return run.steps.reduce((sum, s) => sum + (s.costUsd ?? 0), 0);
4383
4383
  }
4384
4384
 
4385
+ /** Whether a step's tokens are the platform's to bill: it ran on the
4386
+ * platform's own model credential, not the account's key ("provider: …" —
4387
+ * a provider: block, or Settings → Model), which the provider bills. The
4388
+ * meter, the Usage page and the ledger split all ask this one question, so
4389
+ * what a page shows is what was charged. */
4390
+ export function stepBillsTokens(s: Pick<StepRecord, "credential">): boolean {
4391
+ return !(s.credential ?? "").startsWith("provider:");
4392
+ }
4393
+
4385
4394
  /**
4386
4395
  * What a finished run consumed, in the units the format itself has — the
4387
4396
  * shape ledger.ts prices. Structural, not an import, because ledger.ts
@@ -4418,7 +4427,7 @@ export function runMeter(run: RunRecord): {
4418
4427
  // A carried step ran — and was billed — in the run it was carried from.
4419
4428
  if (s.carriedFrom) continue;
4420
4429
  steps += 1;
4421
- if (!(s.credential ?? "").startsWith("provider:")) tokenCostUsd += s.costUsd ?? 0;
4430
+ if (stepBillsTokens(s)) tokenCostUsd += s.costUsd ?? 0;
4422
4431
  const secs = s.computeSecs ?? 0;
4423
4432
  computeSecs += secs;
4424
4433
  if (s.size === "small") smallSecs += secs;