meir dick

Open source · Apache-2.0 · All four tools

cf-opencode

live

Close your laptop. Your OpenCode turn finishes on Cloudflare.

cf-opencode gives OpenCode users remote workspaces on their own Cloudflare account. Your local OpenCode client attaches to the workspace. Close the laptop mid-turn and the server finishes the turn, then the workspace snapshots and stops. Connect again to resume the same session. Model API keys are never stored on the workspace disk.

Docs ↗GitHub ↗Site ↗

npm install -g cf-opencode && cf-opencode init

The problem

When OpenCode runs on your laptop, the active turn stops when you close the lid, change networks or run out of battery.

A cloud VM keeps a server running all the time, needs an inbound SSH port, and stores your LLM API keys on the same disk where agent code runs.

The workspace

Size2 vCPU, 6 GiB20 GB disk
Running at once10maxRunning
Default modelglm-5.3on Workers AI. Other providers through AI Gateway.
Keys in the container0model API keys stay outside
Inbound ports0shell and SSH go over a WebSocket

How it works

  1. One container and password per workspace. cf-opencode is built on the cf-orbs control plane. Each workspace runs opencode serve in its own Cloudflare Container, behind a Worker proxy (getTcpPort HTTP routing), with its own password.
  2. Model keys added at egress. The Worker adds your LLM API keys to requests as they leave the container. Keys never reach the container environment, the disk or a snapshot.
  3. Browser with no key. When the agent needs a browser, the Worker opens a Cloudflare Browser Run session. Only its WebSocket URL goes into the workspace.
  4. Shell and SSH over WebSockets. shell and ssh go through an authenticated Worker WebSocket to sshd -i. No inbound TCP port is open.

ContainersDurable ObjectsEgress interceptionBrowser Run

Install and use

You need a Cloudflare account on Workers Paid (the $5 a month plan), because Containers need it.

Install and set up your account

npm install -g cf-opencode && cf-opencode init

Attach your local OpenCode client to a workspace

cf-opencode connect [workspace]

Send a task to a workspace

cf-opencode run "<task>" [workspace]

run takes the flags --new, --worktree, --wait and --follow. Other commands: shell, ssh, pause and doctor. The docs have the details.

Questions

Can untrusted repo code or a prompt injection steal my LLM API keys?

No. Model keys stay outside the container and are added at egress. A running process or a saved snapshot cannot read them.

Do I switch to a web UI, or keep my local OpenCode client and SSH tools?

You keep your local workflow. Your OpenCode client connects to opencode serve, and cf-opencode ssh gives you SSH over a Worker WebSocket.

What happens if my Wi-Fi drops while the agent edits files?

The container finishes the turn on Cloudflare, snapshots the workspace and stops. When you connect again, the same session comes back.

Does it work with Codex or Claude Code?

Today it supports OpenCode. The control plane does not depend on OpenCode. Codex is next, through codex app-server and its remote client. Claude Code needs a terminal attach.

The other tools

Same stack: agents on your own Cloudflare account. See the overview. For the platform gaps, read the RFC.

The lessons across all four tools, and the model behind them.What I learned →