---
name: si
description: Run code, services and coding agents on slashinfra SVMs (small cloud computers that sleep when idle) with the si CLI. Use it when a task needs a remote Linux machine, a clean environment, a public preview URL, a long job that outlives the session, or a disk snapshot to fork.
---

# si: slashinfra SVMs from a shell

An SVM is a Linux computer in the cloud. It keeps its disk, sleeps when idle and wakes on the next command.
`si` is the command line client. Install it once:

```sh
curl -fsSL https://slashinfra.com/install | sh
```

## Sign in without a browser

Use an API key from the dashboard (app.slashinfra.com, Keys). Never put the key on the command line.

```sh
printf '%s\n' "$SI_API_KEY" | si login --key-stdin   # saves it
si auth whoami                                      # checks it
```

`SI_API_KEY` in the environment also works for one command and wins over the saved key.

## Output and exit codes

When stdout is not a terminal, `si` prints JSON. Parse it; do not scrape text.
Commands that pass a program's output through (`exec`, `cp`, `job logs`, `shell`) print that output as it is.

An error is one JSON line on stderr: `{"error": "...", "code": "...", "hint": "run ..."}`. Run the `hint`.

| Exit  | Meaning                                    | Do                                           |
| ----- | ------------------------------------------ | -------------------------------------------- |
| 0     | Success                                    |                                              |
| 2     | Usage: bad arguments, or no SVM to choose  | Fix the command; name the SVM                |
| 3     | Key missing, expired or without permission | Ask the person for a key                     |
| 4     | Not found                                  | `si ls`                                      |
| 5     | Plan limit                                 | Delete something you made, or ask the person |
| 75    | Busy or connection lost                    | Wait a few seconds, run it again             |
| 124   | Timeout                                    | Use a background job                         |
| other | The exit code of the remote program        |                                              |

## Pick the SVM

Commands that take an SVM accept its id or name, and work without it when there is a default (`si use <svm>`) or the
project has exactly one SVM. `si rm` always needs a name or the default.

```sh
si ls                                  # id, name, state
si create --name build-1               # prints the id; add --default to make it the default
si use build-1
```

## Run things

```sh
si exec -- uname -a                    # a program and its arguments after --
si exec -c 'cd app && npm test'        # a shell command line
si exec --timeout 600 -- make          # seconds
si exec --env CI=1 -- ./run.sh
```

Long work goes in a background job; it keeps running when your session ends:

```sh
si job start -c 'npm run build'        # prints the job number
si job wait 3                          # exits with the code of job 3
si job logs 3                          # its output; -f follows
```

## Files

```sh
si cp -r ./src build-1:/home/user/src  # a tree needs -r; the SVM name, then :path
si cp build-1:/home/user/out.tar.gz .  # SVM to local
si cp ./notes.md :/home/user/          # empty name before : is the default SVM
```

## Ports and preview URLs

```sh
si port open 3000                      # members of the organization can reach it
si port open 3000 --public             # anyone can
si port url 3000                       # a link; --ttl 1h by default
si port forward 5432                   # to localhost on this computer
```

## Snapshots and forks

```sh
si snapshot create --name base         # of the default SVM's disk
si create --fork build-1               # a new SVM from another SVM's current disk
si create --snapshot base              # a new SVM from a snapshot
```

## Clean up

Delete what you created when the task is done, unless the person wants to keep it:

```sh
si rm build-1
```

More: https://slashinfra.com/docs/cli/svm
