Which is better, Modal or CodeSandbox?
It depends on machine size and what you already run. For agents that mostly wait on a model, Runtime has the lowest bill: $0.64 for 1,000 one-minute runs, against $2.48 on CodeSandbox and $3.97 on Modal. It stays the cheapest at every run length, because it counts the CPU spent, by the second. Pick Modal for GPU sandboxes or a team already running Modal functions. Pick CodeSandbox for a very large fixed machine, up to 64 cores and 128 GB, or for 250 VMs running at the same time on Scale.
At a glance
On Modal, 2 vCPUs are one physical core, its billing unit. CodeSandbox's rates are from
Together's documentation of the CodeSandbox SDK, which Together now lists as
deprecated in favor of its together-sandbox SDK. CodeSandbox is a Together
company.
| Modal Sandboxes | CodeSandbox SDK | Runtime | |
|---|---|---|---|
| Isolation | gVisor, a user-space kernel that intercepts system calls | Firecracker microVM | Firecracker microVM, own kernel |
| CPU | $0.1419 per physical core-hour (2 vCPUs), request or use | By VM size: Nano (2 cores, 4 GB) is $0.1486 an hour | $0.025 per vCPU-hour of measured CPU, with a small floor |
| Memory | $0.0240 per GiB-hour, request or use | Inside the VM size | $0.0075 per reserved GiB-hour |
| Billing unit | Per second | Per minute, rounded up | Per second |
| Shapes | CPU and memory requested per sandbox | Fixed sizes, up to 64 cores and 128 GB | Up to 16 vCPUs and 64 GiB (paid), chosen separately |
| Plan fee | Starter $0 with $30 a month of compute; Team $250 a month | Build free, 10 VMs concurrently; Scale $170 a month | None; prepaid credit from $10 |
| At once | 100 containers on Starter; 5,000 on Team | 10 VMs on Build; 250 on Scale | 4 without credit; 100 paid |
| Keeping state | Filesystem snapshots; up to 24 hours a sandbox | Memory snapshot and restore | Pause, snapshots and forks with memory and processes |
Which is cheaper for short runs?
It depends on how long each run lasts. Modal bills by the second, but at $0.1419 a core-hour plus $0.0240 a GiB-hour, which is $0.2380 an hour for this size. CodeSandbox's Nano VM costs $0.1486 an hour, but each run is rounded up to a whole minute.
| 1,000 runs, 2 vCPU, 4 GiB, 20 CPU-seconds each | Modal | CodeSandbox | Runtime |
|---|---|---|---|
| 20-second runs | $1.32 | $2.48 | $0.31 |
| 40-second runs | $2.64 | $2.48 | $0.47 |
| 60-second runs | $3.97 | $2.48 | $0.64 |
Modal is cheaper for runs under about 38 seconds, and CodeSandbox is cheaper for anything longer, up to a minute. Runtime bills by the second with no one-minute minimum. It counts CPU as measured, so it is the cheapest at every length.
Cost for the same job
The 60-second row in detail. Modal runs the 2 vCPU, 4 GiB sandbox on one physical core. CodeSandbox uses a Nano VM at 10 credits an hour, $0.01486 a credit. Each of the 1,000 runs lasts 60 seconds and does 20 CPU-seconds of work.
- CPU
- 1,000 × 60 s × 1 core × $0.00003942
- $2.37
- Memory
- 1,000 × 60 s × 4 × $0.00000667
- $1.60
- 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
A month of 100,000 runs costs $396.60 on Modal, $247.67 on CodeSandbox, and $63.89 on Runtime. The busy variant, with both CPUs busy for the whole minute, costs $1.33 on Runtime, $3.97 on Modal, and $2.48 on CodeSandbox. The rivals are unchanged, since both already charged for the full machine. Plan fees, storage, network and free credit are outside the figures.
User-space kernel or microVM?
Modal puts each sandbox under gVisor, which catches the sandbox's system calls and handles them in a kernel written to run in user space. CodeSandbox and Runtime both boot each sandbox as a Firecracker microVM, with its own Linux kernel behind hardware virtualization. For the trade-offs, see Firecracker vs gVisor and what is a microVM?.
Which one to pick
- Modal fits GPU sandboxes and teams already running Modal functions and scheduled jobs.
- CodeSandbox fits jobs that need a very large fixed machine, up to 64 cores and 128 GB, or a fleet of 250 VMs running at the same time on Scale.
- Runtime fits agent sandboxes: a microVM each, at 84% below Modal's price and 74% below CodeSandbox's. It measures CPU by the second, runs 100 at the same time, and has no plan fee.
Runtime Cloud
Runtime charges 84% less than Modal and 74% less than CodeSandbox for one job. It is also the only one of the three that bills by use. 1,000 one-minute runs of a 2 vCPU, 4 GiB sandbox cost $3.97 on Modal, $2.48 on CodeSandbox, and $0.64 on Runtime. Modal and CodeSandbox charge for the whole machine as long as it is up. Runtime counts the CPU the code spends, per second, inside a Firecracker microVM with its own kernel. Rates were checked 25 October 2026.
There is no plan fee. Sign in with npx withruntime login to start on the free usage, and use the migration guide for code you already have.
Porting from each
Modal's calls translate one for one, and no App is required:
modal.Sandbox.create(app=...) is Sandbox.create(), sb.exec(*args) is
exec, and Sandbox.from_name is Sandbox.getOrCreate(name). CodeSandbox's
create, command, file read and write, and shutdown calls each have a single
Runtime counterpart in the migration table.
Instead of picking a VM tier, you set vCPUs and memory per sandbox.
Pythonfrom withruntime import Sandboxwith Sandbox.create() as box: box.files.write("/workspace/invoice.py", "print(sum([125, 250, 375]))\n") print(box.exec("python3 /workspace/invoice.py", check=True).stdout)npx withruntime compare --from codesandbox reprices the sandboxes you ran
at CodeSandbox's rates next to Runtime's. Credit you add within 30 days of signing up is matched, up to $1,000 in total. A coding agent can do either port from the instruction
in migration, working on a branch and testing on the free usage. See Runtime vs Modal and
Runtime vs CodeSandbox.
Sources
Modal pricing and Modal Sandboxes pages were rechecked 26 October 2026. The rest were checked 25 October 2026.
- Modal pricing, Modal resources and billing, Modal Sandboxes, Modal security
- Together: CodeSandbox SDK, CodeSandbox SDK pricing
- Runtime pricing and security
Facts on this page were checked on 26 October 2026.