Skip to content

OpenCode

Run OpenCode in a box with an Anthropic or OpenAI API key, or a ChatGPT login managed on the host.

Updated

OpenCode is an open-source coding agent CLI. abx installs the pinned 2.4.3 Linux tarball from opencode.ai, checked against a SHA-256 digest, and runs it in the box. Use this page to pick between API keys and a host-managed ChatGPT login.

Launch

abx opencode <box>

abx runs opencode --auto in the guest, and each auth mode adds --standalone. Arguments after -- go to OpenCode.

Authentication

Mode Access What it does
anthropic/api-key masked A host-managed Anthropic API key.
openai/api-key masked A host-managed OpenAI API key.
openai/chatgpt masked OpenCode manages the ChatGPT connected-app login and renewal on the host.
openai/login none Not available in a box. Use chatgpt for the connected-app sign-in.

OpenCode has no global or local guest login modes.

API keys (masked)

abx auth set opencode --provider anthropic --mode api-key --from 'op://Development/Anthropic/api-key'
abx auth set opencode --provider openai --mode api-key --from 'op://Development/OpenAI/api-key'
abx auth verify opencode
abx opencode first-task

See Secret providers.

ChatGPT login on the host (masked)

Install the OpenCode CLI on the host at exactly version 2.4.3, the version abx pins. The host login also needs /usr/bin/sqlite3. Sign in under a profile name:

abx auth login opencode --provider openai --mode chatgpt --profile work
abx auth verify opencode
abx opencode first-task

On Linux, OpenCode must be a native ELF64 binary; npm wrappers and shell shims are refused. The install layout and trust rules are in Host-managed login. ChatGPT grants obtained through OpenCode belong to OpenCode and are not shared with Codex or Pi. OpenCode renews close to its native expiry, so a verification can wait for that window.

Verification

Every mode has a probe that runs one turn and checks the JSON event stream for the expected reply. abx auth verify opencode runs a real model request and can incur charges. See Verification.

Notes

  • Each mode gets its own XDG_DATA_HOME in the guest home and its own OPENCODE_CONFIG_CONTENT, so a box with several providers keeps them apart.
  • The adapter turns off OpenCode’s project config and its model-list fetch.
  • With no saved login, the box may reach api.anthropic.com. A selected mode replaces that with its own endpoint: api.anthropic.com for the Anthropic mode, and api.openai.com for the OpenAI API-key and ChatGPT modes. See Network policy.

Type to search…

↑↓ navigate↵ selectEsc close