opencode, running on a Cloud Shell VM

Pick the one that matches where you are.

1. From your own machine

Starts Cloud Shell if needed, installs opencode on the VM, keeps it alive in tmux, and forwards http://localhost:4096 back over SSH.

GH_TOKEN=xxx bash <(curl -fsSL https://opencode-cloudshell-vwb6.pages.dev/install.sh)

install.sh — --reconnect re-attaches to the running instance without restarting it, --stop stops it.

2. Already inside a Cloud Shell terminal

No tunnel to make — it starts opencode in tmux on this VM and prints a Cloud Shell Web Preview URL you open in your browser.

bash <(curl -fsSL https://opencode-cloudshell-vwb6.pages.dev/cloudshell.sh)

cloudshell.sh — --attach, --status, --stop.

Both scripts

Ctrl-C closes the tunnel only — the opencode server keeps running on the VM, so a dropped connection or a closed laptop does not kill work in flight.

PORT
Port to serve and tunnel on. Default 4096.
OC_VERSION
Version of the opencode-ai npm package. Default 1.18.35.
GH_TOKEN
Optional. Piped straight into gh auth login --with-token over stdin — never passed as an argument, never written to a file.