@sandboxrouter/sdk 0.14.1 → 0.15.1
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 +14 -8
- package/dist/price-index.js +6 -3
- package/dist/published.js +867 -206
- 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, withOwnImages } 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";
|
|
@@ -101,7 +101,7 @@ export function aggregate(reports, cohort = DEFAULT_SIZE) {
|
|
|
101
101
|
medianReadyMs: rs.every((r) => r.medianReadyMs !== undefined) ? median(rs.map((r) => r.medianReadyMs)) : undefined,
|
|
102
102
|
successRate: attempted ? ok / attempted : 0,
|
|
103
103
|
runs: attempted,
|
|
104
|
-
hourlyUsd: hourlyCost(id, size),
|
|
104
|
+
hourlyUsd: hourlyCost(id, measured(size)),
|
|
105
105
|
size,
|
|
106
106
|
measuredAt: matching.map((x) => x.date).sort().at(-1),
|
|
107
107
|
};
|
|
@@ -165,7 +165,7 @@ export function taskTable(reports, version = TASK_VERSION, cohort = DEFAULT_SIZE
|
|
|
165
165
|
// The job's own CPU hint (the agent loop's 10%) prices it the way its sandboxes were started.
|
|
166
166
|
const size = { ...rs[0].size, ...(def.cpuUtilization ? { cpuUtilization: def.cpuUtilization } : {}) };
|
|
167
167
|
const ratio = BILLED_VS_LIST[id]?.ratio ?? 1;
|
|
168
|
-
const hourlyUsd = hourlyCost(id, size) * ratio;
|
|
168
|
+
const hourlyUsd = hourlyCost(id, measured(size)) * ratio;
|
|
169
169
|
const rules = billingRules(id);
|
|
170
170
|
const cpus = successful.map((r) => r.medianTaskCpuMs).filter((n) => typeof n === "number");
|
|
171
171
|
// A container can show the whole host's /proc/stat (Daytona does): a reading beyond what the sandbox's
|
|
@@ -185,16 +185,17 @@ export function taskTable(reports, version = TASK_VERSION, cohort = DEFAULT_SIZE
|
|
|
185
185
|
taskMs: taskMillis,
|
|
186
186
|
phasesMs,
|
|
187
187
|
hourlyUsd,
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
// A fee only one plan pays (Sail's free plan) is noted beside the table, not counted in it.
|
|
189
|
+
taskUsd: taskUsd(id, measured(size), createMs, taskMillis, cpuMs, ratio, false, maxCoreMs) - planOnlyStartFee(id),
|
|
190
|
+
reusedUsd: taskUsd(id, measured(size), createMs, taskMillis, cpuMs, ratio, true, maxCoreMs),
|
|
190
191
|
runs,
|
|
191
192
|
ok,
|
|
192
193
|
limited: rs.reduce((n, r) => n + (r.limited ?? 0), 0),
|
|
193
194
|
successRate: runs ? ok / runs : 0,
|
|
194
195
|
...(cpuMs !== undefined ? { cpuMs } : {}),
|
|
195
|
-
activeCpu: cpuHourlyAtFull(id, size) > 0,
|
|
196
|
+
activeCpu: cpuHourlyAtFull(id, measured(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
|
});
|
|
@@ -367,6 +368,11 @@ export function burstTable(reports, task, n) {
|
|
|
367
368
|
.map(({ row, date, label }) => ({ ...row, name: CATALOG.find((c) => c.id === row.provider).name, measuredAt: date, label: label ?? null }))
|
|
368
369
|
.sort((a, b) => b.ok - a.ok || (a.p50Ms ?? Infinity) - (b.p50Ms ?? Infinity));
|
|
369
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* A size a run really had, priced as that size. Without this, a provider whose default image is smaller
|
|
373
|
+
* (E2B, Daytona, OpenScale) would be priced at the default image's size even when the run used a bigger one.
|
|
374
|
+
*/
|
|
375
|
+
const measured = (size) => withOwnImages(size);
|
|
370
376
|
export function loadAgentReports(dir) {
|
|
371
377
|
let files;
|
|
372
378
|
try {
|
|
@@ -405,6 +411,6 @@ export function agentTable(reports) {
|
|
|
405
411
|
}
|
|
406
412
|
}
|
|
407
413
|
return [...latest.values()]
|
|
408
|
-
.map(({ row, date, model }) => ({ ...row, name: CATALOG.find((c) => c.id === row.provider).name, measuredAt: date, model }))
|
|
414
|
+
.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
415
|
.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
416
|
}
|
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 {
|