Runtime

Fly Machines vs CodeSandbox: pricing, isolation and limits

Both sell fixed-size Firecracker VMs; 2 vCPU and 4 GB costs $0.0861 an hour on a Fly Machine and $0.1486 on a CodeSandbox Nano VM.

Runtime runs the same job for 55% less than a Fly Machine and 74% less than CodeSandbox. 1,000 one-minute runs of a 2 vCPU, 4 GiB sandbox cost $1.44 on Fly Machines, $2.48 on CodeSandbox and $0.64 on Runtime. Both rivals bill a whole machine size for as long as it is up; Runtime bills the CPU your code uses and the memory you chose. Rates checked 23 September 2026.

Estimated compute cost

55% less than Fly Machines74% less than CodeSandbox

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

1,000

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

At a glance

Fly Machines are Fly.io's general-purpose VMs, priced here at the Ashburn (iad) rates. CodeSandbox's figures come from Together's documentation of the CodeSandbox SDK; CodeSandbox is a Together company.

Fly Machines CodeSandbox SDK Runtime
Isolation Firecracker microVM Firecracker microVM Firecracker microVM, own kernel
How it bills A fixed size per second while started A fixed size in credits, by the minute rounded up Measured CPU plus reserved memory, by the second
2 vCPU, 4 GB performance-2x, $0.0861 an hour Nano, 10 credits an hour at $0.01486, $0.1486 $0.08 an hour fully busy, $0.03125 waiting
Size range Up to 16 performance vCPUs and 128 GB Pico (2 cores, 1 GB) to XLarge (64 cores, 128 GB) vCPUs and memory chosen per sandbox
Plan fee None; pay as you go Build free with 10 VMs at once; Scale $170 a month for 250 None; prepaid credit from $10
Free start Not stated on the pricing page The free Build plan 50 sandbox hours, no card
When idle Root disk is temporary; suspend keeps memory up to 2 GB only Hibernates after the session disconnects Pause keeps files, memory and processes, 1 to 365 days
Start Cold start about 2 seconds or more, in Fly's words Launches in under three seconds, in Together's words 351 ms median to first Python result, 24 September 2026

Which fixed size is cheaper?

The Fly Machine, by a wide margin. A performance-2x with 4 GB is $0.0861 an hour and a CodeSandbox Nano VM, with the same 2 cores and 4 GB, is $0.1486: about 73% more. CodeSandbox also rounds each VM's time up to the next minute, so a run of 3 minutes 25 seconds is billed as 4. A Fly Machine bills by the second.

Neither price moves with the work. A Machine pays its whole size while it is started and a Nano pays 10 credits an hour while it runs, whether the code is compiling or waiting on a model. That is the difference Runtime removes: its CPU charge is measured, with a floor of a twentieth of a vCPU while the sandbox waits.

Each sells steps, not shapes. CodeSandbox doubles from Nano to Micro (4 cores, 8 GB) and on up. On Runtime you set vcpu and memoryMiB for each sandbox and pay for exactly that.

Cost for the same job

1,000 runs of a 2 vCPU, 4 GiB sandbox. Each run lasts 60 seconds and keeps the CPU busy for 20 CPU-seconds: an agent that mostly waits for a model. The Fly Machine is a performance-2x with 4 GB and the CodeSandbox VM is a Nano.

TextMachines     Size   1,000 × 60 s / 3,600 × $0.0861      = $1.44CodeSandbox  Size   1,000 × 60 s / 3,600 × $0.1486      = $2.48Runtime      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

At 100,000 runs a month that is $143.50 on Fly Machines, $247.67 on CodeSandbox and $63.89 on Runtime. With both CPUs busy for the whole minute, it is $1.33 on Runtime against $1.44 on Machines and $2.48 on CodeSandbox, so Runtime is cheaper however busy the sandbox is. Each run is a whole minute, so CodeSandbox's rounding adds nothing here; a 40-second run would still pay for a minute there. Plan fees, storage, network and free credits are left out.

What happens when the machine sits idle?

A Fly Machine's root disk is temporary, so files that must survive go on a Fly Volume. Suspend keeps a Machine's whole memory in a Firecracker snapshot and resumes in a few hundred milliseconds, but only for a Machine with 2 GB of memory or less, so the 4 GB size above cannot use it. Fly also says a suspended snapshot is discarded by a deploy, a host migration or maintenance.

A CodeSandbox VM hibernates once its session disconnects, and Together says it can resume or clone from a memory snapshot in three seconds.

A paused Runtime sandbox keeps its files, memory and running processes at any size, for the retention you set from 1 to 365 days, and wakes by itself on the next request, usually in about half a second. See how to pause and resume a sandbox.

Which one to pick

  • Pick Fly Machines for long-lived services near users: Machines run in 18 regions, beside Fly Volumes and Managed Postgres in the same account.
  • Pick CodeSandbox for very large VMs, up to 64 cores and 128 GB, or for many VMs on one plan: Scale runs 250 at once.
  • Pick Runtime for agent work that waits more than it computes: measured CPU at $0.025 a vCPU-hour, any size you set, per-second billing, and pause that keeps memory whatever the size.

Switch from either one

Create a Runtime sandbox where you created a Machine or a VM for each job, and stop it when the job ends. Size it to what the job needs rather than to the nearest step:

TypeScriptimport { Runtime } from "withruntime";const runtime = new Runtime();const sbx = await runtime.sandboxes.create({ vcpu: 2, memoryMiB: 4096, timeoutSeconds: 900 });try {  const run = await sbx.exec(["python3", "-c", "print(6 * 7)"]);  console.log(run.exitCode, run.stdout);} finally {  await sbx.stop();}

Or give your coding agent the one instruction in migration: it switches the project on a branch, tests it on the free trial and reports the monthly saving. npx withruntime compare --from fly-machines (or --from codesandbox) prices what you ran at the old provider's rates, and npx withruntime switch --from fly before your first top-up matches that top-up with credit, up to $100. The full side-by-sides are Runtime vs Fly.io and Runtime vs CodeSandbox.

Sources

Rates checked 23 September 2026; the Fly suspend and Together pages read 25 September 2026.

Facts on this page were checked on 25 September 2026.