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

# Quickstart

> Get your first GPU instance running

Create a pool, buy compute time into it, and start your first GPU instance on SF Compute.

## Install the CLI

Download and run the install script.

```bash theme={null}
curl -fsSL https://cli.sfcompute.com | bash
```

## Log in

Authenticate the CLI.

```bash theme={null}
sf login
```

This opens your browser to sign in and stores your credentials locally.

## Check what you can buy

[SKUs](https://docs.sfcompute.com/preview/instance-skus.md) describe the hardware you can buy. List them and when each
becomes available, 1 row per SKU.

```bash theme={null}
sf availability
```

```text theme={null}
  NAME        ID               NEXT AVAILABLE  NEXT 48H
  ams-1-h100  sku_7GtBqvXk2Nm  now (24)        ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▁▁▁▁▁  peak: 24
  iad-2-h100  sku_Wm5cRzJq8Ld  now (64)        ▇▇▇▇▇▇▇▇▇▇▁▁▁▁▁▁▁▁▁▁  peak: 64
  ord-1-a100  sku_2xPfVn6KwQh  now (96)        ▇▇▇▇▇▄▄▄▄▄▂▂▂▂▂▁▁▁▁▁  peak: 96
  sea-3-h100  sku_4UpxzQw7A8N  now (128)       ▇▇▇▇▇▇▇▇▇▇▁▁▁▁▁▁▁▁▁▁  peak: 128
  nrt-1-h100  sku_Ht9sLc3MvBn  now (48)        ▇▇▇▇▇▇▇▇▇▇▇▇▁▁▁▁▁▁▁▁  peak: 48
```

`NEXT AVAILABLE` is the soonest instances become available and how many. Values are `now (N)`, a
time like `Today, 8:00pm (4)`, or `—` when nothing is scheduled. `NEXT 48H` sparklines the schedule
with the peak shown to the right.

## Create an empty pool

A [pool](https://docs.sfcompute.com/preview/pools.md) tracks your compute allocation over time. You buy compute time into a pool
with orders, and instances on the pool run when there's allocated time. Create a pool named `dev`.

```bash theme={null}
sf pools create --name dev
```

## Buy compute time

> [!NOTE]
>
> Buying compute time charges your organization. Make sure you have credits: check with
> `sf billing balance` or [top up on the dashboard](https://sfcompute.com/dashboard).

Place a buy [order](https://docs.sfcompute.com/preview/orders.md) for compute time on your pool. The command guides you through
each option interactively. You set the number of nodes (each node runs 1 instance), start time,
duration, rate, and the [SKU](https://docs.sfcompute.com/preview/instance-skus.md) the order pins to. For this guide,
choose a start time of `now`.

```bash theme={null}
sf orders create --pool dev --side buy
```

## Check your order

List your orders and check the status.

```bash theme={null}
sf orders list
```

```text theme={null}
--------------------------------------------------------------------------------------------------------
SIDE  STATUS  PERIOD  NODES  RATE ($/NODE/HR, 8x GPU)  POOL  SKU              ID
buy   filled  Mar 23  1      ≤$20.00/node/hr           dev   sku_4UpxzQw7A8N  ordr_5KwQh2xPfVn6M3RtLcQw9
```

> [!NOTE]
>
> If the order shows `cancelled`, the price was too low or there was no availability. Try a higher
> rate, a later start time, or `--allow-standing`. A standing order stays open on the orderbook until
> it fills or you cancel it.

## List images

An [image](https://docs.sfcompute.com/preview/images.md) is the bootable disk template an instance starts from. You need an image
name or ID to create an instance. List the images available to you.

```bash theme={null}
sf images list
```

```text theme={null}
----------------------------------------------------------------------------------------
NAME                                               VISIBILITY  STATUS     CREATED
sfc:image:sfcompute:public:ubuntu-24.04-cuda-13.2  public      completed  Feb 23, 6:50pm
```

SF Compute publishes public images with Ubuntu and CUDA pre-installed. You can also
[build and upload your own custom images](https://docs.sfcompute.com/preview/images.md).

## Create an instance

First, create a startup script that injects your SSH key so you can connect to the instance.

```bash theme={null}
# The $(cat ...) lines expand on your machine as startup.sh is written,
# embedding your public keys in the script.
cat >startup.sh <<SCRIPT
#!/bin/bash

mkdir -p /root/.ssh
cat >>/root/.ssh/authorized_keys <<"EOF"
$(cat ~/.ssh/id_rsa.pub 2>/dev/null)
$(cat ~/.ssh/id_ecdsa.pub 2>/dev/null)
$(cat ~/.ssh/id_ed25519.pub 2>/dev/null)
EOF
SCRIPT
```

Then create an [instance](https://docs.sfcompute.com/preview/instances.md) on your pool with the public image.

```bash theme={null}
sf instances create --pool dev --sku sku_4UpxzQw7A8N \
  --image sfc:image:sfcompute:public:ubuntu-24.04-cuda-13.2 --cloud-init ./startup.sh
```

Your pool already has compute time from the order you placed. Because you chose a start time of
`now`, your instance gets its allocation within about a minute and begins booting. Compute ownership
and instances are separate: you can terminate and recreate instances without losing your purchased
compute time.

## Watch your instance start

List your instances to watch the status. The `NAME` column shows the name you'll use to connect.

```bash theme={null}
sf instances list
```

The image download and boot process takes up to 10 minutes before SSH is available.

## Connect via SSH

SSH in with the instance name from `sf instances list`.

```bash theme={null}
sf instances ssh <instance-name>
```

Verify the GPUs are available.

```bash theme={null}
nvidia-smi
```

## Next steps

You now have a running GPU instance. Here are some things to try.

### Sell back unused compute time

Place a sell order as a standing order. If someone buys it, you get credits back (minus a variable
[platform fee](https://docs.sfcompute.com/preview/guides/reselling.md#platform-fee)) and the instance loses its compute time.

```bash theme={null}
sf orders create --pool dev --side sell --count 1 --sku sku_4UpxzQw7A8N \
  --start now --duration 1h --min-rate 8.00 --allow-standing
```

### Check your pool's allocation schedule

See the compute time you own on the pool.

```bash theme={null}
sf pools get dev
```

### Learn more

* [Instances and Pools](https://docs.sfcompute.com/preview/guides/instances-and-pools.md) explains the core model.
* [Auto-scaling](https://docs.sfcompute.com/preview/guides/auto-scaling.md) shows how to scale a fleet up and down while buying
  and selling time automatically.
* [Pools](https://docs.sfcompute.com/preview/pools.md), [orders](https://docs.sfcompute.com/preview/orders.md), and [instances](https://docs.sfcompute.com/preview/instances.md) are the
  resource references for the commands used here.
