@sandboxrouter/sdk 0.14.1 → 0.15.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/dist/catalog.d.ts +21 -1
- package/dist/catalog.js +24 -0
- package/dist/cli.js +4 -0
- package/dist/leaderboard.js +5 -4
- package/dist/price-index.js +6 -3
- package/dist/published.js +823 -162
- package/dist/recommend.d.ts +11 -4
- package/dist/recommend.js +3 -2
- package/package.json +1 -1
package/dist/catalog.d.ts
CHANGED
|
@@ -12,11 +12,17 @@ export interface ProviderInfo {
|
|
|
12
12
|
incrementSeconds?: number;
|
|
13
13
|
/** A fixed charge per sandbox created, USD, on top of running time. */
|
|
14
14
|
perSandboxUsd?: number;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* The plan `perSandboxUsd` applies on, where the provider's paid plans waive it. The router still counts the
|
|
17
|
+
* fee; published tables leave it out and note it, the way they treat `conditionalStartFee`.
|
|
18
|
+
*/
|
|
19
|
+
perSandboxPlan?: string;
|
|
20
|
+
/** Start fees above a provider's included allowance. Estimates exclude these account-specific charges. `when` says when they apply. */
|
|
16
21
|
conditionalStartFee?: {
|
|
17
22
|
minUsd: number;
|
|
18
23
|
maxUsd: number;
|
|
19
24
|
source: string;
|
|
25
|
+
when?: string;
|
|
20
26
|
};
|
|
21
27
|
/**
|
|
22
28
|
* Active-CPU billing only: the share of the allocated CPU billed even when idle (Tensorlake bills at
|
|
@@ -324,6 +330,15 @@ export declare function vercelSandboxSize(spec: SandboxSpec): {
|
|
|
324
330
|
vcpu: number;
|
|
325
331
|
memoryGb: number;
|
|
326
332
|
};
|
|
333
|
+
/** The per-sandbox fee a provider charges only on one plan (Sail's free plan), else 0. Published tables leave it out. */
|
|
334
|
+
export declare function planOnlyStartFee(id: ProviderId): number;
|
|
335
|
+
/** Every start fee that depends on the customer's account or plan, which published estimates exclude. */
|
|
336
|
+
export declare function accountStartFees(): Record<string, {
|
|
337
|
+
minUsd: number;
|
|
338
|
+
maxUsd: number;
|
|
339
|
+
source: string;
|
|
340
|
+
when?: string;
|
|
341
|
+
}>;
|
|
327
342
|
/** How a provider turns running time into a bill: minimum, rounding and fixed per-sandbox charge. */
|
|
328
343
|
export declare function billingRules(id: ProviderId): {
|
|
329
344
|
minSeconds: number;
|
|
@@ -345,6 +360,11 @@ export declare function fixedSize(id: ProviderId, spec?: SandboxSpec): {
|
|
|
345
360
|
vcpu: number;
|
|
346
361
|
memoryGb: number;
|
|
347
362
|
} | null;
|
|
363
|
+
/**
|
|
364
|
+
* The spec with a stand-in image for every provider whose default image fixes its size, so price tables can
|
|
365
|
+
* compare them at the asked size. Starting one for real needs your own image or template built at that size.
|
|
366
|
+
*/
|
|
367
|
+
export declare function withOwnImages(spec: SandboxSpec): SandboxSpec;
|
|
348
368
|
/** A spec this provider can take as-is: its default size if it has one, else the router default. */
|
|
349
369
|
export declare function fittingSpec(id: ProviderId): {
|
|
350
370
|
vcpu: number;
|
package/dist/catalog.js
CHANGED
|
@@ -472,6 +472,7 @@ ENTRIES.push({
|
|
|
472
472
|
name: "Sailboxes (Sail Research)",
|
|
473
473
|
pricing: {
|
|
474
474
|
perSandboxUsd: 0.01,
|
|
475
|
+
perSandboxPlan: "free",
|
|
475
476
|
vcpuHour: 0.015,
|
|
476
477
|
gbHour: 0.008,
|
|
477
478
|
note: "on what the box uses (CPU time, RAM it holds, disk $0.0007/GiB-h), sampled per second and not rounded up; RAM counts the VM's file cache, up to its memory limit (16 GiB at least), so file-heavy work can hold more than you asked for; paused/sleeping free; $0.01 per new Sailbox on the free plan, waived on Pro and Enterprise",
|
|
@@ -728,6 +729,21 @@ export function vercelSandboxSize(spec) {
|
|
|
728
729
|
const vcpu = Math.min(8, needed <= 1 ? 1 : Math.ceil(needed / 2) * 2);
|
|
729
730
|
return { vcpu, memoryGb: vcpu * 2 };
|
|
730
731
|
}
|
|
732
|
+
/** The per-sandbox fee a provider charges only on one plan (Sail's free plan), else 0. Published tables leave it out. */
|
|
733
|
+
export function planOnlyStartFee(id) {
|
|
734
|
+
const p = CATALOG.find((c) => c.id === id)?.pricing;
|
|
735
|
+
return p?.perSandboxPlan ? (p.perSandboxUsd ?? 0) : 0;
|
|
736
|
+
}
|
|
737
|
+
/** Every start fee that depends on the customer's account or plan, which published estimates exclude. */
|
|
738
|
+
export function accountStartFees() {
|
|
739
|
+
return Object.fromEntries(CATALOG.flatMap((c) => {
|
|
740
|
+
if (c.pricing.conditionalStartFee)
|
|
741
|
+
return [[c.id, c.pricing.conditionalStartFee]];
|
|
742
|
+
if (c.pricing.perSandboxPlan && c.pricing.perSandboxUsd)
|
|
743
|
+
return [[c.id, { minUsd: c.pricing.perSandboxUsd, maxUsd: c.pricing.perSandboxUsd, source: c.pricing.source, when: `on its ${c.pricing.perSandboxPlan} plan` }]];
|
|
744
|
+
return [];
|
|
745
|
+
}));
|
|
746
|
+
}
|
|
731
747
|
/** How a provider turns running time into a bill: minimum, rounding and fixed per-sandbox charge. */
|
|
732
748
|
export function billingRules(id) {
|
|
733
749
|
const p = CATALOG.find((c) => c.id === id)?.pricing;
|
|
@@ -761,6 +777,14 @@ export function fixedSize(id, spec = {}) {
|
|
|
761
777
|
const d = info(id).defaultSize;
|
|
762
778
|
return d && !spec.image?.[id] ? { vcpu: d.vcpu, memoryGb: d.memoryGb } : null;
|
|
763
779
|
}
|
|
780
|
+
/**
|
|
781
|
+
* The spec with a stand-in image for every provider whose default image fixes its size, so price tables can
|
|
782
|
+
* compare them at the asked size. Starting one for real needs your own image or template built at that size.
|
|
783
|
+
*/
|
|
784
|
+
export function withOwnImages(spec) {
|
|
785
|
+
const image = Object.fromEntries(CATALOG.filter((c) => c.defaultSize).map((c) => [c.id, "your-image"]));
|
|
786
|
+
return { ...spec, image: { ...image, ...spec.image } };
|
|
787
|
+
}
|
|
764
788
|
/** A spec this provider can take as-is: its default size if it has one, else the router default. */
|
|
765
789
|
export function fittingSpec(id) {
|
|
766
790
|
return fixedSize(id) ?? { vcpu: DEFAULT_VCPU, memoryGb: DEFAULT_MEMORY_GB };
|
package/dist/cli.js
CHANGED
|
@@ -75,6 +75,7 @@ Route flags: --provider e2b[,modal,...] --strategy balanced|verified|cheapest|
|
|
|
75
75
|
--max-price USD (per hour, for this run: skip providers that would cost more)
|
|
76
76
|
--no-fallback --fallback-any (also on setup errors like a bad key)
|
|
77
77
|
--create-timeout SEC (per provider, default 120) --require gpu,custom-image
|
|
78
|
+
--image e2b=TEMPLATE,daytona=IMAGE (a provider's own image or template; lifts a default image's fixed size)
|
|
78
79
|
|
|
79
80
|
Keys: one env var group per provider; "sandboxrouter providers" lists them and shows which are set.
|
|
80
81
|
--by puts your GitHub username on a saved result, so the website can credit it.`;
|
|
@@ -105,6 +106,7 @@ const { values, positionals } = parseArgs({
|
|
|
105
106
|
reuse: { type: "boolean" },
|
|
106
107
|
spread: { type: "boolean" },
|
|
107
108
|
setup: { type: "string" },
|
|
109
|
+
image: { type: "string" },
|
|
108
110
|
seconds: { type: "string" },
|
|
109
111
|
even: { type: "boolean" },
|
|
110
112
|
parallel: { type: "string" },
|
|
@@ -148,6 +150,8 @@ const spec = {
|
|
|
148
150
|
timeoutMinutes: num(values.timeout),
|
|
149
151
|
expectedSeconds: num(values.expect),
|
|
150
152
|
cpuUtilization: num(values.cpu),
|
|
153
|
+
// --image e2b=my-template,daytona=debian:12 : a provider's own image or template, which also lifts its default image's fixed size.
|
|
154
|
+
...(values.image ? { image: Object.fromEntries(values.image.split(",").map((pair) => pair.split(/=(.*)/s).slice(0, 2).map((x) => x.trim()))) } : {}),
|
|
151
155
|
};
|
|
152
156
|
const providers = list(values.provider);
|
|
153
157
|
const by = (() => {
|
package/dist/leaderboard.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { benchmarksPublishable, billingRules, CATALOG, cpuHourlyAtFull, hourlyCost } from "./catalog.js";
|
|
3
|
+
import { benchmarksPublishable, billingRules, CATALOG, cpuHourlyAtFull, hourlyCost, planOnlyStartFee } from "./catalog.js";
|
|
4
4
|
import { BILLED_VS_LIST } from "./billing.js";
|
|
5
5
|
import { AGENT_TASK_VERSION } from "./agent-bench.js";
|
|
6
6
|
import { isCurrentTask, TASK_VERSION, taskByVersion, taskUsd } from "./task.js";
|
|
@@ -185,7 +185,8 @@ export function taskTable(reports, version = TASK_VERSION, cohort = DEFAULT_SIZE
|
|
|
185
185
|
taskMs: taskMillis,
|
|
186
186
|
phasesMs,
|
|
187
187
|
hourlyUsd,
|
|
188
|
-
|
|
188
|
+
// A fee only one plan pays (Sail's free plan) is noted beside the table, not counted in it.
|
|
189
|
+
taskUsd: taskUsd(id, size, createMs, taskMillis, cpuMs, ratio, false, maxCoreMs) - planOnlyStartFee(id),
|
|
189
190
|
reusedUsd: taskUsd(id, size, createMs, taskMillis, cpuMs, ratio, true, maxCoreMs),
|
|
190
191
|
runs,
|
|
191
192
|
ok,
|
|
@@ -194,7 +195,7 @@ export function taskTable(reports, version = TASK_VERSION, cohort = DEFAULT_SIZE
|
|
|
194
195
|
...(cpuMs !== undefined ? { cpuMs } : {}),
|
|
195
196
|
activeCpu: cpuHourlyAtFull(id, size) > 0,
|
|
196
197
|
minimumSeconds: rules.minSeconds,
|
|
197
|
-
perSandboxUsd: rules.perSandboxUsd,
|
|
198
|
+
perSandboxUsd: rules.perSandboxUsd - planOnlyStartFee(id),
|
|
198
199
|
measuredAt: xs.map((x) => x.date).sort().at(-1),
|
|
199
200
|
}];
|
|
200
201
|
});
|
|
@@ -405,6 +406,6 @@ export function agentTable(reports) {
|
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
408
|
return [...latest.values()]
|
|
408
|
-
.map(({ row, date, model }) => ({ ...row, name: CATALOG.find((c) => c.id === row.provider).name, measuredAt: date, model }))
|
|
409
|
+
.map(({ row, date, model }) => ({ ...row, ...(row.medianUsd !== undefined ? { medianUsd: Math.max(0, row.medianUsd - planOnlyStartFee(row.provider)) } : {}), name: CATALOG.find((c) => c.id === row.provider).name, measuredAt: date, model }))
|
|
409
410
|
.sort((a, b) => b.ok / Math.max(1, b.requested ?? b.runs) - a.ok / Math.max(1, a.requested ?? a.runs) || (a.medianUsd ?? Infinity) - (b.medianUsd ?? Infinity));
|
|
410
411
|
}
|
package/dist/price-index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CATALOG } from "./catalog.js";
|
|
1
|
+
import { CATALOG, planOnlyStartFee, withOwnImages } from "./catalog.js";
|
|
2
2
|
import { median } from "./bench-store.js";
|
|
3
3
|
import { Router, rankUsd, runHours } from "./router.js";
|
|
4
4
|
import { VERIFIED } from "./verified.js";
|
|
@@ -32,10 +32,13 @@ export function priceIndex(verified = Object.keys(VERIFIED)) {
|
|
|
32
32
|
return INDEX_LINES.map((line) => {
|
|
33
33
|
const hours = runHours(line.spec);
|
|
34
34
|
const costs = router
|
|
35
|
-
|
|
35
|
+
// Every provider at the line's size, including those that need your own image to run it.
|
|
36
|
+
.plan(withOwnImages(line.spec), { strategy: "cheapest" })
|
|
36
37
|
.filter((c) => !c.skip)
|
|
37
38
|
// What the unit of work costs: a run of `hours`, times how many runs the line counts.
|
|
38
|
-
|
|
39
|
+
// Without a fee only one plan pays, like the published tables.
|
|
40
|
+
.map((c) => ({ provider: c.provider, usd: (rankUsd(c, hours) * hours - planOnlyStartFee(c.provider)) * line.scale }))
|
|
41
|
+
.sort((a, b) => a.usd - b.usd);
|
|
39
42
|
const best = costs[0];
|
|
40
43
|
const round = (n) => Math.round(n * 1e6) / 1e6;
|
|
41
44
|
return {
|