Skip to content

opc CLI

opc is the Computer API's command-line client: one Rust binary from diggerhq/opc (Apache-2.0)

Not in the public code yet: launch blocker 4 (API on a self-hosted instance). See API overview.

Releases before 0.1.0 are prereleases. opc --version prints the protocol (opc.v1) and schema (computer-api.v1) it speaks.

Install

curl -fsSL https://raw.githubusercontent.com/diggerhq/opc/main/ci/install.sh | sh

The script verifies the release’s checksum and installs to ~/.local/bin/opc, without sudo and without editing shell startup files. Run it again to update. Supported: macOS, Linux, and Windows under WSL 2.

VariableEffect
OPC_INSTALL_DIRInstall directory instead of ~/.local/bin
OPC_VERSIONInstall this release tag. Without it: the latest release, or the newest prerelease while there is no full release

The macOS builds are not signed. If macOS blocks the first run:

xattr -d com.apple.quarantine ~/.local/bin/opc

From source (Rust 1.89 or later):

cargo build --release --locked

Authentication

CommandDoes
opc loginOpens the browser to approve a device code and exchanges it for an API key. --no-browser prints the link. Running opc with no credential starts the same login
opc logoutRevokes the credential and clears it from the file
opc whoamiShows who the credential belongs to

opc stores the key in ~/.opencomputer/config.json (mode 0600) with the API URL it was issued for:

{"apiUrl": "...", "apiKey": "...", "login": {"credentialId": "...", "keyPrefix": "...", "name": "..."}}

OPENCOMPUTER_API_KEY overrides the file (for scripts and CI). The key in the file is used only when the file’s apiUrl matches the API URL in use.

Endpoint configuration

Not in the public code yet: launch blocker 4 (API on a self-hosted instance). Launch design: set OPENCOMPUTER_API_URL to the self-hosted gateway’s URL and OPENCOMPUTER_API_KEY to a key minted in /setup. Today the public gateway serves none of the routes opc calls.
VariableMeaning
OPENCOMPUTER_API_URLThe API’s base URL. Overrides apiUrl in the configuration file. Default: the hosted service
OPC_WIRE_URLThe WebSocket URL. Without it, and with a non-default API URL, opc reads computer.wireUrl from GET /me
OPENCOMPUTER_CONFIGPath of the configuration file
OPC_STATE_DIRWhere opc keeps its state (last session, cached session list and events). Default ~/.opencomputer/opc
OPC_LOGerror, warn (default), info or debug. Logs go to standard error
OPC_NOTIFY=0No notifications
OPC_TELEMETRY=0Same as opc config telemetry off
NO_COLORNon-empty: no colors
HTTPS_PROXY, NO_PROXYThe proxy for connections, and the hosts that bypass it
API URL ruleDetail
Schemehttps. http only for localhost, 127.0.0.1, ::1 and *.localhost
Trailing / or /apiRemoved
API requestsSent under <API URL>/api/managed-agents/computer
Login requestsSent to <API URL>/auth/cli/...

opc uses HTTP for single reads and writes, and the WebSocket to follow a session live (the interactive screen, attach, watch, wait) and for shell.

Commands

A session argument is an id, a prefix of one, - for the last session used on this machine, or a Slack thread link.

CommandPurpose
opc [message]Log in if needed, then open the interactive session screen. With -s <session>, in that session
opc -p <message>Non-interactive: send the message, wait for the turn, print the result
opc newCreate a session, send a message, return at once
opc attach (a)Attach to a session. --read-only, --history N, --no-history
opc list (ls)List sessions. --status, --metadata, --archived, --limit, --long, --json
opc logPrint a session’s history and exit. --details, --after, --turn, --types
opc sendSend a message and return when it is accepted. --wait waits for the turn
opc waitWait for a session, a turn, or several. --turn, --any, --all
opc watchPrint a session’s activity until it is idle or waiting. --after, --from-start, --follow
opc interruptInterrupt the running turn and cancel queued ones. --no-wait
opc ask lsList asks
opc ask allow, deny, alwaysAnswer an approval. -m adds a message, --mode sets the mode after a plan
opc ask answerAnswer a question. --choice, --text
opc ask dismissDismiss an ask
opc subagents ls, stop, resultList, stop and read a session’s subagents
opc renameSet a session’s title
opc archive, opc unarchiveArchive a session, or bring it back
opc openOpen the session on the dashboard
opc diffPrint the agent’s changes as a git diff. --stat
opc pushCopy a local directory into a session’s workspace. --to, --no-ignore, --dry-run
opc pullCopy a directory or file from a session’s workspace. --force, --dry-run
opc shellOpen a shell in a session’s workspace. -c runs one command, --no-tty
opc login, logout, whoamiManage the credential
opc doctorCheck each link on the path to the computer, stopping at the first that fails
opc schema [object]Print the JSON Schema of result, event, session, turn, ask, subagent or error
opc config telemetry [on|off]Show or set telemetry
opc completion bash|zsh|fishPrint a shell completion script
opc help [topic]Help

Send options

For opc [message], opc -p and, where they apply, opc new and opc send.

OptionEffect
-s, --sessionThe session to use instead of a new one
--queue, --steer, --interruptWhat to do when the session is busy: the ifBusy value of turns.send
--model, --effort, --speed, --mode, --title, --metadata K=VSettings of the new session. Refused with -s
--push DIRUpload a directory to the new session’s workspace first
--idempotency-keyThe key sent with the write
--output-format text|json|stream-json, --jsonWith -p: the final text, one Result object, or one JSON line per event
--include-partial-messagesWith stream-json: also print deltas
--on-ask fail|dismiss|waitWith -p, when an ask opens: exit 5, dismiss it, or wait for a person
--timeoutGive up after this long, exit 124. --interrupt-on-timeout also interrupts the turn
--interrupt-on-exitWith -p: interrupt the turn whenever opc exits before it ends
--wait-subagentsAlso wait for the background subagents the turn launched

Global options: --timing, --no-color, -q/--quiet, -v/--verbose.

Exit codes

CodeMeaning
0Done
1The turn failed or was cancelled
2Usage error, or the server no longer supports this version’s protocol
3Not logged in, or no access
4Unreachable or busy: retry
5Waiting for a person (an ask is open)
6Out of credits
124Timed out
130Interrupted