SSD Nodes Learn Hosting plans →
Guides Matt ConnorBy Matt Connor

Does Codex Train on Your Code?

OpenAI's training rules for Codex change with how you sign in. See which terms apply to you, and the second setting that the ChatGPT toggle does not change.

Does Codex train on your code?

Does Codex train on your code? It depends on how you sign in. On a personal ChatGPT plan, OpenAI may use your Codex conversations to improve its models unless you turn training off. On a Business, Enterprise or Edu workspace, and with an API key, OpenAI does not train on your data by default.

Three routes lead to the same tool, and each route has its own terms. A second setting, called Include environments, sits outside the normal ChatGPT toggle. Turning training off also does not stop your prompts from reaching OpenAI, because the CLI still sends model requests to OpenAI. This guide covers each route, then uses the Codex command-line interface (CLI) on a virtual private server (VPS) as the worked case. Every statement about OpenAI's policy comes from pages read on 4 November 2026. If you use both tools, this guide is the pair of whether Claude trains on your code.

Personal plans: the ChatGPT data control decides

OpenAI's help article Using Codex with your ChatGPT plan answers this for Pro and Plus in one line:

Conversations may be used to improve models unless you turn off training in ChatGPT data controls.

The same article says how far that control reaches:

Your ChatGPT training data controls apply to content processed through Codex, including screenshots taken by Computer Use.

OpenAI's data controls article adds the default. On personal Free, Plus and Pro workspaces, data sharing is on until you change it. So a new personal account that has never opened this menu is sharing data.

The toggle is called Improve the model for everyone. Turning it off keeps your chat history. For a signed-in user, it applies to the account across web and mobile. That matters for Codex, because the help article applies these controls to content processed through Codex. So you change training in your account, not on each server.

Two exceptions survive the toggle on a personal plan: thumbs feedback, and Trusted Access sessions. Both are covered in the section on what training controls do not change.

Business, Enterprise and Edu: no training by default

The FAQ in article 11369540 states the rule for business users:

By default, OpenAI does not use any inputs or outputs from our products for business users, including ChatGPT Business, ChatGPT Enterprise, and the API, to improve our models.

OpenAI's training article gives the same default for ChatGPT Edu, and for ChatGPT for Academic Researchers workspaces. The Codex pricing page lists "No training on your business data by default" under Business.

Note the words "by default". On these plans, thumbs up or down does not permit training on the conversation, unless the organization has signed a separate agreement that allows it. If you work inside a company, ask your admin whether such an agreement exists.

API keys: no training unless you opt in

OpenAI's API data page says data sent to the API is not used to train or improve OpenAI models unless you explicitly opt in. A Codex session signed in with an API key follows the API organization's data-sharing settings, so this rule applies.

The opt-in belongs to the organization, not to you. Article 11369540 says API organization owners can choose to share API data with OpenAI. It also says this setting is not available to some organizations, including Enterprise and customers with Zero Data Retention. So if you use a key that your employer or client owns, the answer depends on a setting that you may not be able to see. Ask the organization owner.

Which terms is your Codex session actually under?

OpenAI's authentication page says it directly: "Your sign-in method also determines which admin controls and data-handling policies apply." The same codex binary on the same server can sit under different terms after one login command.

  • ChatGPT sign-in, personal plan: the ChatGPT Terms of Use and Privacy Policy apply, and your ChatGPT data controls decide on training.
  • ChatGPT sign-in, Business, Enterprise or Edu workspace: the services agreement for that workspace applies. Usage follows your workspace permissions, plus ChatGPT Enterprise retention and residency settings where you have them.
  • API key: usage follows your API organization's retention and data-sharing settings. Billing is standard API pricing, not your included plan credits.

The Terms section of article 11369540 sets out the first two routes. Codex cloud needs a ChatGPT sign-in, so a cloud task cannot run under the API route. For how the plan route works day to day, see using Codex with a ChatGPT subscription.

To see which route a server uses, run this:

codex login status

The command prints the active authentication mode and exits with 0 when you are logged in. A non-zero exit code means it did not find a login for this user.

The separate Include environments setting

This setting is easy to miss. OpenAI's training article says:

Codex has a separate Include environments setting in Codex settings for allowing training on full environments.

The next sentence is the important one: "Changing your settings in ChatGPT or the Privacy Portal does not change that setting." The data controls article says it decides whether additional context from your Codex environments can be used to train OpenAI models.

So you can turn off the ChatGPT toggle, and this setting keeps whatever value it had. Check the two separately. The training article links to Codex settings at chatgpt.com/codex/cloud/settings/general. That page needs a login, and we did not open it.

The OpenAI pages we read do not state the default value of this setting. They also do not say which plans it applies to, or whether Business, Enterprise and Edu workspaces show it. Do not assume a value. Open the page and read it.

The Hacker News report: what it shows and what it does not

On or around 3 November 2026, a text post on Hacker News appeared with the title "OpenAI seems to be silently re-enabling model training on Codex chats". The author says a company had disabled data sharing in Codex, then found it turned on again for several coworkers.

This is a report, not a finding. When we read the thread on 4 November 2026, it had about 150 comments. Some commenters said their setting had changed. Others checked and found theirs still off. No commenter was marked as OpenAI staff. We found no OpenAI statement, changelog entry or help article that says the setting was turned back on. The post also does not say which setting it means: the ChatGPT toggle or Include environments.

So the cause is unknown. The useful response takes little time: check your own settings, and write down what you find.

How to check your settings, and when to look again

Repeat these steps yourself. Do not rely on a value you set months ago.

  1. In ChatGPT, open your account menu, then Settings, then Data controls. On mobile, open the sidebar, tap your profile icon, then Data controls. Read the state of Improve the model for everyone.
  2. Open Codex settings at chatgpt.com/codex/cloud/settings/general and read the state of Include environments.
  3. On each server, run codex login status to confirm which route that machine uses.
  4. Write the date and both values in a note. A dated note lets you show later that a value changed.

What the Privacy Portal request does differently. The training article gives you a second way to opt out: select Do not train on my content in the Privacy Portal. It says either route covers ChatGPT conversations and Codex tasks. The articles state no difference between the two routes, only a limit they share: neither one changes Include environments. We could not open the portal itself, and the help articles do not say how its request differs in scope, or what it does to past conversations. Read the portal's own wording before you rely on it for old chats.

When to look again. Check after any of these events:

  • You change plan, or you move between a personal account and a workspace.
  • You log in to a new machine, or you switch between ChatGPT sign-in and an API key.
  • OpenAI changes its terms, or you read a new report like the one above.
  • A month has passed since your last note.

What training controls do not change

A training control decides what OpenAI may learn from. It does not decide what OpenAI receives.

Your prompts still leave the machine. Article 11369540 says "Local workflows run on your device; cloud tasks run in OpenAI-managed environments." That line is about where work runs. It does not mean your prompts stay local, because the CLI sends model requests to OpenAI. OpenAI's security page says the agent runs with network access turned off by default. It also says the network proxy filters programs inside the local command sandbox, but not the client's model and authentication requests. So the sandbox limits the commands Codex runs. It does not limit the requests that Codex itself sends to the model.

We found no OpenAI page that lists which files go into each request. Plan for the safe case: anything Codex reads, and any command output it sees, can become part of a request. A secret you type into a prompt is part of the request too. See how to keep secrets out of AI agents for ways to avoid this.

Thumbs feedback overrides your opt-out on personal plans. The training article says that if you submit thumbs up or down, "we may use the entire conversation associated with that feedback to improve our models, even if you have opted out of model training." One click can make a whole conversation eligible.

Trusted Access sessions are an exception on personal accounts. The data controls article names Trusted Access programs such as Daybreak Blue. That same article says that during Daybreak sessions on a personal account, OpenAI may use content from your interactions to improve its models even when the toggle is off. The toggle still applies to activity outside those sessions.

Analytics are a separate channel. OpenAI's advanced configuration page says Codex periodically sends a small amount of anonymous usage and health data back to OpenAI by default. It says these metrics contain no personally identifiable information. The security page says "Telemetry is off by default." These two sentences describe different things, so they do not conflict. The second one refers to OpenTelemetry (OTel) export of logs and traces, which goes to a collector you configure. The first refers to built-in metrics. For a wider view, read what coding agent telemetry sends.

How long does OpenAI keep your Codex data?

There is no single number. The period depends on the route, and on which data you mean.

  • Deleted Codex chats in the ChatGPT app: scheduled for permanent deletion within 30 days. There are two exceptions: data OpenAI must keep for security, safety or legal reasons, and content already de-identified and disassociated from your account, if you allowed model improvement. This is a deletion window. It does not mean OpenAI keeps data for only 30 days.
  • API abuse monitoring logs: kept for up to 30 days, and possibly longer if the law requires it, or to protect the services or third parties from harm.
  • Responses API application state: the API data page gives a 30-day default. That page does not say how Codex sets the store option, so do not assume a value for your sessions.
  • Codex cloud tasks: the cloud environments page says saved VM (virtual machine) state is recoverable for up to seven days after you last start a turn or resume the task. OpenAI says this is a recovery window, not a conversation-history retention period.

Zero Data Retention (ZDR) and Modified Abuse Monitoring exclude customer content from the abuse monitoring logs on the API, and both need approval from OpenAI. We could not confirm from an open page how ZDR applies to the Codex CLI under ChatGPT Enterprise. We also found no stated retention period for cloud tasks on any plan. The admin setup page says local computer access with Work Cloud "does not provide strict zero data retention." If a contract depends on these answers, ask OpenAI and check your admin console.

What /feedback sends

The /feedback command is on by default in local clients. OpenAI's slash command page says it opens a dialog to submit feedback and optionally include logs. No page we opened says exactly what it uploads, or whether a report counts as the feedback in the training article. Treat a report with logs as content that leaves the server, and read the dialog before you submit. You can turn the command off, as the VPS section shows. After that, /feedback shows a disabled message and Codex rejects submissions.

The local copy: what Codex keeps in ~/.codex

Codex keeps its own records on your server. Codex stores local state under CODEX_HOME, which defaults to ~/.codex. OpenAI's environment variables page says this root holds config, auth, logs, sessions and skills.

  • config.toml holds your settings.
  • history.jsonl holds session transcripts, unless you turn history off.
  • auth.json holds your login if you use file storage. OpenAI calls it a plaintext file, so protect it like a password.
  • log/ is the default log directory.

On a server with several users, or on a client's machine, these files matter as much as any cloud setting. A transcript can hold whatever you typed, including a secret.

Lock down the Codex CLI on a VPS

Run these steps as the normal user who will run Codex. Use the installer from OpenAI's CLI page, then log in. OpenAI recommends device code login, currently in beta, for remote or headless machines.

curl -fsSL https://chatgpt.com/codex/install.sh | sh
codex login --device-auth
codex login status

The last command should name the mode you expect. To use the API route, log in with a key instead:

printenv OPENAI_API_KEY | codex login --with-api-key

This passes the key to codex login through standard input. Some features that rely on ChatGPT workspace access or cloud services are limited or unavailable on this route.

Next, turn off the local history, the built-in metrics and /feedback. Add these sections to ~/.codex/config.toml:

[analytics]
enabled = false

[feedback]
enabled = false

[history]
persistence = "none"

If the file already has one of these sections, edit it in place, because a TOML file cannot define the same table twice. None of these lines changes training. They control local records and side channels, and the training controls stay in your account.

history.persistence is documented only for history.jsonl, and the same root also holds sessions and logs. So do not assume the directory stays empty. Run one short session, then look:

ls -la ~/.codex

Now restrict the permissions:

chmod 700 ~/.codex
chmod 600 ~/.codex/auth.json
stat -c '%a %n' ~/.codex ~/.codex/auth.json

stat should print 700 for the directory and 600 for the file. If chmod reports No such file or directory for auth.json, Codex is not using file storage for your login. The cli_auth_credentials_store key in config.toml controls this. It accepts file, keyring, auto and ephemeral. keyring fails if no credential store is available, and ephemeral keeps credentials in memory for the current process only. If you add this key, put it at the top of config.toml, above the first section, because a TOML key below a section header belongs to that section.

For the rest of the server setup, see CLI tools for a coding agent on a VPS.

Remove a client's local data when the job ends

Give each client a separate CODEX_HOME from the start. The directory must exist before you set the variable. The config lives in this root too, so add the sections above to its config.toml.

mkdir -p ~/clients/acme/codex-home
chmod 700 ~/clients/acme/codex-home
export CODEX_HOME=~/clients/acme/codex-home
codex login --device-auth

When the job ends, remove the saved credentials, look at the directory, and then delete it:

export CODEX_HOME=~/clients/acme/codex-home
codex logout
ls -la "$CODEX_HOME"
rm -rf "$CODEX_HOME"
unset CODEX_HOME

codex logout removes saved credentials for both API key and ChatGPT sign-in. Removing a saved copy of an API key does not revoke the key, so the key owner must do that separately. Deleting this directory also changes nothing on OpenAI's side, so the retention periods above still apply to what OpenAI already received. Your own server backups and snapshots may also hold a copy, so include them in your cleanup.

FAQ

Does Codex train on my code if I use a ChatGPT Plus plan?

It can. OpenAI's help article says Pro and Plus conversations may be used to improve models unless you turn off training in ChatGPT data controls. Sharing is on by default for personal Free, Plus and Pro workspaces. Turn off Improve the model for everyone under Settings, then Data controls. Then check Include environments in Codex settings, because the ChatGPT toggle does not change it.

Does turning off training stop my code from going to OpenAI?

No. Training controls decide what OpenAI may use to improve its models. The Codex CLI still sends model requests to OpenAI, and the local network proxy does not filter those requests. Treat any file or command output that Codex reads as content that can leave the machine, and keep secrets out of its reach.

Does a Codex session with an API key get used for training?

Not by default. OpenAI says data sent to the API is not used to train or improve its models unless you explicitly opt in. The opt-in is an organization setting, so a key owned by your employer or client follows that organization's choice. Run codex login status to confirm that the session really uses the key and not a ChatGPT login.

Did OpenAI turn Codex training back on without telling users?

That is not established. A Hacker News post from early November 2026 reports that a data sharing setting came back on for several coworkers. Commenters split on whether they could reproduce it, and as of 4 November 2026 we found no OpenAI statement that confirms it. Check both settings yourself, write down the date and the values, and check again after any plan or sign-in change.

Was this article useful?