Runtime

Cloudflare Sandbox vs Fly Machines: pricing, isolation and limits

Cloudflare bills a sandbox's active CPU from a Worker; a Fly Machine bills its whole size while started, so busy work costs less on Fly.

Runtime is 53% cheaper than Cloudflare and 55% cheaper than a Fly Machine on this job. For 1,000 one-minute runs at 2 vCPU, Cloudflare charges $1.35, a Fly Machine $1.44 and Runtime $0.64. Cloudflare and Runtime both charge for CPU the code uses, but Runtime's rate is about a third of Cloudflare's, and Runtime lets you pick memory without a per-vCPU minimum. Rates checked 23 September 2026.

Estimated compute cost

53% less than Cloudflare Sandbox55% less than Fly Machines

2 vCPUs · 4 GiB · 60 s a run · 20 CPU-seconds busy

1,000

Compute only, at list rates checked 23 September 2026 (Cloudflare Containers pricing, Fly.io pricing). Plan fees, network, taxes and free credits are left out. The worked example below shows the arithmetic.

At a glance

The Cloudflare column uses Containers rates, since the Sandbox SDK runs on Cloudflare Containers. Fly's Ashburn (iad) region.

Cloudflare Sandbox SDK Fly Machines Runtime
Isolation A container in its own VM Firecracker microVM Firecracker microVM, own kernel
CPU $0.072 per active vCPU-hour, metered in 10 ms steps By size while started: $0.0861 an hour for 2 vCPUs and 4 GB $0.025 per vCPU-hour of measured CPU, with a small floor
Memory $0.009 per provisioned GiB-hour; at least 3 GiB per vCPU Included in the size; more at $5 per GB a month $0.0075 per reserved GiB-hour
Largest 4 vCPUs, 12 GiB and 20 GB of disk 16 performance vCPUs and 128 GB vCPUs and memory chosen per sandbox
Plan fee Workers Paid, at least $5 a month None; pay as you go None; prepaid credit from $10
Free start No free tier; the plan includes 375 vCPU-minutes a month Not stated on the pricing page 50 sandbox hours, no card
When idle Sleeps after 10 idle minutes by default; files are lost Root disk is temporary; volumes keep files Pause keeps files, memory and processes, 1 to 365 days
Interfaces A TypeScript SDK called from a Cloudflare Worker Machines API and flyctl API, CLI, MCP server, JavaScript and Python SDKs

Metered CPU or a flat size: where is the break-even?

These two sit at opposite ends of the billing spectrum. A Fly Machine is a fixed size at a fixed price, $0.0861 an hour for this one, busy or idle, which makes the job $1.44 at any load. Cloudflare meters CPU at $0.000020 per vCPU-second actually used, yet it will not provision 2 vCPUs with less than 6 GiB, and it bills that memory plus disk for every second the sandbox is up: $0.95 of the total before any CPU is counted.

Load per one-minute run (of 120 CPU-seconds) Cheaper of the two
Under about 24 CPU-seconds Cloudflare
Over about 24 CPU-seconds Fly Machine
Both CPUs flat out Fly Machine, by more than half

The Machine in these sums is a performance-2x, whose vCPUs are dedicated cores. A shared-cpu-2x with 4 GB would run the 1,000 minutes for about $0.50, but each of its vCPUs is only guaranteed 6.25% of a core.

Cost for the same job

Each of the 1,000 runs is 60 seconds long on 2 vCPU, with 20 CPU-seconds of work, as an agent waiting on a model would do. Runtime gets 4 GiB and the Machine 4 GB. Cloudflare needs at least 3 GiB per vCPU, so its smallest 2 vCPU shape has 6 GiB, and it is given 12 GB of disk, the figure Cloudflare's own example uses.

TextCloudflare  CPU    1,000 × 20 s × $0.000020           = $0.40            Memory 1,000 × 60 s × 6 × $0.0000025      = $0.90            Disk   1,000 × 60 s × 12 × $0.00000007    = $0.05            Total                                        $1.35Machines    Size   1,000 × 60 s / 3,600 × $0.0861     = $1.44Runtime     CPU    1,000 × 20 s / 3,600 × $0.025      = $0.14            Memory 1,000 × 60 s / 3,600 × 4 × $0.0075 = $0.50            Total                                        $0.64

For a month of 100,000 runs: $135.04 on Cloudflare, $143.50 on Machines, $63.89 on Runtime. With both CPUs busy for the whole minute the job costs $1.33 on Runtime, $3.35 on Cloudflare and $1.44 on Machines. The rival totals assume each sandbox is torn down as its run ends, and leave out plan fees, Workers requests, Durable Object time, storage, network and free credit.

What is left after a run?

On Cloudflare, very little: a sandbox sleeps after 10 idle minutes by default, and a stop deletes its files and ends its processes, unless you backed a directory up to R2 to restore later. A stopped Fly Machine bills only for storage, but its root filesystem resets, so anything durable belongs on a Fly Volume. Fly's suspend does keep memory, but only on Machines of 2 GB or less, which rules out the 4 GB Machine priced here.

Runtime's pause keeps files, memory and running processes for 1 to 365 days, at $0.08 per GB-month, and the sandbox wakes on the next request. More in how to pause and resume a sandbox.

Which one to pick

  • Cloudflare Sandbox fits a product built on Workers that wants sandboxes under the same account and bindings, started close to users on Cloudflare's network.
  • Fly Machines fits teams who want general-purpose VMs in 18 regions next to volumes and Managed Postgres, and CPU-bound jobs where a flat hourly size is the cheapest way to pay.
  • Runtime fits agent work that idles between model calls: CPU billed by use at about a third of Cloudflare's rate, memory set independently of vCPUs, a pause that keeps memory and processes, and SDKs for JavaScript and Python that run from any backend, not only a Worker.

Porting the code

Cloudflare's calls translate directly: getSandbox(env.Sandbox, name) is Sandbox.getOrCreate(name), sandbox.exec(cmd) is exec, and proxyToSandbox is box.previews.create(port). On Fly, wherever the code starts a Machine for a job, start a Runtime sandbox instead and stop it when the job is done.

Pythonfrom withruntime import Sandboxwith Sandbox.create(funding="trial") as box:    print(box.exec("python3 -c 'print(6 * 7)'", check=True).stdout)

A coding agent can make the change for you from the one instruction in migration, on a branch, tested on the free trial. npx withruntime switch --from cloudflare or --from fly, run before the first top-up, matches that top-up with credit up to $100. See also Runtime vs Cloudflare, Runtime vs Fly.io and E2B vs Cloudflare Sandbox.

Sources

Rates checked 23 September 2026; Fly's suspend page and Cloudflare's sandbox lifecycle page read 25 September 2026.

Facts on this page were checked on 25 September 2026.