# CLI

`rent` is the npm package `rentdev`, for Node.js 22 or later.

## Run it

```sh
npx rentdev --help

npm i -g rentdev
rent --help
rent sbx create --help
```

The package installs `rent` and `rentdev`, one program. Named without a command it prints help and does nothing else; `rent <command> --help` prints a command's flags, its JSON output and examples.

| Option | What it does |
| --- | --- |
| `--json` | One JSON document on stdout; errors as JSON on stderr. |
| `-q`, `--quiet` | No progress or hints on stderr. |
| `--no-interactive` | Never prompt and never open a browser. |
| `--no-color` | No color (also `NO_COLOR`, `RENT_NO_COLOR`, `TERM=dumb`). |
| `-h`, `--help` | Help for any command. |
| `-V`, `--version` | Print the version. |

## Sign in

| Command | What it does |
| --- | --- |
| `rent init` | Create an account and an agent key: signs up without an email (one call), stores the API key, then generates an Ed25519 agent key and binds it to the account. Run on a machine that has `agent.key` and no credentials, it gets a new API key. Run again, it changes nothing that is already set up, and after a failure it makes no second account. |
| `rent login` | Sign in with a browser (device flow): prints a one-time code and a link to confirm it on any device. Tokens last one hour and renew themselves for 30 days when `offline_access` is granted. |
| `rent logout` | Revoke the browser sign-in. An API key from `rent init` stays unless `--all` is given; `agent.key` is never touched. |

| Command | Flag | What it does |
| --- | --- | --- |
| `rent init` | `--force` | Create a new account even when one is stored. |
| `rent init` | `--no-agent-key` | Skip the agent key. |
| `rent init` | `--show-key` | Also print the API key (it is stored either way). |
| `rent login` | `--scope <scope>` | Ask only for these scopes, e.g. `--scope "sandbox billing offline_access"`. |
| `rent login` | `--no-browser` | Do not offer to open the browser. |
| `rent login` | `--wallet` | Sign in with `RENT_WALLET_KEY`, the wallet that paid an x402 top-up. |
| `rent logout` | `--all` | Also forget the stored API key for this API. |

A command uses `RENT_API_KEY` when it is set. Otherwise it uses, of what `credentials.json` holds for this API origin, the credential stored last: the `rent login` tokens or the API key.

`~/.config/rentdev/credentials.json` (mode 0600) holds one profile per API origin, so a key from one deployment is never sent to another. `agent.key` (0600) beside it is the Ed25519 agent key and is never overwritten.

## Prices and credit

| Command | What it does |
| --- | --- |
| `rent quote` | Price per task on rent.dev and on every vendor with published rates, for a workload profile and a sandbox shape. No account needed. |
| `rent topup <usd> (--card \| --x402)` | Add credits. `--card` prints a Stripe pay link for a person to open; the fee is 5.5%, at least $0.80, and nothing is charged until they pay. `--x402` pays now in USDC on Base from `RENT_WALLET_KEY`; the fee is 5.5%. Without an account, `--x402` credits the wallet's own account, creating it and storing its API key. |
| `rent balance` | Show the prepaid balance. Available is the total minus what running work holds. |

| Command | Flag | What it does |
| --- | --- | --- |
| `rent quote` | `--profile <profile>` | agent-loop, interactive, workspace; default all three. |
| `rent quote` | `--cpu <count>` | vCPUs, 1 to 64; default 2. |
| `rent quote` | `--memory <MiB>` | Memory in MiB; default 4096. |
| `rent quote` | `--gpu` | Also list GPU prices per hour. |
| `rent topup` | `--card` | Print a pay link (Stripe Checkout). |
| `rent topup` | `--x402` | Pay with USDC from `RENT_WALLET_KEY`. |
| `rent topup` | `--show-key` | With `--x402`: also print the API key of an account the payment created. |

## Sandboxes

| Command | What it does |
| --- | --- |
| `rent sbx create` | Create a sandbox: takes a hold on the balance for the timeout, places it and prints its id (`lse_…`) once it is running. It stops at its timeout; `rent sbx kill` stops it sooner and releases the rest of the hold. |
| `rent sbx exec <id> -- <command>` | Run a command with bash and wait for it. Its stdout, stderr and exit code are this command's own (124 when it hit the timeout). One argument after `--` is a shell line (`"ls \| wc -l"`); several are one command and its arguments. |
| `rent sbx ls`, also `list` | List sandboxes, newest first. Without `--state`, every sandbox that is not terminated or failed. |
| `rent sbx ports <id> <port>...`, also `port` | Print the https URL that reaches a port a process inside the sandbox listens on. |
| `rent sbx kill <id>...`, also `terminate`, `rm` | Terminate sandboxes: the last usage is charged, the rest of the hold released. |

| Command | Flag | What it does |
| --- | --- | --- |
| `rent sbx create` | `-t`, `--template <alias>` | Template alias; default `base`. |
| `rent sbx create` | `--timeout <seconds>` | Seconds until it stops; default 300, at most 86400. |
| `rent sbx create` | `-e`, `--env KEY=VALUE` | Environment variable inside the sandbox; repeatable. |
| `rent sbx create` | `--metadata KEY=VALUE` | Metadata to find it by later; repeatable. |
| `rent sbx create` | `--profile <profile>` | Expected duty: agent-loop, interactive, workspace. |
| `rent sbx create` | `--auto-pause` | Pause instead of stopping at the timeout. |
| `rent sbx create` | `--auto-resume` | Resume a paused sandbox when traffic arrives. |
| `rent sbx create` | `--allow <endpoint>` | Also consider this endpoint (your own vendor key); repeatable. |
| `rent sbx create` | `--partners <none\|active\|all>` | Partner machines it may run on; default `active` (verified partners). `none` keeps it on rent.dev's own machines and your own vendor keys; `all` adds partners on probation. The operator of a partner machine can read what runs on it. |
| `rent sbx create` | `--no-wait` | Print the id and return before it is running. |
| `rent sbx exec` | `--cwd <dir>` | Working directory. |
| `rent sbx exec` | `-e`, `--env KEY=VALUE` | Environment variable for the command; repeatable. |
| `rent sbx exec` | `--user <name>` | Run as this user; default `user`. |
| `rent sbx exec` | `--timeout <seconds>` | Kill it after this long, 1 to 3600; default 50. |
| `rent sbx exec` | `--stdin` | Send this command's stdin to the remote command. |
| `rent sbx ls` | `--state <state>` | Only this state: requested, placing, running, paused, settling, terminated, failed. |
| `rent sbx ls` | `--limit <count>` | Page size, 1 to 200; default 50. |
| `rent sbx ls` | `--all` | Every page, not just the first. |

`rent sandbox` and `rent sandboxes` are `rent sbx`.

```sh
ID=$(rent sbx create --timeout 3600 --quiet)
rent sbx exec $ID -- "uname -a"
rent sbx kill $ID
```

## GPU pods

| Command | What it does |
| --- | --- |
| `rent gpu create` | Create a GPU pod on your RunPod key. It needs a stored RunPod key (`rent byok add runpod`). RunPod bills the pod to that key; no rent.dev balance is used. |
| `rent gpu ls`, also `list` | List GPU pods. |
| `rent gpu kill <id>...`, also `terminate`, `rm` | Terminate GPU pods. |

| Command | Flag | What it does |
| --- | --- | --- |
| `rent gpu create` | `--gpu-type <type>` | RunPod GPU type, e.g. `NVIDIA GeForce RTX 4090` (see `rent quote --gpu`). |
| `rent gpu create` | `--image <image>` | Container image. |
| `rent gpu create` | `--gpu-count <count>` | GPUs; default 1. |
| `rent gpu create` | `--cloud <cloud>` | `SECURE` or `COMMUNITY`; default `SECURE`. |
| `rent gpu create` | `--disk <GB>` | Container disk; default 20. |
| `rent gpu create` | `--volume <GB>` | Persistent volume; default 0. |
| `rent gpu create` | `--port <port/proto>` | Exposed port, e.g. `8888/http` or `22/tcp`; repeatable. |
| `rent gpu create` | `-e`, `--env KEY=VALUE` | Environment variable in the pod; repeatable. |
| `rent gpu create` | `--credential <id>` | RunPod credential to use (`cred_…`); default the only one. |
| `rent gpu create` | `--no-wait` | Print the id and return before the pod exists. |
| `rent gpu ls` | `--limit <count>` | Page size, 1 to 200; default 50. |
| `rent gpu ls` | `--all` | Every page, not just the first. |

## API keys and vendor keys

| Command | What it does |
| --- | --- |
| `rent keys ls`, also `list` | List API keys. `rent keys` alone does the same. |
| `rent keys create` | Create an API key. It prints the secret, which is shown this once. |
| `rent keys rotate <id>` | Revoke a key and print its replacement, shown this once. When it is the key this CLI stores, the stored key is replaced too. |
| `rent keys revoke <id>` | Revoke a key. |
| `rent byok add <vendor>` | Store a vendor key (`e2b`, `vercel`, `runpod`). It is checked with one read-only vendor call, stored encrypted and never returned. |
| `rent byok ls`, also `list` | List stored vendor keys. |
| `rent byok rm <id>...`, also `remove`, `delete` | Delete stored vendor keys. A sandbox or GPU pod still running on the key keeps running and its vendor keeps billing you: terminate it at the vendor. |

| Command | Flag | What it does |
| --- | --- | --- |
| `rent keys ls` | `--limit <count>` | Page size, 1 to 200; default 50. |
| `rent keys ls` | `--all` | Every page, not just the first. |
| `rent keys create` | `--name <name>` | A name to tell keys apart. |
| `rent keys create` | `--limit-usd <usd>` | Lifetime spend this key may capture. |
| `rent byok add` | `--api-key <key\|->` | `e2b`, `runpod`: the API key. |
| `rent byok add` | `--token <token\|->` | `vercel`: the access token. |
| `rent byok add` | `--team-id <id>` | `vercel`: the team id. |
| `rent byok add` | `--project-id <id>` | `vercel`: the project id. |
| `rent byok add` | `--label <label>` | A label to tell credentials apart. |

`rent key` is `rent keys`. For a secret, pass `-` to read it from stdin, or leave the flag out and it is read from the vendor's own variable (`E2B_API_KEY`, `RUNPOD_API_KEY`, `VERCEL_TOKEN` with `VERCEL_TEAM_ID` and `VERCEL_PROJECT_ID`) or asked for on a terminal.

## MCP

| Command | What it does |
| --- | --- |
| `rent mcp` | Print the MCP server URL, the Authorization header and what to give each common client; `--client` prints one client's text. The header carries your API key: treat the output as a secret. |
| `rent mcp --stdio` | Run an MCP server on stdin and stdout that forwards every message to the remote server, for clients that only start local servers. |

| Command | Flag | What it does |
| --- | --- | --- |
| `rent mcp` | `--stdio` | Proxy MCP over stdin and stdout. |
| `rent mcp` | `--public` | The anonymous server: quotes, the provider catalog, docs and signup. |
| `rent mcp` | `--client <client>` | Only this client's text: `claude`, `cursor`, `codex` or `stdio`. Every other client's is in [Connect a client](/docs/mcp#connect). |
| `rent mcp` | `--name <name>` | Server name in the config; default `rent`. |

## Exit codes

| Code | Meaning |
| ---: | --- |
| 0 | Success. |
| 1 | Unexpected error. |
| 2 | Usage error, or a request the API calls invalid. |
| 3 | Not signed in, or the credential was refused. |
| 4 | Payment required: add credits. |
| 5 | Forbidden: the credential lacks the scope. |
| 6 | Not found. |
| 7 | Conflict. |
| 8 | Try again later: rate limited, no capacity, or still running. |
| 9 | The upstream vendor failed. |
| 10 | The API could not be reached. |

`rent sbx exec` exits with the remote command's code, 124 when it timed out.

An error is an RFC 9457 problem with a stable `code` and hints on what to do: one line of JSON on stderr, or text when stderr is a terminal and `--json` is not given.

## Environment variables

| Variable | What it sets |
| --- | --- |
| `RENT_API_KEY` | API key; wins over stored credentials. |
| `RENT_WALLET_KEY` | Wallet private key for `topup --x402` and `login --wallet`. |
| `RENT_API_URL` | API origin; default `https://api.rent.dev`. |
| `RENT_AUTH_URL` | Sign-in origin; default `https://auth.rent.dev`. |
| `RENT_MCP_URL` | MCP endpoint; default `https://mcp.rent.dev/mcp`. |
| `RENT_CONFIG_DIR` | Config directory; default `$XDG_CONFIG_HOME/rentdev`, else `~/.config/rentdev`. |
