Custom GPTs retire: Dec 11, 2026Date announced, hour not (as of Nov 7, 2026). FedRAMP workspaces keep them until Feb 11, 2027; move a GPT to a plugin before then.

17Days23Hours13Minutes19Seconds

Codex Environment Variables

OpenAI's docs list 12 public environment variables for Codex, read Nov 17, 2026, plus OPENAI_API_KEY for image batches. CODEX_HOME moves its whole folder (default ~/.codex), CODEX_API_KEY gives codex exec an API key, CODEX_NON_INTERACTIVE=1 installs without prompts and RUST_LOG=debug turns on logging. Each one with a line to copy.

The environment variable most people need is CODEX_HOME, which moves the folder where Codex keeps its config, sign-in, logs, chats and skills from the default ~/.codex to any folder that already exists, for example export CODEX_HOME="$HOME/work-codex" before you run codex (Environment variables, OpenAI docs, read Nov 17, 2026). OpenAI's page lists 12 public variables, and its image generation page names a 13th; we count them below. The page says durable settings belong in config.toml: the variables are for one shell, a script, an installer or a fault you are chasing.

Next: the installers these variables change, the rules folder that lives under CODEX_HOME or running codex exec in CI with an API key.

Hands typing on a dark laptop with the OpenAI logo beside a cup of coffee, with the words Codex CLI Updates
Hands typing on a dark laptop with the OpenAI logo beside a cup of coffee, with the words Codex CLI Updates OpenAI

All of them, with a line to copy

Variable Read by Default A line to copy (ours)
CODEX_HOME CLI, IDE extension, app server, installers ~/.codex export CODEX_HOME="$HOME/work-codex"
CODEX_SQLITE_HOME CLI and app server state CODEX_HOME export CODEX_SQLITE_HOME="/var/tmp/codex-db"
CODEX_NON_INTERACTIVE The standalone installers false See the install lines under the table
CODEX_INSTALL_DIR The standalone installers ~/.local/bin; on Windows %LOCALAPPDATA%\Programs\OpenAI\Codex\bin See the install lines under the table
CODEX_API_KEY codex exec, review, the TypeScript SDK, remote exec server None CODEX_API_KEY="$KEY" codex exec "summarize the diff"
CODEX_ACCESS_TOKEN CLI, app server, trusted automation None Pipe it to codex login --with-access-token to stay signed in
OPENAI_FEDERATION_RULE_ID Workload identity None Set by your CI's identity setup
OPENAI_IDENTITY_TOKEN_FILE Workload identity None An absolute path to the OIDC token file
OPENAI_WORKLOAD_IDENTITY_CONTEXT Workload identity None Optional JSON for audit labels; it does not affect sign-in
CODEX_CA_CERTIFICATE HTTPS, sign-in and WebSocket clients None export CODEX_CA_CERTIFICATE=/etc/ssl/corp-root.pem
SSL_CERT_FILE The same clients, as a fallback None Used only when CODEX_CA_CERTIFICATE is unset
RUST_LOG CLI and app server error for codex exec RUST_LOG=debug codex -c log_dir=./.codex-log

Those are the 12 on OpenAI's list. The 13th is OPENAI_API_KEY, which OpenAI's image generation page (read Nov 17, 2026) tells you to set when you want Codex to make a large batch of images through the API at API prices instead of from your plan's limits. Variables, defaults and the "Read by" column are from OpenAI's Environment variables page; the example lines are ours, built from the forms OpenAI's page shows (paths such as corp-root.pem and work-codex are placeholders).

The two installer variables go in front of the shell that runs the downloaded script. An unattended install on macOS or Linux, as OpenAI's page gives it:

curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh

The same on Windows PowerShell:

$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex

To put the codex command in another folder, ours: curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALL_DIR="$HOME/bin" sh. The package cache still lives under CODEX_HOME/packages/standalone.

The five that solve real problems

Two separate Codex setups on one machine. Point CODEX_HOME at a second folder and Codex there has its own config, sign-in, history and skills. OpenAI's page warns that "the directory must already exist", so create it first (mkdir -p "$HOME/work-codex"). Its rules folder moves with it, so an allow rule written under one home does not apply under the other. Coding With Chuck's Aug 10, 2026 lesson on Codex configuration uses exactly this for a clean test: a setup script sets CODEX_HOME to a subfolder for that one PowerShell session, so the demo starts from known files with its own user-level config.toml and none of his everyday profile, tools or history.

An API key for a script, not for the whole job. CODEX_API_KEY signs a non-interactive run in with an API key, so usage is billed at API prices. OpenAI's advice is to "set it inline rather than job-wide when running repository-controlled code": put it in front of the one codex exec line, as in the table, so other steps of a CI job cannot read it.

ExamPro's May 14, 2026 lesson on automating Codex walks through the same non-interactive mode: codex exec with a prompt, piped input and output, an ephemeral run that keeps no session, JSON output for jq, and passing a Codex API key so a run does not draw on your subscription, or so several keys can be used side by side; its most common use is a GitHub Actions job.

An install that asks nothing. CODEX_NON_INTERACTIVE=1 (or true, or yes) makes the install script take every default. OpenAI says to use it for scripted installs and updates, "not first-run setup".

A company network that breaks sign-in. Behind a proxy that inspects TLS, point CODEX_CA_CERTIFICATE at your company's root certificate in PEM form. It takes precedence over SSL_CERT_FILE.

A log to send with a bug report. The interactive CLI writes no plain-text log by default. RUST_LOG=debug codex -c log_dir=./.codex-log writes one to ./.codex-log/codex-tui.log, and tail -F ./.codex-log/codex-tui.log follows it. RUST_LOG also takes narrower filters such as codex_core=debug,codex_tui=debug; codex exec prints its messages inline instead of to that file.

What is not on the list

OpenAI's page leaves out internal and test variables on purpose. A key for another model provider has no fixed name: you choose it with env_key in that provider's section of config.toml, and Codex reads whatever variable you named there. Anything you want every time (the model, the sandbox, the approval policy) goes in config.toml, covered on Codex CLI.

Sources

Moments

Codex CLI Setup & Configuration: Which Setting Wins?

Coding With Chuck

  1. Two separate Codex setups on one machine. Point CODEX_HOME at a second folder and Codex there has its own config…

Automating Codex - Non-Interactive Mode, OpenAI API, SDKs & GitHub Actions

ExamPro

  1. ExamPro's May 14, 2026 lesson on automating Codex walks through the same non-interactive mode: codex exec with a…

See also

About this page

Last updated Nov 22, 2026 by the Vi.ki team. Page text CC BY-SA 4.0.

Edit History

Hotkeys

/
Jump to the search box
? or Ctrl + /
Open this list
Esc
Close this list, the photo viewer, or the account menu

Video

Space or K
Play or pause
← →
Back or forward 5 seconds
J L
Back or forward 10 seconds
0 to 9
Go to 0% to 90% of the video
, .
Previous or next frame, while paused
M
Mute or unmute
C
Captions on or off
F
Full screen on or off
A D
Previous or next moment

Photo viewer

← → or A D
Previous or next photo
↑ ↓ or W S
Previous or next photo
Home End
First or last photo
I
Show or hide the photo's info
Z
Clickless on or off: a pointer over a thumbnail shows it
N
Compare with the last photo: back to the one shown before this, and N again comes back
Q
Move the thumbnails to the next edge: top, bottom, left and round
, or Ctrl + ,
Open or close the viewer's settings
V
Clickless pan: a zoomed photo follows the pointer, rather than being dragged
Shift
Browse on or off
B
Show or hide the button bar
T
Show or hide the thumbnails
1
100% zoom on or off
0
Rate the photo as no opinion; again takes the answer back
+ -
Rate the photo a step higher or lower
F
Full screen: the photo alone. F again puts everything back.
Back to top