> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GPU Types and Billing

> Whole-node GPU rental, sizing from the GPU type catalog, GPU limits, queueing, and per-second billing for GPU Sandboxes.

## GPU Types

`GET /v2/ai/sandbox-gpu-types` lists the GPU types the account can rent. Only enabled, qualified types are listed; requesting anything else fails with `422 resources_not_allowed`.

```json theme={null}
{
  "data": [
    {
      "type": "B300",
      "allowed_counts": [8],
      "cpu": { "default": 24, "max": 24 },
      "memory_mib": { "default": 262144, "max": 262144 },
      "disk_gib": { "default": 1024, "max": 1024 },
      "root_disk_gib": 200,
      "prices": [
        { "sku": "sandbox.node.b300", "unit": "node-second", "amount": "…", "currency": "USD" }
      ]
    }
  ],
  "meta": { "page_number": 1, "page_size": 20, "total_pages": 1, "total_results": 1 }
}
```

The values above illustrate the shape only. Read the actual catalog from the API.

| Field | Description |
| - | - |
| `type` | GPU type to pass as `gpu.type`. |
| `allowed_counts` | The GPU counts that can be requested as `gpu.count`. Currently each type lists exactly one, its node's GPU count, so a sandbox rents the whole node. Read `gpu.count` from this list rather than hard-coding it. |
| `cpu`, `memory_mib`, `disk_gib` | CPU cores, memory, and the size of `/data` (the sandbox's own disk) per GPU. A sandbox gets `default` × its GPU count. `max` equals `default`. |
| `root_disk_gib` | Limit in GiB of the root filesystem: the image plus everything written outside `/data`. It applies to the whole sandbox, whatever its GPU count. |
| `prices` | Billed units and prices. `null` until prices are published. |

### Worked Example

With the `B300` entry above, `"gpu": {"type": "B300", "count": 8}` gives the sandbox:

| Field | Per GPU | Calculation | On the sandbox |
| - | - | - | - |
| `cpu` | 24 cores | 24 × 8 | `"cpu": 192` |
| `memory_mib` | 262,144 MiB (256 GiB) | 262,144 × 8 | `"memory_mib": 2097152` (2 TiB) |
| `disk_gib` | 1,024 GiB | 1,024 × 8 | `"disk_gib": 8192` |

The totals are calculated when the sandbox is created and stored with it. `GET /v2/ai/sandboxes/{sandbox_id}` returns them as `cpu`, `memory_mib`, and `disk_gib`, and a later change to the catalog doesn't change an existing sandbox. `cpu` is a number and can be fractional.

## Whole-Node Rental

Each sandbox currently rents a whole GPU node. `gpu` is required and names a type and a count from its `allowed_counts`. The CLI takes it as `TYPE:COUNT`:

```bash CLI theme={null}
telnyx-edge sandbox-gpu create --image ghcr.io/acme/trainer:1.4 --gpu B300:8 --timeout 36000 \
  -- python train.py
```

```json REST theme={null}
{
  "image": { "ref": "ghcr.io/acme/trainer:1.4" },
  "command": ["python", "train.py"],
  "gpu": { "type": "B300", "count": 8 },
  "timeout": 36000
}
```

* The sandbox gets every GPU on one node of that type, with that type's `cpu`, `memory_mib`, and `disk_gib` defaults multiplied by the count. These values appear on the sandbox.
* No other sandbox shares the node.
* `disk_gib` is the size of `/data`, the sandbox's own disk, mounted in every sandbox. Writing past its size fails with "no space left on device", and the sandbox keeps running.
* Everything written outside `/data` (the image's directories, `/tmp`, caches, package installs) counts against the root filesystem's separate limit, `root_disk_gib`. Going past it ends the sandbox with `disk_limit_exceeded`.
* Nothing on either survives the sandbox: persist data to [Cloud Storage](https://developers.telnyx.com/docs/cloud-storage/overview.md) from inside the sandbox.

## GPU Limits

Each organization has a limit per GPU type: the most GPUs of that type its sandboxes can hold at once. Every sandbox that hasn't ended counts, queued and preparing ones included. A create that would take the organization over its limit for the requested type fails at once with `429 quota_exceeded`, and the error's detail names the type, the limit, the GPUs in use, and the GPUs requested. It is never queued. Contact support to raise a limit.

## Queueing

When the organization is within its GPU limit but no node of the requested type is free, the sandbox waits in `queued`. Once a node is found, it can spend time in `preparing` while its GPUs are prepared. `queue_timeout` (default 600 seconds, maximum 86,400) covers both: a sandbox still queued or preparing when it passes ends with `termination_reason: queue_timeout`. Queued and preparing time isn't billed.

## Billing

* The billing clock starts when the sandbox enters `running` (`started_at`) and stops when it is `terminated`. Time in `queued`, `preparing`, `scheduled`, and `starting`, including image pulls, is free.
* A sandbox is billed per node type, per second. The price list is in `prices` on `GET /v2/ai/sandbox-gpu-types`.
* What is billed is the rented node over wall-clock time, not measured utilization.
* Set `timeout` or `idle_timeout` to bound the cost of a sandbox that is left running.
