# Quickstart

Sign up, install ons and run your first miniVM in under five minutes.

1. **Sign up**

   Open [onshore.sh/app](https://onshore.sh/app/) and sign in with one of the options the sign-in page
   shows: Google or an email magic link (disposable email addresses are refused). Your organization is created at your first sign-in.

2. **Add a card**

   An organization runs miniVMs only once it has a payment method. An owner opens **Billing** in
   the console and clicks **Add payment method**. The card is entered on a Stripe-hosted page; it
   never reaches our servers. Adding a card does not charge it; your bank may show a
   zero-amount check or a small amount that is never taken.

   Your first eligible card brings **500 welcome credits, valid 7 days from when they are granted** (1,000 credits
   cost €10). It is granted once per person
   and once per card. Unused welcome credit expires after 7 days. If no welcome credit is granted (the person or the card
   already had it), buy credits on **Billing** before you start a miniVM.

   Until a card is saved, `ons create` answers:
   `Add a card to start your first miniVM. Your first eligible card gets 500 credits.`

3. **Create an API key**

   In the console, open **API keys**, type a name (for example `laptop`) and click
   **Create key**. Copy the key now: it is shown once. It starts with `msb_`.

   You need it for the E2B SDKs and for CI. On your own computer, `ons login` can also create
   a key for you in the browser (next steps).

4. **Install ons**

   ### macOS

   ```bash
   curl --proto '=https' --tlsv1.2 -fsSL https://get.onshore.sh/install.sh | sh
   ```

   ### Linux

   ```bash
   curl --proto '=https' --tlsv1.2 -fsSL https://get.onshore.sh/install.sh | sh
   ```

   ### Windows (WSL2)

   `ons` runs on Windows inside WSL2. In PowerShell, install WSL with Ubuntu once:

   ```powershell
   wsl --install -d Ubuntu
   ```

   Then open the Ubuntu terminal and run:

   ```bash
   curl --proto '=https' --tlsv1.2 -fsSL https://get.onshore.sh/install.sh | sh
   ```

   The script installs `ons` in `~/.local/bin` after checking its signature, and installs the
   agent skill for the coding agents it finds. See [Install the CLI](https://onshore.sh/docs/install-cli).

5. **Log in**

   The install script runs `ons login` for you when you run it in a terminal. To run it
   yourself:

   ```bash
   ons login
   ```

   `ons` prints a page to open and a code like `ABCD-EFGH`. Open the page, type the code, and
   approve. `ons` saves a new API key in `~/.config/onshore/config.toml`.

   To use the key you created in step 3 instead, run `ons login --key` and paste it at the
   hidden prompt.

6. **Run your first miniVM**

   ```bash
   ons create
   ```

   `ons` prints the id of the new miniVM. It starts from the `base` template and lives 300
   seconds unless you kill it first.

   ```bash
   ons exec <minivm-id> -- uname -a
   ons exec <minivm-id> -- sh -c 'echo hello > /tmp/hello.txt && cat /tmp/hello.txt'
   ons kill <minivm-id>
   ```

   `<minivm-id>` is the id `ons create` printed. `ons ls` lists your miniVMs. `exec` runs the
   command without a shell, so use `sh -c '…'` for pipes and redirections. `kill` deletes the
   miniVM and its disk.

## Add credit

The welcome credit lasts 7 days. After that, or once it is used:

- You buy credit packs when you need them, or turn on **auto top-up** (off by default): pick a
  pack and a threshold in credits.
- You set a **monthly maximum**: credits bought in one calendar month (UTC) never go above it. It starts at €50; an owner
  raises it on **Billing**, within the limit of the account level.

See [Billing](https://onshore.sh/docs/account/billing) and [Pricing](https://onshore.sh/docs/account/pricing).

## Use the E2B SDK

The official E2B SDKs work with onshore.sh unchanged. Set two environment variables:

```bash
export E2B_DOMAIN=onshore.sh
export E2B_API_KEY=<your-api-key>
```

`<your-api-key>` is the onshore.sh API key from step 3.

### Python

```bash
pip install e2b
```

### JavaScript

```bash
npm install e2b
```

### Python

```python
from e2b import Sandbox

sbx = Sandbox.create(timeout=300)
result = sbx.commands.run("uname -a")
print(result.stdout)
sbx.files.write("/tmp/hello.txt", "hello")
print(sbx.files.read("/tmp/hello.txt"))
sbx.kill()
```

### JavaScript

```javascript
import { Sandbox } from "e2b";

const sbx = await Sandbox.create({ timeoutMs: 300_000 });
const result = await sbx.commands.run("uname -a");
console.log(result.stdout);
await sbx.files.write("/tmp/hello.txt", "hello");
console.log(await sbx.files.read("/tmp/hello.txt"));
await sbx.kill();
```

The SDKs need Python 3.11 or later, or Node 22.19 or later. See
[Migrate from E2B](https://onshore.sh/docs/guides/migrate-from-e2b) for what differs.

## Next steps

- [Build a template](https://onshore.sh/docs/guides/templates): Put your tools and dependencies in a template.
- [Open egress](https://onshore.sh/docs/guides/egress): Let a miniVM reach the hosts it needs.
- [Pause and resume](https://onshore.sh/docs/guides/lifecycle): Keep a miniVM for later instead of killing it.
- [CLI reference](https://onshore.sh/docs/reference/cli): Every `ons` command and flag.

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