oc CLI lets you manage OpenComputer sandboxes directly from your terminal — create sandboxes, run commands, open interactive shells, manage checkpoints, and more.12curl -fsSL https://github.com/diggerhq/opencomputer/releases/latest/download/oc-darwin-arm64 -o /usr/local/bin/oc chmod +x /usr/local/bin/oc
12oc login oc whoami
oc login prints a short confirmation code and opens the hosted sign-in page.
Use oc login --no-browser over SSH or when a coding agent is running the
command for you. The CLI stores the resulting credential in
~/.oc/config.json with private file permissions; it never prints the key.12oc logout # revoke the CLI-created key, then clear it locally oc logout --local # clear local login state without claiming remote revocation
oc login authenticates the local CLI. CI, servers, and SDK applications
should continue to receive an explicit org key through their secret manager and
OPENCOMPUTER_API_KEY.| Priority | Source | Example |
| 1 (highest) | CLI flags | --api-key=xxx |
| 2 | Environment variables | OPENCOMPUTER_API_KEY |
| 3 | Config file | oc login or oc config set api-key … |
| 4 (lowest) | Defaults | https://app.opencomputer.dev |
--api-key or OPENCOMPUTER_API_KEY override must be removed before
oc login or remote oc logout; oc logout --local can still clear the saved
CLI login. Manually setting an API key remains supported:12oc config set api-key "$OPENCOMPUTER_API_KEY" oc config show
| Flag | Environment Variable | Description |
--api-key | OPENCOMPUTER_API_KEY | API key for authentication |
--api-url | OPENCOMPUTER_API_URL | Control plane URL |
--json | — | Output as JSON instead of tables |
1234567891011# Create a sandbox oc create # Run a command and wait for the result oc exec sb-abc123 --wait -- echo "Hello from the cloud" # Open an interactive shell oc shell sb-abc123 # Clean up oc sandbox kill sb-abc123
--json for machine-readable output:123456789# Get a sandbox ID programmatically ID=$(oc create --json | jq -r '.sandboxID') # List all running sandbox IDs oc ls --json | jq -r '.[].sandboxID' # Run a command and capture the result RESULT=$(oc exec $ID --json --wait -- npm test) echo $RESULT | jq '.exitCode'
| Shortcut | Expands to |
oc create | oc sandbox create |
oc ls | oc sandbox list |
oc cp | oc checkpoint |
1oc shell $(oc create --json | jq -r '.sandboxID')
1234oc sandbox hibernate sb-abc123 # ... hours later ... oc sandbox wake sb-abc123 oc shell sb-abc123
12345oc cp create sb-abc --name ready-state ID1=$(oc cp spawn cp-xyz --json | jq -r '.sandboxID') ID2=$(oc cp spawn cp-xyz --json | jq -r '.sandboxID') oc exec $ID1 --wait -- ./test-a.sh oc exec $ID2 --wait -- ./test-b.sh
| Command | Description |
oc sandbox | Create, list, kill, hibernate, wake |
oc exec | Run commands, manage exec sessions |
oc shell | Interactive PTY terminal |
oc checkpoint | Snapshot, fork, restore |
oc patch | Checkpoint-attached scripts |
oc preview | Expose ports to the internet |
oc agent | Invoke durable agents and manage Hook URLs |
oc login | Sign in, inspect identity, and log out |
oc config | Configure API key and API URL |