Skip to content

Resources and billing

A sandbox reserves CPU and memory on its node for as long as it runs, and your bucket is billed for that reservation. The node also measures what the sandbox uses, so you can size the next one to fit.

Resource CLI flag SDK argument Default Range
CPU, in vCPU --cpu cpu= 1 more than 0, at most 4 (fractions such as 0.25 work)
Memory, in MiB --memory memory= 1024 128 to 8192
Processes --pids pids= 2048 1 to 32768
Timeout, in seconds --timeout timeout= 600 1 to 86400
Idle timeout, in seconds --idle-timeout idle_timeout= off up to the timeout

The request is also the sandbox’s limit: its CPU is capped at the vCPU it reserved, and a sandbox that needs more memory than it reserved ends with oom_killed. The sandbox may write up to 2048 MiB of disk; disk is not billed.

Your bucket pays for what a sandbox reserves, from the moment its container starts until gVisor stops, however it ends. Each usage record bills, for its stretch of time:

  • CPU: vCPU reserved × seconds, or the CPU-seconds measured if those are more;
  • Memory: GiB reserved × seconds, or the GiB-seconds measured if those are more.

Because the sandbox cannot use more than it reserved, the bill is the reservation almost always. The measured amount can be slightly larger in a busy sandbox’s first minute, which includes gVisor’s start; that minute is then billed as measured.

For example, a sandbox with 1 vCPU and 1024 MiB that runs for 90 seconds is billed 90 CPU-seconds and 90 GiB-seconds, however little it does.

Not billed
Pulling the image Billing starts when the container starts.
A sandbox that never started Status failed: nothing is billed.
After the stop Logs and retained files are free.
Disk and network Measured and reported, not billed.

The bill goes to the bucket of the login the sandbox was created with. Model calls through the inference API are billed to the bucket of the key they present, separately from sandboxes.

There is no price list for sandboxes yet: their usage is billed in CPU-seconds and GiB-seconds and not converted to money.

  • Ask for what the sandbox uses. Fractional CPU (--cpu 0.25) and small memory (--memory 256) bill less for the same time. The measured amounts in its usage show what it used.
  • Set a short --timeout, and terminate a sandbox when you are done with it.
  • Set --idle-timeout on a sandbox that waits for commands, so it ends when nobody uses it.

Every API request checks that the bucket’s owner has a balance; with none, the API refuses requests, creating a sandbox included, with 403 (what the refusal looks like).