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

Installation

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

Configuration

oc config set api-key your-api-key
oc config show

Resolution Order

PrioritySourceExample
1 (highest)CLI flags--api-key=xxx
2Environment variablesOPENCOMPUTER_API_KEY
3Config file~/.oc/config.json
4 (lowest)Defaultshttps://app.opencomputer.dev

Global Flags

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

Key Workflows

Quick Start

# 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:
# 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

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

Hibernate for Cost Savings

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

Checkpoint and Fork

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 agentCreate, manage, connect channels, install packages
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 configConfigure API key and API URL
Full flag reference for every command: CLI Reference.