# Billing

> Per-second billing while a sandbox runs, nothing while it is stopped. Plans, time packs, auto-refill and per-sandbox usage.

You pay for **machine time**: the seconds a sandbox runs, multiplied by its size's rate. A stopped sandbox costs nothing, and neither do its disk and its automatic snapshots.

Current prices are on the [pricing page](/pricing). This page explains how the meter works.

## The meter

- Metering is per second, from the moment a sandbox is up until it is stopped.
- Each size consumes machine time at a fixed rate relative to `default`:

| Size | Rate |
| - | - |
| `small` | 0.5× |
| `default` | 1× |
| `large` | 2× |
| `xlarge` | ≈5.56× (50/9) |

- Your balance is counted in **seconds of `default` time**. One dollar buys 100,000 of them, so a `large` sandbox running ten minutes uses 1,200 seconds.
- Time while stopped is never counted. Time after a [refused stop](/docs/snapshots#when-a-stop-is-refused) isn't either — if we can't snapshot your sandbox we keep it running for you at no charge until we can.

## Plans

A plan sets how many sandboxes you can run at once and how fast you can start them, and includes a month of machine time equal to its price. The plan fee is not a fee on top: every dollar comes back as machine time.

| Plan | Run at once | Starts per minute / hour / day |
| - | - | - |
| $20 / month | 100 | 12 / 60 / 200 |
| $100 / month | 300 | 30 / 210 / 840 |
| $500 / month | 1,000 | 65 / 420 / 1,680 |
| $2,000 / month | 2,000 | 90 / 600 / 2,400 |

- Included time renews each billing month and does **not** roll over.
- `xlarge` requires the $100 plan or higher.
- Upgrades are prorated and take effect immediately; downgrades apply at renewal.
- For organizations, the price and limits are per seat — see [Organizations](/docs/organizations).

## Time packs and auto-refill

Need more time in a month? Buy **time packs**: $20 each, the same rates, and they **never expire**. Plan time is always spent first, then packs.

Turn on **auto-refill** to buy packs automatically when your balance falls below a threshold (in hours), so long-running work never stops for lack of credit:

```bash
sbx billing credits 3          # buy three packs now
sbx billing autorefill on      # refill automatically
sbx billing                    # plan, renewal date, balance, auto-refill
sbx billing portal             # cards and invoices (Stripe)
```

Or use the dashboard's **Billing** page, which shows your balance, a daily usage chart and your invoices.

## Getting started

You need a plan before you can start a sandbox. Choosing one (dashboard **Billing**, or `sbx billing plan 20`) adds your card and charges the first month right away. Plans renew monthly until you cancel. There's no free trial.

Cancelling a plan runs to the end of the period, and nothing is deleted. A trial that had already started is different: cancelling it, or removing its only card, ends it at once and permanently deletes all of the account's sandboxes and snapshots ([details](/docs/limits#trials-that-had-already-started)).

Without a card you can still sign in, read the docs, use the CLI and look around the dashboard. Creating, forking or restoring a sandbox answers `402 payment_method_required` until you add one.

## Running out

When a wallet's balance reaches zero and auto-refill is off:

1. New creates, resumes and forks fail with `402 billing_required`.
2. We email the account owner. Running sandboxes keep running for a **24 hour grace period**, so you can top up before anything stops.
3. If the balance is still empty after the grace period, running sandboxes are **stopped** (memory and disk kept — nothing is lost).
4. Buying a pack or turning on auto-refill lets you resume them exactly where they were.

To hear about a low balance earlier, set your own thresholds on the dashboard's **Alerts** page.

## Check your balance

```bash title="CLI"
sbx limits
sbx limits --json
```

```bash title="curl"
curl -sS https://sandboxer.com/api/v1/limits \
  -H "Authorization: Bearer $SANDBOXER_API_KEY"
```

Useful fields: `creditBalanceHours`, `creditBalanceSeconds`, `packBalanceDollars`, `subscriptionRemainingSeconds`, `last24hUsageSeconds`, `starts.minute|hour|day.remaining`, `canStart`.

## Per-sandbox usage

Bill your own users from the same numbers that drain your balance:

```bash title="CLI"
sbx usage sb_k3v9x2mq
sbx usage sb_k3v9x2mq --since 2026-09-01 --until 2026-10-01
```

```bash title="curl"
curl -sS "https://sandboxer.com/api/v1/sandboxes/sb_k3v9x2mq/usage?since=2026-09-01T00:00:00Z&until=2026-10-01T00:00:00Z" \
  -H "Authorization: Bearer $SANDBOXER_API_KEY"
```

| Field | Meaning |
| - | - |
| `seconds` | Billable seconds in the window, rate already applied |
| `dollars` | `seconds` at list price |
| `secondsPerDollar` | So you can price it yourself |
| `running` | `true` while the meter is still moving |

## Storage

Storage isn't billed: each plan includes an amount for what you keep, **sandboxes that aren't running** (stopped or failed: their disk, memory and automatic snapshots) and **named snapshots**. Running sandboxes don't count. It's measured as the data beyond the shared OS image, about every 10 minutes.

| Plan | Storage included |
| - | - |
| No plan | 10 GB |
| Time packs without a plan (while you have a balance) | 50 GB |
| $20 / month | 50 GB |
| $100 / month | 250 GB |
| $500 / month | 1 TB |
| $2,000 / month | 5 TB |

An organization has one amount, from its plan (not multiplied by seats). At or over it, new sandboxes (including from templates and share codes), forks and named-snapshot saves answer `402 storage_limit_reached` until you delete stopped sandboxes or named snapshots, or upgrade. Storage never blocks stopping, resuming or deleting, and going over never deletes anything unless you turn on auto-delete: new sandboxes wait instead.

**Auto-delete** is an account setting, off by default, in the dashboard under [Billing → Storage](/app/billing/storage) (an organization's owner sets it for the organization). When it's on and you're over your included storage, we pick the stopped sandboxes that bring you back under, least recently used first (by their last create, start or stop), and email you the list with the date they'll be deleted, at least 7 days later. On that date, if you're still over and the setting is still on, they're deleted and we email you what was removed; if you're back under or turned it off, nothing is deleted. Running sandboxes and named snapshots are never deleted by it. The out-of-storage error links to the setting. With the API: `PATCH /api/v1/account/storage` with `{"autoCleanup": true}`; `GET /limits` shows it as `storage.autoCleanup`.

See what you use on the dashboard's **Billing** page, the **Stored** column on **Sandboxes**, or `storage` in `GET /api/v1/limits`:

```bash title="CLI"
sbx limits --json | jq '.storage'
```

## Worked examples

At the `default` rate of $0.036 per hour:

| You run | Machine time | Cost |
| - | - | - |
| One `default` sandbox, 8 h/day, 22 days | 176 h | $6.34 — inside the $20 plan |
| One `default` sandbox around the clock | 730 h | $26.28 — the $20 plan plus one pack |
| 200 `small` sandboxes for 1 hour each | 100 h of `default` time | $3.60 |
| A `large` sandbox for a 3-hour build, then stopped for a month | 6 h | $0.22 |
