Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

CLI

The oc CLI lets you manage OpenComputer sandboxes directly from your terminal — create sandboxes, run commands, open interactive shells, manage checkpoints, and more.

Installation

bash
curl -fsSL https://github.com/diggerhq/opencomputer/releases/latest/download/oc-darwin-arm64 -o /usr/local/bin/oc chmod +x /usr/local/bin/oc

Sign in

bash
oc 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.
bash
oc 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.

Credential resolution

PrioritySourceExample
1 (highest)CLI flags--api-key=xxx
2Environment variablesOPENCOMPUTER_API_KEY
3Config fileoc login or oc config set api-key …
4 (lowest)Defaultshttps://app.opencomputer.dev
An active --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:
bash
oc config set api-key "$OPENCOMPUTER_API_KEY" oc config show

Global Flags

FlagEnvironment VariableDescription
--api-keyOPENCOMPUTER_API_KEYAPI key for authentication
--api-urlOPENCOMPUTER_API_URLControl plane URL
--json—Output as JSON instead of tables

Key Workflows

Quick Start

bash
# 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 Output & Scripting

All commands support --json for machine-readable output:
bash
# 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'

Top-level Shortcuts

ShortcutExpands to
oc createoc sandbox create
oc lsoc sandbox list
oc cpoc checkpoint

Create and Shell In

bash
oc shell $(oc create --json | jq -r '.sandboxID')

Hibernate for Cost Savings

bash
oc sandbox hibernate sb-abc123 # ... hours later ... oc sandbox wake sb-abc123 oc shell sb-abc123

Checkpoint and Fork

bash
oc 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 Reference

CommandDescription
oc sandboxCreate, list, kill, hibernate, wake
oc execRun commands, manage exec sessions
oc shellInteractive PTY terminal
oc checkpointSnapshot, fork, restore
oc patchCheckpoint-attached scripts
oc previewExpose ports to the internet
oc agentInvoke durable agents and manage Hook URLs
oc loginSign in, inspect identity, and log out
oc configConfigure API key and API URL
Full flag reference for every command: CLI Reference.