# Account Source: https://docs.machine0.io/cli/account CLI reference for authentication, billing, and configuration. ## login Log in via browser OAuth. Session token stored at `~/.machine0/auth-token`. ```bash theme={"theme":"css-variables"} machine0 login ``` *** ## logout Log out and revoke the session token. ```bash theme={"theme":"css-variables"} machine0 logout ``` `MACHINE0_API_TOKEN` env var is unaffected by logout. Unset it separately. *** ## account Show account details and wallet balance. ```bash theme={"theme":"css-variables"} machine0 account ``` *** ## topup Add funds via Stripe. Minimum \$5. ```bash theme={"theme":"css-variables"} machine0 topup --amount 10 ``` *** ## config get ```bash theme={"theme":"css-variables"} machine0 config get ``` Each value is labeled with its source: `(env)` = environment variable, `**` = project `machine0.env`, `*` = home config (`~/.machine0/machine0.env`). Unmarked values are built-in defaults. *** ## config set ```bash theme={"theme":"css-variables"} machine0 config set KEY=VALUE [KEY=VALUE ...] ``` Writes to `~/.machine0/machine0.env`. Warns per key when the saved value is currently shadowed by an environment variable or a project `machine0.env`. See [Configuration](/platform/configuration) for all settings. *** ## use openclaw Create an OpenClaw VM and SSH in. Auto-generates a name with `openclaw-` prefix. ```bash theme={"theme":"css-variables"} machine0 use openclaw ``` # Disks Source: https://docs.machine0.io/cli/disks CLI reference for creating, inspecting, listing, and removing persistent disks. Disks are persistent block storage volumes tied to a region. A disk can be attached to one VM at a time — either at VM creation (`new --attach`) or onto an already-running VM (`disks attach`) — and its data survives suspend/resume and VM destruction — the disk keeps living (and billing) until you remove it. Disks are billed per GB-hour while they are `READY` (\~\$0.1667/GB/month). Disks are durable but **not backed up** — removing a disk (or deleting files on it) is permanent. Once mounted, the disk is owned by the VM's normal login user (not `root`), so it's writable without `sudo` out of the box. ## disks new Create a disk. The command returns immediately with the disk in a `CREATING` state; it becomes `READY` on its own, usually within seconds (check with `disks ls`). ```bash theme={"theme":"css-variables"} machine0 disks new --size [--region ] ``` | Flag | Description | Default | | ----------------------- | -------------------------- | ------------------- | | `-s, --size ` | Disk size in GB (10–16384) | required | | `-r, --region ` | Region the disk lives in | your default region | ```bash theme={"theme":"css-variables"} $ machine0 disks new data --size 50 --region eu ✓ Disk "data" is being created (50 GB, eu) Check status: machine0 disks ls Once READY, attach it to a new VM: machine0 new --attach disk:data path:/data ``` Disk names use lowercase letters, numbers, and hyphens (max 31 characters). Each account can have up to 10 disks. A disk can only be attached to VMs in its own region. *** ## disks ls List your disks. ```bash theme={"theme":"css-variables"} machine0 disks ls ``` | Flag | Description | Default | | -------- | ----------- | ------- | | `--json` | Output JSON | off | ```bash theme={"theme":"css-variables"} $ machine0 disks ls ┌──────────────────────────────────────────────────┐ │ Name Status Size Region Attached To │ │ data READY 50 GB eu dev1 │ └──────────────────────────────────────────────────┘ ``` `Attached To` names the VM the disk is currently attached to, with `(attaching...)` or `(detaching...)` while an `attach`/`detach` is still in flight. A disk in `ERRORED` state failed to provision — run `disks get ` for the error, then `disks rm ` to clean it up and create it again. *** ## disks get Show a disk's details — status, size, region, cost, and which VM it's attached to. ```bash theme={"theme":"css-variables"} machine0 disks get ``` | Flag | Description | Default | | -------- | ----------- | ------- | | `--json` | Output JSON | off | ```bash theme={"theme":"css-variables"} $ machine0 disks get data DISKS > data Name data Status READY Attached To dev1:/data Size 50 GB Region eu $/month $8.43 Total Cost $6.05 Created At 07/11/2026 @ 18:10 (21d 20h 3m ago) ``` For `ERRORED` disks the provider error is shown (for example, a volume quota being exhausted) so you know whether recreating will help. *** ## disks rm Remove a disk and **all of its data**, permanently. Refused while any VM (including a suspended one) is still attached to the disk — destroy the VM first. ```bash theme={"theme":"css-variables"} machine0 disks rm ``` | Flag | Description | Default | | ----------- | ---------------------------- | ------- | | `-y, --yes` | Skip the confirmation prompt | off | ```bash theme={"theme":"css-variables"} $ machine0 disks rm data -y ✓ Disk "data" destroyed ``` The command returns immediately — the disk disappears from `disks ls` at once and its name is instantly reusable, while the volume is deleted in the background. `disks rm` also works on `CREATING` disks (cancels provisioning) and `ERRORED` disks (cleanup). *** ## disks attach Attach a `READY` disk to an already-running VM. ```bash theme={"theme":"css-variables"} machine0 disks attach --path ``` | Flag | Description | Default | | ------------------- | ----------------------------------- | -------- | | `-p, --path ` | Absolute path to attach the disk at | required | ```bash theme={"theme":"css-variables"} $ machine0 disks attach data dev1 --path /data ✓ Disk "data" is being attached to "dev1" at /data Check status: machine0 disks get data ``` The command returns immediately with the attachment in an `attaching...` state; `disks get`/`disks ls` show `ATTACHED` once the disk is actually mounted inside the VM. The disk must be `READY`, in the same region as the VM, and not attached to another VM; the VM must be `RUNNING` and have a managed SSH key (the same requirement as `machine0 ssh`) — a VM created with your own public key can't be attached to post-hoc. Up to 5 disks can be attached per VM, and mount paths can't be nested inside one another. Not yet supported on GPU sizes or NixOS VMs. Disks attached with `disks attach` persist across reboots and suspend/resume, same as disks attached at VM creation. *** ## disks detach Detach a disk from the VM it's attached to. ```bash theme={"theme":"css-variables"} machine0 disks detach ``` ```bash theme={"theme":"css-variables"} $ machine0 disks detach data ✓ Disk "data" is being detached Check status: machine0 disks get data ``` The command returns immediately with the attachment in a `detaching...` state; the disk disappears from the VM (unmounted and disconnected) once the job finishes. If the VM has an open file handle on the mount path, the detach retries rather than forcing it; if it still can't unmount after a few minutes, the attachment returns to `attached` — stop whatever is using the mount path and run `disks detach` again. Like `disks attach`, detaching needs the VM `RUNNING` with a managed SSH key (the same requirement as `machine0 ssh`) — the command fails immediately with the reason otherwise. A disk attached to a VM created with your own public key can't be detached at all (the server can't SSH in to unmount safely); destroying the VM releases the disk. A disk still `attaching...` can't be detached yet — wait for the attach to finish (or fail) first, then retry. *** ## Attaching disks: `new --attach` Attach disks when creating a VM with the repeatable `--attach` flag on [`machine0 new`](/cli/machines#new). Each use takes two values: the disk and the absolute path to attach it at. ```bash theme={"theme":"css-variables"} machine0 new --attach disk: path: ``` ```bash theme={"theme":"css-variables"} # one disk machine0 new dev1 --attach disk:data path:/data # several disks machine0 new dev1 \ --attach disk:data path:/data \ --attach disk:code path:/code ``` Mount paths must be absolute (letters, numbers, `/`, `_`, `-`), cannot be inside system directories (`/etc`, `/usr`, `/var`, ...), and cannot be nested inside one another (e.g. `/data` and `/data/code`) — this applies across all disks attached to the VM. The disk must be `READY`, in the same region as the VM, and not attached to another VM. Up to 5 disks can be attached per VM. Attachments survive reboots and suspend/resume — on resume the disk is re-attached with its data intact. Disks are not yet supported on GPU sizes or NixOS VMs. Creation-time attachments work on any eligible VM (they don't need SSH), including one created with your own public key (`-k`) — but note that such a disk can't be detached later ([`disks detach`](#disks-detach) needs server SSH access); destroying the VM is what releases it. To attach a disk to a VM that's already running (instead of at creation time), use [`disks attach`](#disks-attach) / [`disks detach`](#disks-detach). # Profile variables Source: https://docs.machine0.io/cli/env CLI reference for env — env variables stored on a profile and injected into every VM created with it, with optional write-only secrets. The `env` commands manage the env variables stored on a [profile](/cli/profiles). They are stored encrypted and injected into every VM created with `machine0 new --profile ` — written to `/etc/environment` (services and non-login shells) and `/etc/profile.d/machine0-env.sh` (interactive sessions). Commands target the [current profile](/cli/profiles#profiles-use); pass `-p/--profile` to target another one. The whole group is also available as `machine0 vars` (its pre-1.0.146 name), kept for backward compatibility. *** ## env ls List a profile's variables. Secret values render masked. ```bash theme={"theme":"css-variables"} machine0 env ls machine0 env ls -p work --json ``` *** ## env set Set env variables in a profile (`KEY=VALUE`, space-separated, values may contain `=`). Aliased as `env add`. ```bash theme={"theme":"css-variables"} machine0 env set KEY=VALUE [KEY=VALUE ...] [--secret] [-p ] machine0 env set NODE_ENV=production API_URL=https://api.example.com machine0 env set OPENAI_API_KEY=sk-... --secret -p work ``` **Secret variables** — pass `--secret` to mark every key in that invocation as secret. Secret **values** are write-only: `env ls` and `profiles get` (including `--json`) show them as `******** (secret)` and no API read ever returns them again — they stay readable only inside a VM (e.g. in `/etc/environment`). Key names and their existence remain visible, as for any variable. Details: * Re-setting a key **without** `--secret` un-marks it (the new value displays in cleartext); re-setting with `--secret` keeps it masked. * Masked `env ls --json` output is **not round-trippable**: piping it back into `env set` is rejected (it would overwrite the real value with the placeholder). The literal `********` can never be stored as a variable value. * Variables set before this feature existed aren't retroactively masked — re-set them with `--secret` to mark them. A variable named `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` competes with a connected [`claude-code` or `codex` integration](/cli/integrations#integrations-connect) on the same profile: the VM ends up holding both credentials, and which one the agent uses depends on the provider's own precedence rules. Pick one mechanism per provider. `MACHINE0_API_KEY` and `MACHINE0_MCP_URL` are [auto-populated on profiled VMs](/platform/profiles#environment-variables) with the profile's MCP gateway endpoint and a matching API key. Setting **either** name yourself disables injection of **both** (the two only make sense as a pair), and your values are used instead. **When changes apply** — variables are written when a VM boots (at creation and on resume from suspend) and whenever the profile is re-applied to a running VM with [`profiles deploy`](/cli/profiles#profiles-deploy). Outside those events, a running VM does not pick up `env set`/`unset` changes. Profiles hold up to 100 variables (64KB serialized); keys are `[A-Za-z_][A-Za-z0-9_]*`, values up to 4096 characters of printable ASCII: no newlines, tabs, double quotes, or non-ASCII characters such as em dashes and emoji (non-ASCII breaks VM provisioning). *** ## env unset Remove env variables from a profile by key. Aliased as `env rm`. A key that isn't set in the target profile is an error and nothing is removed — this catches typos (and a profile name passed as a key) before a deletion lands on the wrong target. Removal asks for confirmation naming the profile — secret values are write-only, so a removed secret can't be recovered; pass `--yes` to skip the prompt (required in scripts). ```bash theme={"theme":"css-variables"} machine0 env unset KEY [KEY ...] [-p ] machine0 env unset API_URL machine0 env rm API_URL -p work --yes # skip the confirmation prompt ``` # Images Source: https://docs.machine0.io/cli/images CLI reference for managing images and snapshots. ## images ls ```bash theme={"theme":"css-variables"} machine0 images ls machine0 images ls --json ``` | Flag | Description | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `-a, --all` | Also show the GPU-only system images (`gpu-*-base`, `nixos-25-11-nvidia`), which only work with GPU sizes. Your own snapshots — including GPU snapshots — are always listed. `--json` output always includes everything. | *** ## images get ```bash theme={"theme":"css-variables"} machine0 images get ``` *** ## images new Snapshot a VM into a reusable image. The VM is stopped automatically before snapshotting. ```bash theme={"theme":"css-variables"} machine0 images new [flags] ``` | Flag | Description | | ------------------- | ----------------------------- | | `-d, --description` | Image description | | `-m, --metadata` | JSON metadata for the version | ### Building from a git repo With `--git-repo`, `images new` builds a NixOS image server-side from a public GitHub repo's nix flake instead of snapshotting a VM. The branch is resolved to its latest commit at submit time and the commit is recorded on the image version. ```bash theme={"theme":"css-variables"} machine0 images new --git-repo https://github.com// --nix-profile [flags] ``` | Flag | Description | | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--git-repo` | Public GitHub repository URL (`https://github.com//`) | | `--git-branch` | Branch to build (default: `main`) | | `--nix-profile` | Flake profile to apply — a `nixosConfigurations` attribute, e.g. `base` or `loaded` | | `--size` | Builder VM size (default: `large`). The builder's disk size becomes the image's minimum VM size — bigger builders build faster but produce images that only boot on equally big VMs | | `--region` | Builder VM region | | `--no-wait` | Return immediately instead of waiting for the build | | `-d, --description` | Image description | | `-m, --metadata` | JSON metadata for the version | How it works: a temporary builder VM named `m0-build-*` boots from the NixOS base image, applies `nixos-rebuild switch --flake github://#`, is snapshotted, and destroyed. The builder is visible in `machine0 ls` and bills like a normal machine for the duration of the build (typically 10–40 minutes). A brand-new image name is published immediately on success; building onto an existing image creates a draft version to test and promote, same as a snapshot save. If the build fails, the error (including the tail of the `nixos-rebuild` log) is recorded on the image version — see it with `machine0 images versions get ` — and re-running the same command retries against the branch's latest commit. Limitations (v1): public GitHub.com repositories only; no git submodules or LFS (the flake is fetched as a tarball); the profile must import the machine0-nixos base modules (keep the `nix` user and SSH enabled), or the build fails verification. *** ## images update ```bash theme={"theme":"css-variables"} machine0 images update [flags] ``` | Flag | Description | | ------------------- | ------------------------------------------------------------------------------------ | | `-n, --name` | New name | | `-d, --description` | New description | | `-r, --region` | Comma-separated regions to add (additive — regions can't be removed from a snapshot) | *** ## images rm ```bash theme={"theme":"css-variables"} machine0 images rm [image] [flags] ``` | Flag | Description | | ----------- | ----------------- | | `-a, --all` | Delete all images | | `-y, --yes` | Skip confirmation | Deleting the auto-saved snapshot of a [suspended](/platform/vm-management) machine (named `suspended---