# The command line (onprem-ai-ctl)

> Every command of onprem-ai-ctl, the control plane's command line: the commands on the control plane's machine (install, update, start, stop, status, doctor, apply, recovery), the commands from any machine (login, api), and the tool's own error reports and version.

`onprem-ai-ctl` is the control plane's command line. It is installed and updated with the control plane, at `/usr/local/bin/onprem-ai-ctl`. It has three groups of commands, by where they run.

`onprem-ai-ctl --help` shows the commands, and `onprem-ai-ctl COMMAND --help` explains one.

## On the control plane's machine, as root

These commands work on the control plane installed on this machine. They work also when the control plane does not run and its pages cannot be reached.

| Command | What it does |
|---|---|
| `sudo onprem-ai-ctl status` | The installed release, whether it is kept running or stopped, every service's state, and the automatic repairs of the last 24 hours. `--json` for scripts |
| `sudo onprem-ai-ctl start` | Starts the installed release and keeps it running, also after a reboot. Downloads nothing |
| `sudo onprem-ai-ctl stop` | Stops it and keeps it stopped, also after a reboot, until `start`. Removes nothing |
| `sudo onprem-ai-ctl restart` | `stop`, then `start` |
| `sudo onprem-ai-ctl doctor` | Checks the control plane here and names the next step for each finding: the release, the container engine, the secrets, whether it is kept running, and every service |
| `sudo onprem-ai-ctl install` | Installs or repairs the control plane, keeping the data |
| `sudo onprem-ai-ctl update` | Updates it, as the Updates page does, when the page cannot be reached |
| `sudo onprem-ai-ctl update --dry-run` | Says which release the next update would take and changes nothing (`--json` for a program) |
| `sudo onprem-ai-ctl uninstall` | Removes it, keeping the data (below) |
| `sudo onprem-ai-ctl uninstall --remove-data` | Removes it with all of its data. It cannot be undone (see [Installing and updating the control plane](/en/platform/docs/v5.10/guides/installation/control-plane-installation/index.md), Removing the control plane) |
| `sudo onprem-ai-ctl apply` | Applies the config file `/etc/onprem-ai/control-plane/config.env` after you changed it. `--dry-run` shows what would change and changes nothing |
| `sudo onprem-ai-ctl join-token` | A join token for an inference node on this same machine |
| `sudo onprem-ai-ctl recovery sign-in-link --username NAME` | A recovery link for a lost password or when nobody can sign in: it sets a new password, or signs in once (see **Single sign-on**, Getting back in) |
| `sudo onprem-ai-ctl recovery show-sign-in` | Shows the sign-in settings in effect, where each one comes from, and the administrators (see [Single sign-on](/en/platform/docs/v5.10/guides/authentication/single-sign-on/index.md)) |
| `sudo onprem-ai-ctl api-key create --bypass-sign-in (--username NAME \| --create-administrator NAME) --name KEY_NAME` | Makes a control plane API key without signing in, for a deployment that is provisioned with nobody at the browser (see [Secrets](/en/platform/docs/v5.10/guides/machine-administration/secrets/index.md)) |

The pages of the control plane update it too (the **Updates** page). Use the commands when the pages cannot be reached, or to install.

## From any machine, as you

These commands act on a control plane through the address you open its pages at, with a control plane API key. Copy the program from the control plane's machine to the machine you want to run it on.

| Command | What it does |
|---|---|
| `onprem-ai-ctl login ADDRESS` | Asks for a control plane API key one time, checks it, and stores the address and the key in `~/.config/onprem-ai/control-plane.json`, readable only by you. `--control-plane-ca-file PATH` names the control plane's root CA |
| `onprem-ai-ctl logout` | Removes the stored sign-in. The key keeps working until you revoke it under **Settings → MCP access** |
| `onprem-ai-ctl api METHOD PATH` | Sends any route of the control plane's HTTP API with the stored sign-in and prints the answer. `--data JSON`, `--data @FILE` or `--data -` gives the request body |

```bash
onprem-ai-ctl login 10.0.4.10:3443
onprem-ai-ctl api GET /api/v1/inference-nodes/list
onprem-ai-ctl api POST /api/v1/inference-services/undeploy --data '{"inference_service_id": "..."}'
```

`api` is one command for every operation: everything the pages do is possible from a shell, within the key's scopes. [API Reference](/en/platform/docs/v5.10/reference/control-plane-operations/index.md) lists the operations and their paths. How to create a key, and the other two ways in (the HTTP API and the MCP endpoint): [Automation via APIs and CLI](/en/platform/docs/v5.10/guides/automation/apis-and-cli/index.md).

On an inference node, `ADDRESS` defaults to the control plane that the node is connected to. That machine's network may allow only the inference port; then run these commands from the machine you open the pages on.

## About the program itself

| Command | What it does |
|---|---|
| `onprem-ai-ctl version` | The release version. `--build` also shows the exact build |
| `onprem-ai-ctl error-reports list` | The error reports this program wrote about its own failures. They are not the control plane's error reports |
| `onprem-ai-ctl error-reports export ERROR_REPORT_ID [DESTINATION]` | Writes one of them into a file for support |

When `onprem-ai-ctl` fails because of a defect in it, it writes an error report: the error and its stack trace, with keys, passwords and signed addresses removed. The error line names the report's id. When you are signed in, the report is also sent to that control plane and listed there under **Error reports**.

## Exit codes

`0`: done. `1`: the command failed, and the output says why. `2`: the command line was not understood.
