# Use the CLI

## Install from PyPI

Python 3.10 or later is required. The public package is
[`nestor-cloud`](https://pypi.org/project/nestor-cloud/). Install it in a virtual
environment:

```sh
python3 -m venv .venv
. .venv/bin/activate
python -m pip install nestor-cloud
nestor --version
nestor --help
python -c "from nestor import Nestor; print('Nestor import OK')"
```

On Windows, activate with `.venv\Scripts\Activate.ps1` in PowerShell instead.
The package installs both the `nestor` command and the `nestor` Python module;
it has no third-party runtime dependencies.

For dedicated Compute Instances, use version **0.1.3 or later**:

```sh
python -m pip install --upgrade "nestor-cloud>=0.1.3"
nestor --version
nestor compute --help
```

The [Compute guide](/compute) covers machine selection, billing, SSH and cleanup.

## Verify a historical release

Version 0.1.0 predates the Compute SDK and CLI. To reproduce that historical
release, install `nestor-cloud==0.1.0`. Its wheel is
`nestor_cloud-0.1.0-py3-none-any.whl`, from source
`b3c990d5fd9e9dceea2f464000335ca292b1f0c9`, with SHA-256
`36528f223847937b81169c869855763500df50af333bf3b4a19e8f2ce11de118`.
PyPI's file details include its checksum and publication provenance. Download and
verify the exact wheel when retaining an installation artifact:

```sh
python -m pip --isolated download --index-url https://pypi.org/simple --no-deps --only-binary=:all: nestor-cloud==0.1.0
python - <<'PYTHON'
import hashlib
from pathlib import Path
wheel = Path("nestor_cloud-0.1.0-py3-none-any.whl")
expected = "36528f223847937b81169c869855763500df50af333bf3b4a19e8f2ce11de118"
assert hashlib.sha256(wheel.read_bytes()).hexdigest() == expected, "Checksum mismatch"
print("Checksum verified")
PYTHON
```

## Configure management access

Copy your organization and project IDs from Console Settings. In Console Access,
an administrator creates a Service account with the role your work needs, then
issues its management API key. Save the full one-time secret securely. A displayed
key ID or prefix is public metadata and cannot authenticate requests.

```sh
export NESTOR_API_URL=https://api.nestor.software
export NESTOR_ORGANIZATION=YOUR_ORGANIZATION_ID
export NESTOR_PROJECT=YOUR_PROJECT_ID
# Bash or zsh: paste the full management key, then press Return.
read -r -s NESTOR_API_KEY
export NESTOR_API_KEY
nestor inference endpoints list
nestor data list
```

For PowerShell, assign the same variables using `$env:NAME = "value"`; read the
key with `$env:NESTOR_API_KEY = Read-Host -MaskInput` (PowerShell 7.1+).
In a backend, inject these variables through your secret manager.
`NESTOR_API_KEY` takes precedence over saved credentials. `nestor auth login`
stores an existing bearer; it does not open a browser or issue a management key.
Set the API origin explicitly because the SDK default is for local development.

`nestor projects list` discovers projects only when your role permits that
organization-level read. A project-scoped Service account may receive exit 4 / 403;
keep the scope IDs from Console Settings and continue with resource listing.
Missing, invalid, expired or revoked credentials return exit 3. Obtain a replacement
through Console Access; do not substitute a public key ID or broaden the role.

## Resource commands

```sh
nestor inference endpoints create --model Qwen/Qwen2.5-0.5B-Instruct --name chat --wait
nestor inference endpoints list --json
nestor inference endpoints get ENDPOINT_ID --json
nestor inference endpoints delete ENDPOINT_ID --wait
nestor data list --json
nestor data files DATA_ID --json
```

Use returned IDs. `--wait` follows actual readiness or completion and can fail;
a create accepted by the API is not automatically READY. Resource commands retain
public Operations and enforce scope, permissions, quotas and concurrency.

Use [Training and Run](/training/runs) for finite source programs. Your supplied
examples also show pinned HTTP/Comfy containers and Data uploads; image and Secret
references are provided through the project setup, not a registry login step.

For an existing run with committed checkpoints:

```sh
nestor runs checkpoints RUN_ID --json
nestor runs download RUN_ID FILE_ID ./checkpoint-4.pt
```

Use a returned file ID; download verifies size and SHA-256. These commands
read active or completed runs without submitting work. Older supplied wheels
use `nestor training runs checkpoints` for the same files. Reading a file does
not resume execution; [explicit continuation](/guides/fine-tune) creates a new run.

## Reliable scripts

Use `--json` for machine-readable output, check the exit status, and retain IDs and
idempotency keys before any retry. Reuse the same key only for an unchanged logical
request. A stale etag is a conflict to reconcile, not a reason to overwrite the
resource. Pagination is bounded and not a snapshot of a concurrently changing list.

Management keys cannot invoke Endpoints. A signed-in human creates a separate
Endpoint-bound invocation key in Console Access. Revoke disposable keys after use.
Normal resource cleanup and Data retention remain necessary even after a key is revoked.
