# Nistro AI CLI

Create and manage Nistro AI Inference and Nistro AI Postgres deployments from your terminal, scripts and CI with the `nistro` CLI. Install it with one command, sign in, and everything you do in the console is a command away. Its source and releases are on [GitHub](https://github.com/nistroai/ctl).

## Install

Install the latest release on macOS, Linux or Windows (Git Bash):

```bash
curl -fsSL https://raw.githubusercontent.com/nistroai/ctl/main/install.sh | sh
```

The installer downloads the build for your system, verifies its checksum and puts `nistro` in `~/.nistro/bin`. On macOS and Linux it also adds that folder to your `PATH` in your shell profile, so open a new terminal before you run `nistro`. On Windows, add the folder to your `PATH` yourself.

To install a specific release, pass its version:

```bash
curl -fsSL https://raw.githubusercontent.com/nistroai/ctl/main/install.sh \
  | sh -s -- --version <version>
```

Releases are listed on [GitHub](https://github.com/nistroai/ctl/releases).

Run the installer again to update. `nistro --version` shows the installed version.

## Sign in

```bash
nistro login
```

`nistro login` asks for your email and password and saves your session privately in `~/.nistro/sessions.json`. When your session expires, run `nistro login` again. `nistro logout` clears the saved session.

Signed up with Google or GitHub? Set a password first with [Forgot password](https://nistro.ai/forgot-password).

In scripts and CI, pipe the password in instead of typing it:

```bash
printf '%s' "$NISTRO_PASSWORD" | nistro login --email "$NISTRO_EMAIL" --password-stdin
```

`nistro login` also reads `NISTRO_EMAIL` and `NISTRO_PASSWORD` from the environment.

The CLI manages the deployments in your own team.

## Commands

`nistro inference` and `nistro postgres` share these commands:

| Command | What it does |
| --- | --- |
| `list` | Lists your deployments. |
| `describe <id>` | Shows a deployment's details. |
| `create on-demand`, `create scale` | Creates a deployment on that plan. |
| `update <plan> <id>` | Changes a deployment. The sections below show what you can change. |
| `delete <id>` | Deletes a deployment right away. Deleting can't be undone. |

Inference adds `recommend-hardware`, and Postgres adds `offers` and `placements`, to check your options before you create. Add `--help` to any command for its options, for example `nistro postgres create scale --help`.

### Output

Commands print tables, with passwords and API keys hidden. Add `-o json` for the full response, credentials included:

```bash
nistro postgres describe <id> -o json
```

### Configuration files

`create`, `update`, `offers` and `recommend-hardware` take their settings as flags or from a JSON file passed with `--config-file`. JSON keys use underscores where flags use hyphens (`storage_gib` for `--storage-gib`), and flags override the file. `--config-file -` reads the JSON from stdin:

```bash
echo '{"vcpu": 2, "storage_gib": 50, "location": "ANY"}' \
  | nistro postgres create on-demand --config-file -
```

## Inference On-Demand

```bash
nistro inference create on-demand --model-url google/gemma-4-26B-A4B \
  --max-model-len 32768 --location ANY
```

- `--model-url`: a Hugging Face model id or huggingface.co URL.
- `--max-model-len`: the context length in tokens, up to the model's maximum.
- `--location`: `US`, `EU`, `ASIA` or `ANY`.
- Optional: `--quantization`. The default, Auto, uses what the repository provides.

Based on your model, context length and location, Nistro AI finds the most cost-effective GPU that meets your requirements. When the deployment is ready, `nistro inference describe <id> -o json` shows its endpoint and API key; see [Call the API](https://nistro.ai/docs/inference#call-the-api) to send requests.

## Inference Scale

Find the machines that can run the model in a location, then create on one of them:

```bash
nistro inference recommend-hardware scale --model-url google/gemma-4-26B-A4B \
  --max-model-len 32768 --location US
nistro inference create scale --model-url google/gemma-4-26B-A4B \
  --max-model-len 32768 --cloud <cloud> --region <region> \
  --instance-type <instance-type> --replicas 1
```

- `--location`: `US`, `EU` or `ASIA`.
- `--cloud`, `--region` and `--instance-type`: a row from `recommend-hardware scale`.

`recommend-hardware scale` lists the machines in that location that fit the model, with each one's cloud, region, GPU and instance type. `create scale` sets the number of replicas with `--replicas` (required), and takes an optional `--quantization` and `--gpu-type` (keep the default, Any, or name a specific GPU).

Change the number of replicas later with:

```bash
nistro inference update scale <id> --replicas 2
```

## Postgres On-Demand

```bash
nistro postgres create on-demand --vcpu 2 --storage-gib 50 --location ANY
```

- `--vcpu`: 1 to 8. Memory follows at 4 GiB per vCPU.
- `--storage-gib`: 10 to 1024.
- `--location`: `US`, `EU`, `ASIA` or `ANY`.
- Optional: `--database-name` and `--database-username`, both `app` by default, and `--database-password`, generated if you leave it out.

`nistro postgres offers on-demand` takes the same capacity and location and shows the matching offers before you create. To scale, pass a new vCPU count or a larger storage size:

```bash
nistro postgres update on-demand <id> --vcpu 4 --storage-gib 100
```

## Postgres Scale

List the clouds, regions and instance types you can use, then create on one of them:

```bash
nistro postgres placements scale
nistro postgres create scale --cloud <cloud> --region <region> \
  --instance-type <instance-type> --storage-gib 100
```

- `--cloud`, `--region` and `--instance-type`: a row from `placements scale`. The instance type sets the CPU and memory.
- `--storage-gib`: 10 to 4096.
- `--replicas`: standby replicas, 0 to 8. The default is 1.
- Optional: the database flags above, `--extensions` as a comma-separated list such as `vector,pg_trgm`, and `--parameters name=value`, once per parameter. See [Extensions](https://nistro.ai/docs/postgres#extensions) and [Parameters](https://nistro.ai/docs/postgres#parameters) for the allowed names.

`nistro postgres offers scale` takes the same placement and storage and shows the matching offers before you create.

After you create a deployment, you can grow its storage, change the number of standbys and set parameters:

```bash
nistro postgres update scale <id> --replicas 2
nistro postgres update scale <id> --parameters work_mem=32MB
```

`--parameters` replaces the deployment's whole parameter set, so pass every parameter you want to keep.
