Codex's environment variables are a powerful but blunt lever: they act globally on the process, so where they are set matters no less than the value. An important reference caveat: OpenAI publishes only the stable public variables that Codex reads directly. Internal development and test switches, as well as arbitrary provider secret names, are not included here - they are not relied on as a documented interface, because they may change without warning.
The main variables concern the location of state and installation. CODEX_HOME sets the root of state - config, auth, sessions, skills, logs - and by default it is ~/.codex. The installers understand CODEX_INSTALL_DIR, changing the location of the visible command, and CODEX_NON_INTERACTIVE, disabling prompts during installation. These three variables appeared in the chapters on installation and removal and determine where the state lives and how a non-interactive install goes.
The diagnostic and provider variables are touched pointwise. RUST_LOG controls the debug logging level and enables verbose output for local diagnostics - with the same caveat that logs may contain the sensitive. Provider and cloud variables configure access to models through the corresponding deployment, but their exact set and semantics are checked against the official provider page rather than carried over by analogy with other tools.
It helps to gather the public variables into a table once. Below is a map: location, installation, diagnostics. It is worth using with the reference's general caveat: the full and exact list of public variables is on the official page, and anything not there is not considered a documented interface. Secrets are set through the environment or a secret store rather than in a committed config, and where a variable is set is chosen as consciously as its value.
| Category | Variable | Purpose |
|---|---|---|
| Location | CODEX_HOME | Root of state (config, auth, sessions, logs); default ~/.codex |
| Installation | CODEX_INSTALL_DIR | Location of the visible command (installers) |
| CODEX_NON_INTERACTIVE | Disable prompts during installation |
| Diagnostics | RUST_LOG | Debug log level (logs are sensitive) |
|---|
| Provider | provider/cloud variables | Model access via a deployment (verify against the official page) |
|---|