CLI Reference
Every remote command, its flags, and what it does
The CLI is remote. rh is a shorter alias for the same binary; both keep working. This
reference is for CLI 1.0.0 or newer: check yours with remote --version, and upgrade with
remote update.
Anywhere a command takes <host>, you can give a sandbox's name or its id — and an id may be
abbreviated to its first four or more characters, the way git takes a short commit. A value that
matches more than one sandbox is refused rather than guessed, so nothing is ever deleted or
attached to by accident.
Shared flags
Commands that create a sandbox — remote new, remote claude,
and remote codex — all take these:
| Flag | Description |
|---|---|
-o, --org <org> | Org id or name |
-p, --project <project> | Project id or name |
-n, --name <name> | Sandbox name. Must be unique within the org; a repeat is refused rather than silently duplicated |
-m, --machine-size <size> | small, default, large, or xlarge — overrides the profile's initial machine tier |
--region <region> | A region id, from the region list below |
--template <template> | Custom template to boot from, by name or id |
--environment-template <template> | Environment template to boot from, by name or id: its egress policy, environment variables and setup script, re-applied on every wake. --environment, its old name, still works for now and prints a deprecation warning |
--vmm <vmm> | qemu or firecracker: the VMM the sandbox runs on. Left out, its template's, else its environment template's, else the org's default, which is qemu on RemoteHost's hosted service. Not shown in --help. A deployment where VMM choice is off refuses it with 400 |
--profile <profile> | auto, agent-small, agent-standard, build-heavy, browser-heavy, repo-large, long-running, or workstation (Pro and above) |
--mode <mode> | persistent (default) or ephemeral — ephemeral is for external-use projects only |
--persistence <policy> | throwaway_ephemeral, resumable_ephemeral, sleep_resume, or always_on |
--ttl <minutes> | Auto-stop after this many minutes (default 60, at most 525600, a year; more is refused). Re-armed by terminal activity on persistent sandboxes, hard on ephemeral ones; --persistence always_on disables it |
--json | Print the created sandbox as JSON — see JSON output |
Regions
--region takes one of the regions sandboxes run in today:
eu-central: Limburg, Germanyeu-west: Gravelines, Franceus-east: Vint Hill, United Statesca-central: Beauharnois, Canada
JSON output
Every command that reports data takes --json: ls, new, claude, codex, sleep, wake,
extend, resize, rm, metrics, latency, and the keys, workspaces, environments and environment-templates commands. Interactive commands
(attach, ssh, the TUI) do not, and reject the flag rather than ignoring it.
The contract is worth relying on:
- stdout carries exactly one JSON document, or nothing at all. A list is an array —
[]when empty, never a sentence. A single subject is an object. - stderr carries every diagnostic, including one
{"error": {...}}document when a command fails. That document keeps the API's owncode(rate_limited,limit_reached,not_authenticated) and whatever it sent beside it, such asretryAfterSeconds. - exit code is
0on success and1on failure, so a caller knows which stream to parse before parsing it.
remote ls --json | jq -r '.[] | select(.status == "running") | .name'
remote metrics web --json | jq '.pressure.memory'Without the flag, output is a table on a terminal and the same fields tab-separated when piped.
Both are stable; --json exists because the tab line is meant to be read, not parsed — its values
carry units (4 vCPU/8 GB/80 GB disk) and some fields contain spaces.
--json never opens a browser. If there is no stored session and no REMOTEHOST_TOKEN, it fails
with not_authenticated instead of starting an interactive login.
remote
Run with no arguments to open the interactive TUI: orgs, projects, sandboxes, activity, and subscription info, with actions to create an org, project, or sandbox without leaving the terminal. Prompts you to log in first if you haven't already.
remote login
Starts the OAuth device flow: prints a short code and a URL, opens that URL in your browser if it can, and waits for you to approve the sign-in. Approving it in any browser on any device works — an SSH session on a machine with no browser signs in exactly like a laptop does.
Access tokens last an hour and refresh transparently, so signing in is a one-time step per machine. The session lasts 90 days from its last use: a machine that goes unused for 90 days signs in again.
remote logout
Signs this machine's session out on the server, then clears the stored tokens. A copy of the session
file stops working too. If the server cannot be reached, the local tokens are still cleared, and the
session can be ended later with remote sessions revoke from another machine.
remote sessions
remote sessions list
remote sessions revoke <session-id>
remote sessions revoke --othersLists the machines signed in as you (CLI and desktop), marking the one you are on, and signs them
out. --others signs out every session except this one: use it after a lost or shared laptop,
together with remote keys list and remote mcp tokens, since keys and agent tokens created from
that laptop are not signed out with it.
remote plan [tier]
remote plan
remote plan pro [--org <org>]Starts or changes your plan, opening Stripe Checkout in your browser. tier is starter, pro,
or max; without it, the CLI shows the current plan and asks.
remote update
Re-runs the installer from https://remotehost.ai/install, replacing this CLI with the current
release. Set REMOTEHOST_INSTALL_URL to update from somewhere else.
The installer downloads the remote program for your machine into ~/.remotehost/bin and needs
no Node.js. It reads REMOTEHOST_VERSION, a version or a tag such as beta (the latest release
by default), and REMOTEHOST_INSTALL_DIR, the directory to install into. If you installed the
CLI with npm, update it with npm i -g @remotehost/cli instead, so you keep one remote.
remote new [agent]
remote new [agent] [flags]Creates a sandbox with an agent running in it and prints the row. agent defaults to claude; the
accepted values are claude and codex. Takes all the shared flags.
It does not attach — remote attach is what puts you inside one.
With --json, the sandbox carries vmm, the VMM it runs on, as the API sent it: a VMM the CLI
does not know yet prints as it is.
remote claude / remote codex
remote claude [flags]
remote codex [flags]Shorthand for remote new claude / remote new codex. Same shared flags.
remote ls
remote ls [-o, --org <org>] [--json]Lists sandboxes across your orgs, or one org with --org. On a terminal this is a table whose
columns are name, agent, profile, persistence policy, size, location, host, status, and SSH address;
narrow windows drop columns from the least informative end, and never drop name or status. Piped, it
is the same fields tab-separated with no header.
HOST is the orchestrator the sandbox is actually placed on, which is not always what LOCATION
implies — a sandbox records the region it asked for and runs wherever it was placed.
remote attach
remote attach <host>Attaches to a sandbox's terminal. Hosted sandboxes use the RemoteHost envd tunnel that also powers the console terminal; direct-IP providers use SSH. Recent output is replayed on connect, so attaching to a session that has been running a while shows you where it got to rather than a blank screen.
Ctrl+G returns to the RemoteHost menu, leaving the remote shell and everything in it running
(Ctrl+] still works too). Those two bytes are intercepted locally and never forwarded — every
other key, Ctrl+C and Ctrl+D included, goes straight to the remote process, which is what makes
this a real PTY rather than a wrapper.
remote ssh
remote ssh <host>
remote ssh <host> --command 'hostname && pwd'
remote ssh <host> -- grep -r 'a b' src
tar c . | remote ssh <host> -c 'tar x'
remote ssh <host> --printOpens a shell to a sandbox. Hosted sandboxes route through the RemoteHost SSH gateway;
direct-IP providers connect to the sandbox address directly. Uses the keypair generated on first
sandbox creation (~/.config/remotehost/id_ed25519).
| Flag | Description |
|---|---|
-c, --command <cmd> | Run one command line, read by the sandbox's shell, instead of opening an interactive shell |
-- <command> [args…] | Run one command, each argument passed exactly as given (not with -c) |
--print | Print the ssh command instead of running it |
--native | Force native SSH instead of RemoteHost's authenticated transport |
--gateway-host <host> | Override the SSH gateway host |
A command runs in /code and its exit code is remote ssh's. In a script, where stdin or stdout
is not a terminal, it runs without a terminal: stdin is passed to it to its end, and its stdout and
stderr arrive apart, byte for byte, so binary data survives in both directions. Interrupting
remote ssh (Ctrl-C, kill) ends the command and everything it started on the sandbox. If the
connection is lost while the command runs, remote ssh exits 255.
remote sleep
remote sleep <host> [--json]Snapshots the sandbox, releases its machine, and stops machine-time billing immediately. Nothing is
deleted — remote wake brings it back exactly where it was, processes and all.
Ephemeral sandboxes have nothing to keep, so for them this ends the sandbox. remote stop is an
alias.
sleep returns as soon as the sandbox is paused, which is immediate. Billing stops at that
moment. Writing its memory to object storage takes as long as the working set needs — seconds for
an idle box, longer for one that has been busy — and happens after the command has returned, with
the sandbox showing saving until it is done.
A sandbox that is saving cannot be woken yet: a wake restores from exactly the snapshot still
being written, so remote wake answers 409 with error.code snapshot_in_progress until it
exists. It is seconds, and it resolves on its own.
remote wake
remote wake <host> [--json]Restores a sleeping sandbox from its own snapshot. remote resume is an alias.
If the sandbox's host is restarting, the API answers 503 host_unavailable and changes
nothing. remote waits the Retry-After it is given and tries again, for up to a minute, before
showing the error. Creating one (remote new, remote claude, remote codex) does the same.
remote extend
remote extend <host> [--json]Pushes the auto-stop deadline out by another full TTL window from now, and says on stderr when the sandbox now stops, in your local time.
remote metrics
remote metrics <host> [--json]Samples a running sandbox's CPU, memory, swap, and disk pressure, plus the guest's kernel stall
information. Reports the current allocation, the recommendation, and — for auto sandboxes — the
allocation queued for next resume. Fixed-size profiles report action=none.
A sandbox under memory pressure also gets a warning on stderr naming the remote resize that
would fix it, so a piped metrics line stays clean.
remote latency
remote latency <host> [-n 20] [-w 1] [--json]Measures interactive terminal round-trip latency against a hosted sandbox and reports min,
p50, p95, max, and mean. -n/--samples sets how many to take (default 20) and -w/--warmup how
many leading samples to discard (default 1).
remote resize
remote resize <host> --vcpu 4 --memory 8 --disk 80 [--json]Sets an exact allocation. Sleeping sandboxes take it immediately. Running sandboxes apply it live only where the provider supports verified resource changes; otherwise it is queued for the next wake, and the output says which happened.
remote rm
remote rm <host> [--json]Destroys a sandbox and everything in it. This is not recoverable — use
remote sleep if you want the machine time to stop but the work to survive.
remote keys
Manages the API keys that scripts, CI, the MCP server, and anything built on the platform authenticate with.
remote keys create [--org <org>] [--name <name>] [--template <t> | --scope <perm>... | --unscoped]
[--expires-in-days <days> | --never-expires] [--json]
remote keys list [--org <org>] [--json]
remote keys rotate <key-id> [--org <org>] [--overlap-hours <hours>] [--json]
remote keys revoke <key-id> [--org <org>] [--json]create prints the token once and stores only a hash of it, so a lost key is replaced rather than
recovered. The key is named after this machine unless --name says otherwise, which is what makes
remote keys list readable later.
With no flags, a key gets the ci template (create, run in and clean up sandboxes) and expires in
90 days. Choose --template (ci, read-only, platform, agent-watcher), one or more
--scope permissions, or --unscoped for everything you can do; --never-expires keeps it
forever. The claims template was removed with Claims in version 2.0.0 of the API and is refused with 400. list shows each key's owner, scopes and expiry. rotate prints a new token and keeps the
old key working for --overlap-hours (default 24) so you can deploy the new one first.
remote workspaces
Shows the org's workspaces: Internal ones, where a team builds, and External ones, the infrastructure its product runs on for its customers. Every project lives in one and takes its kind.
remote workspaces list [--org <org>] [--json]
remote workspaces show <workspace> [--org <org>] [--json]list prints each workspace's id, name, kind and whether it is one of the org's defaults; show
takes a name or id. A member who cannot read every workspace sees only the ones holding a project
it works on.
The workspace API is off until the server it talks to turns it on. Until then both commands fail with "Workspaces are not enabled on this server yet" (the API's 404). API keys cannot call it either: sign in as a user.
remote environments
Shows a project's environments: durable work (a disk, its checkpoints and its own
remotehost/<name> git branch) that outlives any one sandbox. At most one sandbox runs an
environment at a time.
remote environments list [--org <org>] [--project <project>] [--json]
remote environments show <environment> [--org <org>] [--project <project>] [--json]
remote environments fork <environment> --name <name> [--checkpoint <checkpoint-id>]
[--org <org>] [--project <project>] [--json]list shows each environment's status, the sandbox running it, its branch and the environment
template it boots from. fork creates a new environment in the same project that starts as a copy
of this one, uncommitted work included, at a durable checkpoint (its newest unless --checkpoint
names one). Only the environment's owner may fork it, and forking is off unless the server enables
it. The new environment is asleep until something attaches to it.
API keys reach the environments routes only where the server enables key access to
environments. Then an org API key (rh_sk_) reaches only its owner's own environments, within
its scopes, and deleting one needs a key whose own scopes name sandbox.environment.delete. Until
then, and always for a sandbox's Claims key (rh_sb_), a key is refused, and with
REMOTEHOST_TOKEN set to one these commands fail with a message saying so: unset it and run
remote login to use them as a signed-in user.
remote environment-templates
Shows a project's environment templates: what its environments and sandboxes boot from (image, machine size, setup script, services, ports, environment variables and egress policy).
remote environment-templates list [--org <org>] [--project <project>] [--json]
remote environment-templates show <template> [--org <org>] [--project <project>] [--json]show takes a template's id or exact name, as --environment-template does. It
lists environment variable names only; --json has their values. API keys can read templates.
Creating, changing and deleting workspaces, environments and templates is done with the SDK or the REST API, not the CLI.
remote mcp setup
remote mcp setup [--org <org>] [--name <name>] [--expires-in-days <days>]The same mint as remote keys create, with scopes for driving sandboxes and agent sessions by
default (add --scope agent_session.approve to let the agent answer approval prompts), followed
by the MCP client configuration to
paste — a ready-made claude mcp add line and the equivalent JSON block.
remote app
Moved out of the CLI. Building and testing an app is remotehost-app, the command
of the App SDK (@remotehost/apps) the app depends on:
npx @remotehost/apps build [dir]
npx @remotehost/apps test [dir] [-t <pattern>]remote app ... runs nothing: it prints that command, with the arguments you typed, and exits 1.
Configuration
| Config file | ~/.config/remotehost/config.json (mode 0600) |
| SSH keypair | ~/.config/remotehost/id_ed25519 / id_ed25519.pub, generated on first use |
REMOTEHOST_TOKEN | Overrides the stored session — this is how CI and agents authenticate, using a key from remote keys create |
REMOTEHOST_API_URL | API base URL (defaults to https://api.remotehost.ai; set to http://localhost:8787 for local development) |
REMOTEHOST_CONFIG_DIR | Where the session is stored. Lets a second install keep its own login instead of overwriting the first |
REMOTEHOST_TUNNEL_URL | Interactive terminal tunnel base URL. Defaults to REMOTEHOST_API_URL; set this when terminal traffic is routed separately from normal API traffic |
REMOTEHOST_CONSOLE_URL | Console base URL used for the device-approval link (defaults to https://console.remotehost.ai) |
REMOTEHOST_SSH_GATEWAY_HOST | SSH gateway host for hosted sandboxes |
REMOTEHOST_INSTALL_URL | Installer used by remote update (defaults to https://remotehost.ai/install) |