Which is better, Fly Machines or CodeSandbox?
It depends on whether you run long-lived services or many large VMs. For agent work that waits more than it computes, Runtime bills the least: $0.64 for the job, against $1.53 on a Fly Machine and $2.48 on CodeSandbox. It stays the cheapest when both CPUs are busy. Pick Fly Machines for services near users in 17 regions, next to Fly Volumes and Managed Postgres. Pick CodeSandbox for VMs up to 64 cores and 128 GB, or for 250 VMs concurrently.
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.0916704 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) | Up to 16 vCPUs and 64 GiB paid, chosen apart |
| Plan fee | None; pay as you go | Build free with 10 VMs concurrently; Scale $170 per month for 250 | None; prepaid credit from $10 |
| Free start | Not stated on the pricing page | The free Build plan | 100 free hours of a 1 GB machine in the first 30 days, 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 while you have credit |
| Start | Cold start about 2 seconds or more, in Fly's words | Launches in under three seconds, in Together's words | A new microVM per create, from a machine started ahead of time for the common shapes; timed each minute on speed |
Which fixed size is cheaper?
The Fly Machine, by a wide margin. A performance-2x with 4 GB is $0.0916704 an
hour. A CodeSandbox Nano VM, with the same 2 cores and 4 GB, is $0.1486.
That is about 62% 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 changes with the work. A Machine pays its whole size while it is started. A Nano pays 10 credits an hour while it runs, whether the code is compiling or waiting on a model. Runtime removes that difference. Its CPU charge is measured, with a floor of a twentieth of a vCPU while the sandbox waits.
Each one sells fixed sizes, not any size you choose. CodeSandbox doubles from Nano to Micro (4 cores,
8 GB) and so 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.
- Size
- 1,000 × 60 s / 3,600 × $0.0916704
- $1.53
- Size
- 1,000 × 60 s / 3,600 × $0.1486
- $2.48
- CPU
- 1,000 × 20 s / 3,600 × $0.025
- $0.14
- Memory
- 1,000 × 60 s / 3,600 × 4 × $0.0075
- $0.50
At 100,000 runs per month, the cost is $152.78 on Fly Machines, $247.67 on CodeSandbox and $63.89 on Runtime. With both CPUs busy for the whole minute, the job costs $1.33 on Runtime, against $1.53 on Machines and $2.48 on CodeSandbox. 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. It works 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. 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, while you have credit. See how to pause and resume a sandbox.
Which one to pick
- Pick Fly Machines for long-lived services near users. Machines run in 17 regions, next to 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 concurrently.
- 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 at any size.
Runtime Cloud
Runtime runs the same job for 58% less than a Fly Machine and 74% less than CodeSandbox. 1,000 one-minute runs of a 2 vCPU, 4 GiB sandbox cost $1.53 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 25 October 2026.
Try it on the free usage: npx withruntime login is the only setup.
For code that drives Fly Machines today, the migration guide
shows the switch.
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, not 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 { await sbx.files.write("/workspace/invoice.py", "print(sum([125, 250, 375]))\n"); const run = await sbx.exec(["python3", "/workspace/invoice.py"]); 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 usage, and reports the
monthly saving. npx withruntime compare --from fly-machines (or
--from codesandbox) prices what you ran at the old provider's rates. Credit you add within 30 days of signing up is matched, up to $1,000 in total. The full side-by-sides are
Runtime vs Fly.io and
Runtime vs CodeSandbox.
Sources
Fly.io prices checked 25 October 2026.
Rates checked 25 October 2026; the Fly suspend and Together pages were read 26 October 2026.
- Fly.io pricing, Machine suspend and resume, Fly Volumes, Fly.io regions
- Together: CodeSandbox SDK, CodeSandbox SDK pricing
- Runtime pricing and speed
Facts on this page were checked on 26 October 2026.