# Concepts

miniVMs, templates, organizations, API keys, egress, pause and resume, snapshots, deletion receipts and credits.

## miniVM

A miniVM is one Firecracker microVM for one task. It has its own Linux kernel, memory and disk,
and it shares no memory, disk or network with other miniVMs (see the
[known limits](https://onshore.sh/docs/security/overview)). In the E2B SDKs a miniVM is a `Sandbox`.

A miniVM is in one of three states:

| State     | What it means                                                                             |
| --------- | ----------------------------------------------------------------------------------------- |
| `running` | It runs and counts against your running limit. Its vCPU and memory are billed per second. |
| `paused`  | Its memory and disk are saved. It uses no compute. Its saved copy is billed as storage.   |
| `killed`  | It is gone. Its disk and memory are deleted.                                              |

Every miniVM has a **timeout**: the number of seconds before it ends. With `ons create` the
default is 300 seconds. You can extend it at any time. See [Lifecycle](https://onshore.sh/docs/guides/lifecycle).

## Template

A template is the recipe a miniVM starts from. You write it in a `minisandbox.yaml` file: a base
image, the packages and files to add, the commands to run, the size, and the hosts the miniVM may
reach. A build turns the recipe into a **template version** (`v1`, `v2`…), backed by a snapshot.
New miniVMs start from the current version in seconds.

Versions never change once built. You can roll back to an older one. See
[Templates](https://onshore.sh/docs/guides/templates) and the [`minisandbox.yaml` reference](https://onshore.sh/docs/reference/minisandbox-yaml).

## Organization

An organization holds your members, API keys, templates, miniVMs, credits and limits. Everything
you create belongs to one organization. You can be a member of several. See
[Organizations](https://onshore.sh/docs/account/organizations).

## API key

An API key lets a program act for your organization: `ons`, the E2B SDKs, your CI. A key starts
with `msb_`. You create keys in the console, or `ons login` creates one for you after you approve
it in the browser. A key is shown once. See [API keys](https://onshore.sh/docs/account/api-keys).

## Egress

Egress is traffic from a miniVM to the outside world. It is **closed by default**: a miniVM
reaches only the hosts its template allows. A create can narrow or widen that list, and you can
change it while the miniVM runs. SMTP and cloud metadata addresses are always blocked.

When a miniVM needs a key for a service, onshore.sh adds it to the request on the way out. The
program in the miniVM sends a placeholder and never sees the key. See [Egress](https://onshore.sh/docs/guides/egress).

## Pause and resume

Pausing saves a miniVM's memory and disk and stops it. Resuming brings it back with its files
and running processes as they were. A paused miniVM wakes up by itself when you run a command in
it.

A miniVM can also pause on its own: when its timeout ends (with auto-pause), or after a period
without activity. Paused miniVMs are kept for 30 days. See [Lifecycle](https://onshore.sh/docs/guides/lifecycle).

## Snapshot

A snapshot is the frozen memory and disk of a miniVM. A template build makes one, and so does a
pause. Snapshots let miniVMs start and resume in seconds.

## Deletion receipt

Killing a miniVM stops it and deletes it: its processes stop, then its disk copy, snapshots, network state and limits are removed, and we record a deletion receipt listing each step _(planned: the end-to-end test of this has not passed yet)_.

## Credits

onshore.sh is prepaid. Your organization has a balance of credits (1,000 credits cost €10), and usage is drawn
from it per second. An organization runs miniVMs once it has a card on file; the first eligible card brings 500 welcome
credits, valid 7 days. You buy credit packs with that card on Stripe-hosted pages, by hand
or with auto top-up. When the balance reaches 0 credits, new miniVMs are
refused and running ones are paused, never killed. See [Billing](https://onshore.sh/docs/account/billing) and
[Pricing](https://onshore.sh/docs/account/pricing).

## Agent run

A run is one coding agent session (Claude Code, Codex or OpenCode) in a miniVM. You give it a task,
it works, it may ask you a question, and you read its result. The content of a run stays in the
miniVM. Agent runs are in Preview. See [Agent runs](https://onshore.sh/docs/guides/agent-runs).

Markdown version: https://onshore.sh/docs/concepts.md
