# Use your ChatGPT plan

Every computer has Codex preinstalled, as OpenAI publishes it. You sign in to it yourself, in the computer's terminal, with your own ChatGPT plan or OpenAI API key. OpenAI bills your Codex usage to you.

## What is preinstalled

Codex is installed in the `ubuntu-26.04` image at a version we pin and check against OpenAI's signed release before the image is used. Nothing of ours is changed in it, and every way of signing in it offers stays there. We write no settings of ours for it. The **Bring your own agent** page shows the version in the image.

## Sign in

1. Open a computer and its terminal.
2. Run `codex login --device-auth`. It prints a sign in link and a one time code. Open the link in your own browser, sign in to ChatGPT, and enter the code there.
3. Work in `/workspace`. Codex reads `AGENTS.md` there.

Nothing is pasted back into the terminal: Codex, waiting inside your computer, finishes the sign in once OpenAI's page takes the code.

In a chat, the **Your ChatGPT plan** card has a button, **Sign in to your ChatGPT plan in the terminal**, that opens the computer's terminal and types `codex login --device-auth` there for you. The card says Codex is open only once the terminal took the command. From then on the sign in is Codex's own.

Where your workspace has it on, the card also repeats the link and the code Codex printed, so you can tap the link and copy the code on a phone. The card reads them from the terminal in your browser tab only. It offers a link only when it is Codex's own device page, `https://auth.openai.com/codex/device`, and it shows only the first code Codex printed: if something else in the computer prints another code later, the card says so and never shows it. It never sends the link or the code to our API, stores them or keeps them after it closes.

Using an OpenAI API key instead? Run `codex login --with-api-key` in the terminal and give it the key there: Codex keeps it in the same place as a sign in, in memory. A key you set as `OPENAI_API_KEY` in the computer's environment settings is different: it is kept with the computer's settings and given to every command run in the computer, not held in `/root/.codex`.

**Save it for new computers.** Sign in once in **Settings > Your subscriptions** and every new computer you make starts with Codex signed in. See [Your subscriptions](https://docs.foxdeploy.ai/your-plans.md).

## Where your sign in lives

Codex keeps your sign in inside the computer, in `/root/.codex/auth.json`. The folder `/root/.codex` is held in memory only, never on the computer's disk. foxdeploy never reads it:

- the Files tab, the files API, the MCP file tools, uploads and the zip download keep the whole of `/root/.codex` private: it is never listed, read, written or zipped; a zip says how many private files were left out
- OpenAI's key shapes, sign in tokens and refresh tokens are masked in command output, logs, traces and chats that pass through us
- the terminal is a relay: nothing you type or see there is recorded

If you set `CODEX_HOME` to a folder of your own, only its `auth.json` is kept private, and that folder is on the computer's disk, so snapshots carry it. Keep `CODEX_HOME` under `/root/.codex`, or run `codex logout` before you take a snapshot.

The masks are a second line only. A token that a program prints in another form, cut in pieces or encoded, passes any mask; the private folder and this guide are what keep it in.

Your own shell is not restricted. It is your computer: your own commands can read your own file.

Codex can be steered by what it reads. A web page, a file or a command's output can hold instructions that get it to send anything in the computer, your sign in included, out of the computer. Use it only on work and content you trust, and set an allow list in the computer's **Network** settings to limit where it can send anything (the hosts it needs are listed below). `codex logout` ends the sign in in the computer.

## Snapshots and clones

A pause keeps your sign in: the paused computer's memory is kept with the rest of it, and only Resume on the same computer reads it. A stop and start signs you out, because the sign in folder lives in memory only. Run `codex logout` before you pause if you want none of it kept.

**New computer from a snapshot** starts from the disk only and signed out of Codex: after the new computer boots, and before it is handed to you, the sign in folder is emptied. If it cannot be emptied, no computer is made and you are told so. Resume on the same computer keeps the sign in.

Only computers made from the current image keep the sign in in memory. In an older computer, run `codex logout`, sign the session out in your ChatGPT settings, or move to a new computer, before you share a snapshot of it: its disk may still hold old sign in bytes.

## Billing and limits

OpenAI bills your Codex usage to you, under your own plan or key. foxdeploy bills the computer time and storage, as for any computer. Your plan's limits are OpenAI's. A cloud computer does not change them. foxdeploy never shows OpenAI's usage, limits or costs.

## The network

Codex talks to OpenAI straight from your computer. With egress off, Codex cannot work. If you set an allow list, add these hosts:

`chatgpt.com`, `auth.openai.com`, `api.openai.com`

## The chat with Codex

Where your workspace has it on, a chat can run Codex in its computer: open **Use your subscription** at the end of the model menu and choose **ChatGPT (Codex)**, or pick it in **Chat settings** ([Use your Claude plan](https://docs.foxdeploy.ai/claude-code.md) has Claude Code, [Use your Kimi plan](https://docs.foxdeploy.ai/kimi-plan.md) has Kimi Code). Its status is what Codex said in this chat: **Signed in** once a Codex turn here answered, **Not signed in** before that or after Codex said it is not signed in, and **Needs a computer** when the chat has none. foxdeploy runs nothing in your computer to find out. Until Codex has answered here, its button is **Sign in to ChatGPT**, which opens the **Your ChatGPT plan** card; then **Use ChatGPT (Codex)** puts the chat on it. Each message runs Codex in `/workspace` on your own plan, and the next message goes on in the same Codex session. Replies show under the header **Codex**, and no foxdeploy allowance is used.

Codex in a chat works without asking: it changes files and runs commands in this computer without stopping for you, whatever approval mode the chat had. Take a snapshot first if you want a way back. The chat shows what Codex did by name only (it ran a command, it changed files), never the command, the change or its reasoning.

When Codex is not signed in, the chat says so and offers the terminal. When the computer restarted and the earlier Codex session is gone, the chat says so and Codex starts a new one.

## Team workspaces

Everyone in a workspace who can open a computer can use Codex with the sign in inside it. Sign in only in a computer that is yours, or run `codex logout` when you are done. The chat with Codex and the sign in card are off in team workspaces, because a ChatGPT plan is personal. The computer's Logs show who opened a terminal.

## OpenAI's terms

Codex is OpenAI's product and is governed by OpenAI's terms: [OpenAI's Codex documentation](https://developers.openai.com/codex).

Source: https://docs.foxdeploy.ai/chatgpt-plan/
