# Sizes and templates

A template is what is installed. A size is how much machine it gets. Pick both, or neither: every template has a sensible default size.

**CLI**

```
kosa8 cloud sizes                        # what this organization can make

# A half-vCPU, 1 GiB sandbox of any OCI image (boots cold, waits until it runs)
ID=$(kosa8 cloud sandbox create --size 0.5x1 --image python:3.12-slim --ttl 15m --json | jq -r .sandbox.id)
kosa8 cloud sandbox exec $ID -- nproc
kosa8 cloud sandbox rm $ID
```

**curl**

```
API=https://api.kosa8.com/v1
AUTH="Authorization: Bearer $KOSA8_API_KEY"

# A sized create may answer 202 "creating": poll until it runs
SBX=$(curl -s $API/sandboxes -H "$AUTH" -H 'Content-Type: application/json' \
  -d '{"size":"0.5x1","image":"python:3.12-slim","ttl_s":900}' | jq -r .sandbox.id)
until [ "$(curl -s $API/sandboxes/$SBX -H "$AUTH" | jq -r .sandbox.state)" = running ]; do sleep 2; done

curl -s $API/sandboxes/$SBX/exec -H "$AUTH" -H 'Content-Type: application/json' \
  -d '{"cmd":["python3","-c","import os; print(os.cpu_count())"]}' | jq -r .stdout

curl -s -X DELETE $API/sandboxes/$SBX -H "$AUTH"
```

**Python**

```
from kosa8 import Kosa8Cloud

cloud = Kosa8Cloud()

# create() waits for a sized sandbox to boot (wait=False to skip)
with cloud.sandboxes.create(size="0.5x1", image="python:3.12-slim", ttl_s=900) as box:
    print(box.info["cpus"], box.info["mem_mb"])   # 0.5 1024
    print(box.exec("nproc").stdout)               # 1: bursts to a whole vCPU
```

**JavaScript**

```
import { Kosa8Cloud } from '@kosa8/sdk';

const cloud = new Kosa8Cloud();

// create() waits for a sized sandbox to boot
const box = await cloud.sandboxes.create({ size: '0.5x1', image: 'python:3.12-slim', ttlS: 900 });
try {
  console.log(box.info.cpus, box.info.mem_mb);    // 0.5 1024
  console.log((await box.exec('nproc')).stdout);  // 1: bursts to a whole vCPU
} finally {
  await box.delete();
}
```

## Templates

| Template | What is in it | Default size |
|---|---|---|
| `base` | Alpine Linux with busybox `sh`. The default. | 1 vCPU, 256 MiB |
| `python` | Python 3.12 on Debian slim, with bash, git, curl, pip, pytest and uv | 1 vCPU, 256 MiB |
| `node` | Node.js 22 on Alpine, with bash and git | 1 vCPU, 384 MiB |
| `universal-2x4` … `universal-16x32` | Ubuntu 24.04 with about 150 tools and runtimes. [The universal image](https://docs.kosa8.com/guides/cloud-images/) | As named |

`GET /v1/templates` lists every template your organization can use, including prebuilt [benchmark environments](https://docs.kosa8.com/guides/benchmarks/) and the [gallery](https://docs.kosa8.com/guides/templates/).

## Sizes

A size is `VCPUSxGIB`. `GET /v1/sizes` and `kosa8 cloud sizes` list them.

| Size | vCPUs | Memory | Sandbox-hours per hour | Kind |
|---|---|---|---|---|
| `0.25x0.5` | 0.25, bursts to 1 | 512 MiB | 0.125 | small |
| `0.5x1` | 0.5, bursts to 1 | 1 GiB | 0.25 | small |
| `1x2` | 1, bursts to 2 | 2 GiB | 0.5 | small |
| `2x4` | 2 | 4 GiB | 1 | standard |
| `4x8` | 4 | 8 GiB | 2 | standard |
| `8x16` | 8 | 16 GiB | 4 | standard |
| `16x32` | 16 | 32 GiB | 8 | standard |

Your plan includes a number of sandbox-hours a month, counted against a `2x4`: an hour of `0.5x1` uses a quarter of one, an hour of `8x16` uses four. The largest size you can start also depends on the plan. Small sizes suit fleets of mostly idle sandboxes, such as RL rollouts and evals. Data disks go up to 500 GB with `disk_gb`. Plans and what they include are on [kosa8.com/pricing](https://kosa8.com/pricing/).

## Your own image

Pass `image` with any public OCI reference (`python:3.12-slim`, `ghcr.io/you/tool:1.4`). The first start pulls it, and later starts are fast. To start with your dependencies already installed, set one up once and save it as a [snapshot](https://docs.kosa8.com/concepts/snapshots/).

---
Source: https://docs.kosa8.com/concepts/sizes/
