# Sandbox pricing and usage

> Prices of Serenity Edge Sandboxes per vCPU-hour, per GiB-hour of memory and per GiB-month paused, billed per second since 12 November 2026: what is billed when, a worked example and how usage is recorded.

Source: https://docs.serenityedge.ai/docs/sandboxes/pricing-and-usage/

> **Private preview**
> 
> Sandboxes are in private preview, by invitation: they are enabled on request for existing Serenity Edge customers and partners (see [Access](https://docs.serenityedge.ai/docs/sandboxes/overview/#access)). Prices may change during the preview; a change will be announced in the [release notes](https://docs.serenityedge.ai/release-notes/) before it applies.

## Prices

Prices are in US dollars. Sandbox usage is billed from 12 November 2026.

| State | What is billed | Price |
| --- | --- | --- |
| Running | Each vCPU reserved for the sandbox | 0.0504 USD per vCPU-hour |
| Running | Each GiB of memory reserved for the sandbox | 0.0162 USD per GiB-hour |
| Paused | Each GiB actually stored for the sandbox (memory and disk) | 0.08 USD per GiB-month |
| Saved template | Each GiB actually stored by a template of your account (memory and disk), on accounts with templates enabled (see [Save a sandbox as a template](https://docs.serenityedge.ai/docs/sandboxes/templates/#prices)) | 0.08 USD per GiB-month |

-   **Billed per second.** A running sandbox is billed for the time it runs, to the millisecond: 0.000014 USD per vCPU-second and 0.0000045 USD per GiB-second.
-   **No minimum.** A sandbox that runs for three seconds is billed for three seconds.
-   **No welcome credit.**
-   **Reserved, not used.** A running sandbox is billed for the vCPUs and memory of its size, whether its processes use them or not. Disk is not billed while a sandbox runs.
-   **Internet access does not change the price.** A sandbox created with no internet access is billed exactly as any other (see [Sandboxes with no internet access](https://docs.serenityedge.ai/docs/sandboxes/network-and-security/#sandboxes-with-no-internet-access)).
-   **Billed per reserved vCPU, with CPU time shared under load.** The vCPUs you are billed for are reserved for the sandbox, not dedicated physical CPUs. As on burstable instances, sandboxes share CPU time when many of them are busy at once, so a sandbox can get less CPU than its vCPUs while it is still billed for all of them. Memory is reserved for the sandbox alone (see [Sandbox size](https://docs.serenityedge.ai/docs/sandboxes/limits-and-quotas/#sandbox-size)).
-   **A month is 730 hours.** A paused sandbox costs 0.08 / 730 USD per GiB for each hour it stays paused, and a part of an hour in proportion.
-   **A GiB is 2^30 bytes.** Memory in MiB is divided by 1,024.

These are the prices of the price list `2026-11-v1`. A price change is published as a new price list.

## What is billed when

| From | To | Billed as |
| --- | --- | --- |
| Create, or resume | The first of: your kill, the timeout, a pause, a platform failure | Running |
| Pause | The first of: your resume, your kill, expiry after 30 days | Paused |

-   **Running ends when the sandbox stops being yours to use,** not when the platform has finished cleaning up. After a platform failure, nothing is billed from the moment of the failure.
-   **Paused storage is measured, not estimated.** The stored size is what the pause actually writes for your sandbox: its memory and the changes to its disk, as stored. The content of the template and the free disk are not counted. If you pause the same sandbox several times, each pause adds to what is stored, and all of it counts until the sandbox is killed or expires.
-   **A paused sandbox costs money until it is gone.** Kill it when you no longer need it. Otherwise it is billed until it expires, 30 days after the pause.
-   **Maintenance pauses are billed as pauses.** When Serenity Edge pauses a sandbox for maintenance, the running price stops and the paused price applies until you resume or kill it (see [Maintenance](https://docs.serenityedge.ai/docs/sandboxes/api-reference/#maintenance)).

## Worked example

The size here, 2 vCPUs and 2 GiB of memory, is the size of the preview's template (see [Sandbox size](https://docs.serenityedge.ai/docs/sandboxes/limits-and-quotas/#sandbox-size)).

A sandbox of 2 vCPUs and 2 GiB of memory runs for 10 minutes 30 seconds, is paused for 48 hours with 0.5 GiB stored, is resumed, runs for 5 more minutes and is killed.

| Step | Quantity | Price | Amount (USD) |
| --- | --- | --- | --- |
| First run, vCPU | 2 vCPUs × 630 s = 1,260 vCPU-seconds | 0.000014 | 0.01764 |
| First run, memory | 2 GiB × 630 s = 1,260 GiB-seconds | 0.0000045 | 0.00567 |
| Paused | 0.5 GiB × 48 h, in 48 hourly intervals of 0.5 GiB-hours | 0.08 / 730 per GiB-hour | 48 × 0.000054795 = 0.00263016 |
| Second run, vCPU | 2 vCPUs × 300 s = 600 vCPU-seconds | 0.000014 | 0.0084 |
| Second run, memory | 2 GiB × 300 s = 600 GiB-seconds | 0.0000045 | 0.0027 |
| **Total** |  |  | **0.03704016** |

The paused amount shows the rounding rule. One hour at 0.5 GiB is 0.5 × 0.08 / 730 = 0.0000547945... USD, which rounds to 0.000054795 USD, and 48 such intervals add up to 0.00263016 USD.

For scale, a sandbox of the template's size costs 2 × 0.0504 + 2 × 0.0162 = 0.1332 USD for each hour it runs.

## How usage is recorded

Usage is recorded in intervals, and each interval has its own amount:

-   a running sandbox closes an interval every 5 minutes, and one when the run ends;
-   a paused sandbox closes an interval every hour, and one when the pause ends.

The amount of an interval is computed from its quantities and the price list in exact decimal arithmetic, and rounded once to the nearest billionth of a dollar (0.000000001 USD), halves away from zero. The invoice adds the amounts as recorded, so the same quantities and prices always give the same total.

Each interval records why it ended, as its `end_reason`:

| `end_reason` | Meaning |
| --- | --- |
| `interval` | A periodic cut. The sandbox continued in the same state. |
| `client_close` | You killed the sandbox, or it shut itself down from inside. For a paused sandbox: you killed it before its 30 days. |
| `ttl` | A running sandbox reached its timeout. For a paused sandbox: it reached its 30 days. |
| `pause` | A running sandbox was paused, by you, by `autoPause` at its timeout, or by Serenity Edge for maintenance. |
| `resume` | A paused sandbox was resumed. |
| `platform_failure` | The platform lost the sandbox. Billing ended at the failure. |
| `quota` | Serenity Edge ended the sandbox on your account, for example because the account's access was revoked. |

**Corrections.** If an interval turns out to have been billed wrongly, for example because the end of a sandbox was detected late, the recorded interval is not changed. A separate adjustment is recorded, with a positive or negative amount. A pause whose stored size is not yet known when its first interval closes is recorded at 0 bytes and corrected the same way once the size is measured.

**Metadata.** The metadata of a sandbox is copied into its usage, so you can use it to attribute cost to your own users or tasks. Do not put secrets or personal data in it.

You can read these records with [`GET /v1/usage`](https://docs.serenityedge.ai/docs/sandboxes/pricing-and-usage/#check-your-usage). A webhook that sends them to you is not offered in the preview.

## Check your usage

`GET https://api.serenityedge.ai/v1/usage` returns the usage records of the API key you call it with: the records described above, for the sandboxes created with that key. Send the key as `Authorization: Bearer` (the `/v1` habit) or as `X-API-Key` (the E2B one):

```bash
curl -sS "https://api.serenityedge.ai/v1/usage?limit=100" \
  -H "Authorization: Bearer $SERENITY_EDGE_API_KEY"
```

```json
{
  "object": "usage",
  "sandboxes": {
    "records": [
      {
        "id": "3f6c2a9e0b1d47c58a2e9f04d6b7c1e83a5d9f20c4b6e8a1d3f5b7c9e0a2c4e6",
        "sandbox_id": "i8x2k4m6p0q3r5t7v9w1",
        "written_at": "2026-11-17T16:20:00.412Z",
        "metadata": { "edge.partner_key": "1a2b3c4d", "purpose": "quickstart" },
        "interval": {
          "start": "2026-11-17T16:15:00.000Z",
          "end": "2026-11-17T16:20:00.000Z",
          "kind": "run",
          "end_reason": "interval"
        },
        "shape": { "vcpu": 2, "memory_mib": 2048, "disk_mib": 27039 },
        "vcpu_seconds_reserved": "600",
        "memory_gib_seconds_reserved": "600",
        "paused_gib_hours": "0",
        "rate_card": "2026-11-v1",
        "amount_nano_usd": 11100000,
        "currency": "USD"
      }
    ],
    "next_cursor": "AT9sKp4LHUfFii6fBNa3weg6XZ8gxLboodP1t8ngosTm",
    "has_more": false,
    "watermark": "2026-11-17T16:20:30.000Z"
  }
}
```

Each record is one interval of one sandbox, with its quantities and its amount in billionths of a dollar: `amount_nano_usd` 11,100,000 is 0.0111 USD, five minutes of a sandbox of 2 vCPUs and 2 GiB. The amounts are exact decimal strings and integers, so add them without floating point. The [API reference](https://docs.serenityedge.ai/docs/api/edge/get-usage/) describes every field.

-   **Your key's records only.** Each key reads the records of the sandboxes it created, and no other key's, even within your account. `metadata` holds the metadata you set at create and `edge.partner_key`, a short fingerprint of the key that created the sandbox (never the key itself). After you rotate a key, the new key reads the records of the sandboxes it creates; your invoice still counts every record of your account.
-   **Paging.** Records come in the order they were written, at most `limit` per page (1 to 1000, 100 by default). Send the page's `next_cursor` as `cursor`, with the same key, until `has_more` is `false`. Without `cursor` you read from the key's first record. The cursor is opaque: store it as it is. Keep the last `next_cursor` to read only what is new next time; a page with nothing new is empty and returns the same cursor. `next_cursor` is `null` while the key has no record.
-   **Counting.** Count each record `id` once. Add adjustments with their sign: an `adjustment` corrects an earlier record (`adjusts` names it) and counts in the month of its `written_at`, as on the [invoice](https://docs.serenityedge.ai/docs/sandboxes/pricing-and-usage/#on-the-invoice).
-   **Freshness.** A running sandbox's record is written every 5 minutes, a paused sandbox's every hour, and both when the run or the pause ends. `watermark` is the time up to which every sandbox event is in the records.
-   **Limits.** Each key may have 2 usage requests in flight and make 30 per minute. These limits are apart from the key's [control API limits](https://docs.serenityedge.ai/docs/sandboxes/limits-and-quotas/#request-limits): reading usage never takes the budget of your sandbox calls, nor they its budget. Over them, or when too many pages are being read at once, the answer is `429 rate_limit_exceeded` with `Retry-After`; a key can occasionally get it slightly before it reaches these numbers. To follow your usage, read from your last cursor every few minutes rather than in a tight loop.
-   **Sandboxes only.** Inference has no usage records to read: what each inference request is billed is in the `usage` object of its response (see [Pricing and limits](https://docs.serenityedge.ai/docs/pricing-and-limits/#prices)).

Errors are in the [OpenAI error format](https://docs.serenityedge.ai/docs/errors-and-rate-limits/), as on every `/v1` route, not in the E2B shape of the sandbox paths:

| Status | `code` | When | What to do |
| --- | --- | --- | --- |
| 400 | `invalid_request_error` | A query parameter other than `cursor` and `limit`, one of them given twice, a `limit` outside 1 to 1000, or a `cursor` that is not a `next_cursor` of a page read with this key. `param` names the parameter. | Fix the request. Do not retry as is. |
| 401 | `invalid_api_key` | Missing, malformed or revoked API key. | Check the key. |
| 403 | `permission_denied` | The key's account does not have Sandboxes, so the key has no usage records to read. | See [Access](https://docs.serenityedge.ai/docs/sandboxes/overview/#access). |
| 429 | `rate_limit_exceeded` | Over the key's usage limits, or too many pages being read at once. | Wait for `Retry-After`, then retry. |
| 503 | `upstream_unavailable` | The usage records cannot be read for a moment. | Wait for `Retry-After`, then retry with backoff. |

A key of an account with Sandboxes that has not created a sandbox yet gets `200` with an empty page.

## On the invoice

-   Sandbox usage is invoiced monthly to the account that owns the key.
-   An interval counts in the month in which it ends, in UTC. A sandbox that runs across midnight at the end of a month is split between the two months at its 5-minute intervals.
-   An adjustment counts in the month in which it is made. An invoice that has been issued does not change: a correction to a past month appears on the next invoice.

A spending cap is not offered in the preview. See [Limits and quotas](https://docs.serenityedge.ai/docs/sandboxes/limits-and-quotas/) for what bounds your usage.
