Run OpenCode on a remote server
Every model, one VM, and an agent that works while your laptop sleeps.
Shelley handles the setup. About 5 minutes.
Prefer a terminal?
curl -fsSL https://exe.dev/deploy/opencode/prompt.txt | ssh exe.dev new --prompt=/dev/stdinOpenCode is an open-source coding agent that works with almost any model. On an exe.dev VM it gets Claude, GPT and open-weight models through exe.dev's LLM integration: no API keys to paste, and model usage billed to your exe.dev account.
Use it from your terminal, or from a browser tab that only you can open. Either way, the work happens on the VM, so your laptop can go to sleep.
What you get#
- OpenCode connected to Claude, GPT and open models, with no API key to paste
- A project folder at
~/projecton persistent disk - An
opencodetmux session that survives disconnects - OpenCode's web app on port 4096, behind exe.dev login, and back after a reboot
What's running, and where
ssh my-opencode.exe.xyz
your terminal
https://my-opencode.exe.xyz:4096/
OpenCode in your browser, after a one-time sign-in link
Deploy with Shelley#
Click Deploy and Shelley will set up OpenCode on a new VM, then check that it works. No config-file wrangling required.
Prefer a terminal?
curl -fsSL \
https://exe.dev/deploy/opencode/prompt.txt \
| ssh exe.dev new --prompt=/dev/stdinWhat Shelley is told
Set up OpenCode on this VM by following the exe.dev recipe at https://exe.dev/deploy/opencode.md from top to bottom.
The recipe's example VM name is my-opencode. This VM's name is the output of `hostname`: use it wherever the recipe writes my-opencode. Skip the step that creates the VM; you are on it.
You are done when all of these are true. Check each one yourself:
- OpenCode connected to Claude, GPT and open models, with no API key to paste
- A project folder at `~/project` on persistent disk
- An `opencode` tmux session that survives disconnects
- OpenCode's web app on port 4096, behind exe.dev login, and back after a reboot
Run the VM-side setup in "Start coding" and "Open it in your browser".
If `~/.config/opencode/opencode.json` holds more than exe.dev's
placeholder (`$schema` and `autoupdate`), add the `model` and `providers`
settings to it instead of replacing it. Create tmux detached
(`tmux new -d -s opencode -c ~/project`) rather than attaching. Reuse the
session if it already exists. Do not launch interactive OpenCode. Do not
create a pairing link; they expire in five minutes. Verify from ~/project
with `opencode run -m anthropic/claude-haiku-5-5 "Reply with exactly: OK"`,
check `tmux has-session -t opencode`, and check that `opencode service
status` prints `http://0.0.0.0:4096` and `systemctl is-enabled opencode`
prints `enabled`. Skip the later optional instructions and FAQ. Finish
with the SSH command from "Take a break", the browser URL, and the
`opencode pair` command from "Open it in your browser", using this VM's
name, and tell the owner to run `opencode` inside the tmux session.
Finish with the URLs I should open.
Also at /deploy/opencode/prompt.txt. The recipe it follows is /deploy/opencode.md.
Start coding#
On your computer, create a VM and connect. Pick any free name; if you've already clicked Deploy or have a VM, skip the first command and use its name:
ssh exe.dev new --name=my-opencode
ssh my-opencode.exe.xyz
On the VM, update OpenCode to its latest release and point its Anthropic, OpenAI and Fireworks providers at exe.dev's LLM gateway. This replaces settings left over from OpenCode 1:
sudo exeuntu update opencode
rm -f ~/.config/opencode/plugins/exe-dev.js
cat > ~/.config/opencode/opencode.json <<'EOF'
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-5-5",
"providers": {
"anthropic": { "settings": { "baseURL": "https://llm.int.exe.xyz/anthropic/v1" } },
"openai": { "settings": { "baseURL": "https://llm.int.exe.xyz/openai/v1" } },
"fireworks-ai": { "settings": { "baseURL": "https://llm.int.exe.xyz/fireworks/inference/v1" } }
}
}
EOF
Make a project folder and open a tmux session:
mkdir -p ~/project
tmux new -A -s opencode -c ~/project
Inside that session, start OpenCode:
opencode
Give it a small task. For example:
Build a tiny website for a bakery that only sells one kind of bread.
That's the setup. Your files live in ~/project.
Take a break#
Press Ctrl-b, then d to detach. OpenCode keeps working on the VM when you disconnect. On your computer, use this command to hop back in:
ssh -t my-opencode.exe.xyz 'tmux new -A -s opencode -c ~/project'
A VM restart ends the running session, but not your saved work. Reconnect
and run opencode --continue from your project's folder on the VM to pick
up its last conversation.
Open it in your browser#
OpenCode runs a background service on the VM that holds your sessions, and that service also serves a web app. On the VM, give the service a fixed port that exe.dev's proxy can reach, and start it whenever the VM boots:
opencode service set port 4096
opencode service set hostname 0.0.0.0
sudo tee /etc/systemd/system/opencode.service >/dev/null <<'EOF'
[Unit]
Description=Start the OpenCode background service
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
User=exedev
ExecStart=/usr/local/bin/opencode service start
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now opencode
Then open https://my-opencode.exe.xyz:4096/ in your browser. exe.dev asks
you to log in, because port 4096 is private to people with access to the
VM, and then OpenCode asks for a pairing link. Get one from your computer:
ssh my-opencode.exe.xyz opencode pair --url https://my-opencode.exe.xyz:4096
Open the link it prints within five minutes. OpenCode remembers that browser for 30 days and shows the same sessions as your terminal. Each link works once, so run the command again for another browser, or scan the QR code it prints with your phone.
Warning
The web app can run any command on the VM. Leave port 4096 private and share sign-in links only with people you'd hand your SSH key to.
Make yourself at home#
- Pick a model: type
/modelsin OpenCode, or runopencode modelsto list them, and changemodelin~/.config/opencode/opencode.jsonto set the default. exe.dev keeps a list of available models and prices. Models underopencode/are OpenCode's own free ones and don't go through exe.dev. - Bring your code: connect a GitHub repo,
clone it onto the VM, and run
opencodefrom its directory. Use that folder instead of~/projectin the commands above. - Peek at your app: ask OpenCode to serve it on
0.0.0.0:8000, then openhttps://my-opencode.exe.xyz/. It's private by default. More about previews. - Script it:
opencode run "Summarize the TODOs in this repo"runs one task without the interactive screen and prints the answer.
For OpenCode's own features, head to the OpenCode docs.
Frequently asked questions#
Can I use my own subscription or API key?
Yes. Type /connect in OpenCode to sign in with ChatGPT, GitHub Copilot or a provider's API key; see OpenCode's provider docs. Remove that provider from the providers section of opencode.json first, so OpenCode talks to it directly instead of through exe.dev.
How do I update OpenCode?
On the VM, run sudo exeuntu update opencode, then opencode service restart so the background service picks up the new version. Your sessions and settings stay put.
Something's not working. Where do I look?
On the VM, opencode service status shows the background service's address, and its log is at ~/.local/share/opencode/log/opencode.log. If OpenCode says 1 plugin failed, you skipped the rm in "Start coding": that plugin is for OpenCode 1. OpenCode's troubleshooting guide covers the rest.
How do I back up my work?
Commit and push your code. For a copy of the whole VM, run ssh exe.dev cp my-opencode my-opencode-backup on your computer (choose a free backup name). To use that copy, connect with ssh my-opencode-backup.exe.xyz; your files and OpenCode sessions are there. For the browser, pair again with the copy's name in --url. Reattach any VM-specific integrations.
Updated Oct 17, 2026 · tested end to end Oct 17, 2026 · Markdown · manifest.json · Something wrong? Tell us