---
title: CLI
slug: cli
createdAt: 2026-11-25T00:04:09.493Z
---

`octa` is the OctaSpace command-line tool. Use it to rent machines, manage sessions and manage the nodes you host from a terminal, a shell script, cron or CI.

Source and releases: [GitHub](https://github.com/octaspace/octa-cli).

## Install

Download the binary for your platform from the [release page](https://github.com/octaspace/octa-cli/releases), put it on your `PATH` and check it:

```bash
octa --version
```

To build from source (Go 1.25 or later):

```bash
git clone https://github.com/octaspace/octa-cli.git
cd octa-cli
make build
./octa --version
```

Shell completion:

```bash
octa completion bash > /etc/bash_completion.d/octa   # or zsh, fish, powershell
```

## Log in

Create an API key under **Account → Credentials → API Keys** in the [dashboard](https://console.octa.space) (see [Authentication](#)), then:

```bash
read -rs OCTA_TOKEN && octa auth "$OCTA_TOKEN"; unset OCTA_TOKEN
```

`octa auth` checks the key and saves it to `$XDG_CONFIG_HOME/octa/config.yaml` (`~/.config/octa/config.yaml` by default), readable only by you.

```bash
octa auth status    # config file, API host, masked key, whether it works
```

To use another API host, set `OCTA_API_URL` or `api_url` in the config file; the environment variable wins.

## Commands

Run `octa <command> --help` for every flag.

### Account

| Command        | Does             |
| -------------- | ---------------- |
| `octa account` | Show the balance |

### Compute

| Command                                                      | Does                                                                       |
| ------------------------------------------------------------ | -------------------------------------------------------------------------- |
| `octa compute`                                               | List machines for rent (works without a key, but is then refreshed hourly) |
| `octa compute search <query>`                                | Search by CPU or GPU model, country or city                                |
| `octa compute start --node <number> --image <image> [flags]` | Start a session; repeat `--node` for a batch                               |
| `octa compute start --from-file batch.json`                  | Start a batch of different requests                                        |
| `octa compute restart <uuid> [--replace flags]`              | Recreate the container                                                     |
| `octa compute logs <uuid> [--tail N]`                        | Platform events and container output                                       |
| `octa compute connect <uuid> [--proxy]`                      | Open SSH to the session                                                    |

Sessions accept a unique prefix of the UUID: `octa compute connect 96e3`.

Main `start` flags:

| Flag                       | Meaning                                                                   |
| -------------------------- | ------------------------------------------------------------------------- |
| `--node`                   | Node number from `octa compute`. Required                                 |
| `--image`                  | Container image. Required                                                 |
| `--disk`                   | Disk in GB (default 1)                                                    |
| `-e`, `--env`              | `KEY=VALUE`, repeatable                                                   |
| `--ports`                  | TCP/UDP ports to expose, comma-separated                                  |
| `--http-ports`             | HTTP ports to expose with a public URL                                    |
| `--entrypoint`, `--args`   | Replace the image's ENTRYPOINT and CMD                                    |
| `--startup-script`         | Script run as root once the container is up; `@file` reads it from a file |
| `--ssh`                    | SSH and a web terminal                                                    |
| `--fm`                     | Web file manager (no login: anyone with the URL can use it)               |
| `--app`                    | Application UUID                                                          |
| `--wait`, `--wait-timeout` | Wait until ready (default 15 minutes) and print how to connect            |

### Sessions

| Command                        | Does                       |
| ------------------------------ | -------------------------- |
| `octa sessions`                | List running sessions      |
| `octa sessions info <uuid>`    | Details of one session     |
| `octa sessions stop <uuid>...` | Stop one or more sessions  |
| `octa sessions stop --all`     | Stop every running session |

### Hosting

`hosting` has the alias `nodes`.

| Command                                                                                | Does                                      |
| -------------------------------------------------------------------------------------- | ----------------------------------------- |
| `octa hosting list`                                                                    | Your online nodes with status and prices  |
| `octa hosting show <number>`                                                           | One node                                  |
| `octa hosting prices <number> [--base $] [--storage $] [--traffic $] [--min-rent min]` | Change prices, in USD                     |
| `octa hosting maintenance <number> on\|off`                                            | Take the node off rent, or offer it again |

## Scripting

### JSON output

Every command has a table form (default) and a JSON form:

```bash
octa sessions -o json
octa compute -o json
octa sessions info <uuid> -o json
octa hosting list -o json
```

These commands print the API response as is, with every field. Amounts in JSON are integer micro-USD and times are Unix milliseconds, as in the API. Commands that change something print a small confirmation, for example `{"status": "ok", "uuid": "..."}`; with `--wait`, `compute start` prints the ready session.

Scripts should ignore fields they do not use: the API adds new fields over time.

### Examples

Cheapest machine with an RTX 4090:

```bash
octa compute -o json \
  | jq -r '[.[] | select(any(.gpus[]?; .model | test("4090")))] | sort_by(.base_price) | .[0].node_number'
```

Start, wait, and take the UUID:

```bash
UUID=$(octa compute start --node "$NODE" --image ubuntu:24.04 --ssh --wait -o json | jq -r .uuid)
```

Stop every session older than 12 hours:

```bash
octa sessions -o json \
  | jq -r '.[] | select(.duration > 12*3600) | .uuid' \
  | xargs -r octa sessions stop
```

### Exit codes and errors

A command exits with `0` on success and non-zero on any error, so `set -e` works. A batch start exits with an error if any request failed. Errors show the API's message, for example `Insufficient balance`; on a rate limit, how long to wait.

`Ctrl-C` (or `SIGTERM`) cancels requests in flight and `--wait`. Starts and restarts are never retried automatically, so a script cannot start a session twice by accident.

### In CI

Store the key as a secret and pass it through the config file or `octa auth` in a step:

```yaml
# GitHub Actions
- name: Log in to OctaSpace
  run: octa auth "${{ secrets.OCTA_API_KEY }}"
- name: Run a job
  run: ./scripts/run-on-octaspace.sh
```

Use a separate API key for CI, so you can delete it without affecting anything else.

## Not in the CLI

VPN sessions, compute apps listing and network statistics are not available in the CLI; use the [JavaScript SDK](#) or the [API](https://04-api-reference.md).
