Skip to content

Run Codex on a remote server

A computer for Codex. An early night for your laptop.

Deploy on exe.dev

Shelley handles the setup. About 2 minutes.

Prefer a terminal?
curl -fsSL https://exe-staging.dev/deploy/codex/prompt.txt | ssh exe.dev new --prompt=/dev/stdin

Codex, OpenAI's coding agent, already ships with exeuntu, exe.dev's default VM image. Hand it a VM of its own and let it build, run and break things somewhere that isn't your laptop.

This setup uses exe.dev's LLM integration: no API key to paste, no ChatGPT sign-in, and model usage billed to your exe.dev account.

What you get#

  • Codex connected to a model, with no API key or sign-in
  • A Git repository at ~/project on persistent disk
  • A codex tmux session that survives disconnects
What's running, and where
Private ssh my-codex.exe.xyz your terminal
my-codex.exe.xyz exe.dev VM
Codex preinstalled; connected to exe.dev's LLM integration ~/.codex
Your project a Git repository ~/project
tmux keeps your terminal session running when you disconnect

Deploy with Shelley#

Click Deploy and Shelley will set up Codex on a new VM, then check that it works. No config-file wrangling required.

Prefer a terminal?
curl -fsSL \
  https://exe-staging.dev/deploy/codex/prompt.txt \
  | ssh exe.dev new --prompt=/dev/stdin
What Shelley is told
Set up Codex on this VM by following the exe.dev recipe at https://exe-staging.dev/deploy/codex.md from top to bottom.

The recipe's example VM name is my-codex. This VM's name is the output of `hostname`: use it wherever the recipe writes my-codex. Skip the step that creates the VM; you are on it.

You are done when all of these are true. Check each one yourself:
- Codex connected to a model, with no API key or sign-in
- A Git repository at `~/project` on persistent disk
- A `codex` tmux session that survives disconnects

Use the preinstalled Codex. Run the VM-side setup in "Start coding".
Create tmux detached (`tmux new -d -s codex -c ~/project`) rather than
attaching. Reuse the session if it already exists. Do not launch
interactive Codex. If `exeuntu configure codex` reports `existing user
config`, leave `~/.codex/config.toml` alone and do not sign in or out of
ChatGPT; ask the owner if this prevents setup. Verify from ~/project with
`codex exec -m gpt-6-luna "Reply with exactly: OK" </dev/null` and check
`tmux has-session -t codex`. Skip the later optional instructions and FAQ.
Finish with the SSH command from "Take a break", using this VM's name,
and tell the owner to run `codex` inside it.

Finish with the URLs I should open.

Also at /deploy/codex/prompt.txt. The recipe it follows is /deploy/codex.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-codex
ssh my-codex.exe.xyz

On the VM, connect Codex to the LLM integration, make a project folder, and open a tmux session. The project is a Git repository, so you can review and undo whatever Codex changes:

exeuntu configure codex
git init ~/project
tmux new -A -s codex -c ~/project

Inside that session, start Codex:

codex

The first time, Codex asks whether to trust the project folder. Choose Trust and continue, then give it a small task. For example:

Build a tiny website for a sandwich critic with strong opinions.

That's the setup. Your files live in ~/project.

Take a break#

Press Ctrl-b, then d to detach. Codex keeps working on the VM when you disconnect. On your computer, use this command to hop back in:

ssh -t my-codex.exe.xyz 'tmux new -A -s codex -c ~/project'

A VM restart ends the running session, but not your saved work. Reconnect and run codex resume --last from your project's folder on the VM to pick up its last conversation.

Loosen the leash#

Out of the box, Codex edits files in your project freely but asks before it reaches the internet or touches anything outside the folder. On a laptop, that's a sensible default. On a VM you can copy and throw away, you may prefer fewer questions: type /permissions in Codex and choose Full Access. It can then install packages, start servers and use anything this VM can reach, including integrations you've attached.

Tip

Before a big unattended job, take a copy of the VM with ssh exe.dev cp my-codex my-codex-backup on your computer. If the job goes sideways, carry on from the copy.

Make yourself at home#

  • Pick a model: type /model in Codex, or start it with codex -m gpt-6-luna for quick, cheap work. exe.dev keeps a list of available models and prices.
  • Bring your code: connect a GitHub repo, clone it onto the VM, and run codex from its directory. Use that folder instead of ~/project in the commands above.
  • Peek at your app: ask Codex to serve it on 0.0.0.0:8000, then open https://my-codex.exe.xyz/. It's private by default. More about previews.
  • Script it: codex exec "Summarize the TODOs in this repo" runs one task without the interactive screen and prints the answer. Add --sandbox workspace-write to let it edit files.

For Codex's own features, head to OpenAI's Codex CLI docs.

Frequently asked questions#

Can I use my ChatGPT plan instead?

Yes, two ways. Either way, first turn on device code login in your ChatGPT security settings. To keep your ChatGPT login off the VM, connect your ChatGPT account to exe.dev and attach the LLM integration that uses it to this VM. Then, in ~/.codex/config.toml, change base_url to that integration's address, such as https://chatgpt-llm.int.exe.xyz/v1. Or sign in on the VM itself: delete the model_provider = "exe-llm" line from that file, run codex login --device-auth, and open the link on your computer.

What if the setup command doesn't work?

If it says existing user config, it has left your ~/.codex/config.toml alone. That's normal once you've used Codex, which saves its own settings there. Run codex doctor on the VM to see which provider and model Codex will use. When you add top-level settings to that file, put them above the [model_providers."exe-llm"] line, or TOML files them under that section. The LLM integration docs show the full configuration.

How do I update Codex?

Codex shows a banner when there's a new release. On the VM, run sudo exeuntu update codex, then reopen your last chat with codex resume --last. See updating coding agents to pin a version.

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-codex my-codex-backup on your computer (choose a free backup name). To use that copy, connect with ssh my-codex-backup.exe.xyz; your files and Codex history are there. Reattach any VM-specific integrations.

Updated Oct 17, 2026 · tested end to end Oct 17, 2026 · Markdown · manifest.json · Something wrong? Tell us