Learning resourcesReviewed · OpenAI

Codex environment variables

This reference page lists the environment variables read by OpenAI's Codex command-line tool, IDE extension, app-server and standalone installers, for developers and administrators configuring shells and automation. It covers only stable public variables rather than every setting or provider secret. It documents state locations, installer controls, authentication, certificate bundles and logging, including defaults and precedence rules.

Researched 15 Nov 2026

In short.

This reference page lists the environment variables read by OpenAI's Codex command-line tool, IDE extension, app-server and standalone installers for developers and administrators configuring shells and automation, but leaves complete authentication and provider setup to linked pages. It explains storage paths, unattended installation, credentials, workload identity, custom certificates and logging. Supported release ranges and service costs are not stated, and runtime behavior has not been assessed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete selected environment-variable page at its exact source address: core locations, standalone installer variables, authentication and network variables, diagnostics, examples and scope notices. Linked pages, the documentation index and installer script contents are excluded. No commands, installers or Codex behavior were executed or tested.

The overview

Identity

The resource is the Codex documentation page titled Environment variables at [https://learn.chatgpt.com/docs/config-file/environment-variables.md]. The page covers variables used by the Codex command-line interface (CLI), IDE extension, app-server, TypeScript SDK and standalone install scripts. It describes stable public variables that Codex reads directly and distinguishes their role from durable settings stored in config.toml.

Assessment

The page is useful when you already know which configuration problem you need to solve: relocating state, automating installation, supplying credentials or diagnosing a failure. Its strongest practical details are explicit defaults, consumer-specific applicability and precedence rules. A complete installation or authentication tutorial requires additional documentation.

Users

Developers writing automation can use the authentication and installer entries. Administrators handling corporate certificates or workload identity can use the network and identity entries. People troubleshooting the CLI or app-server can use the logging guidance.

For beginners, an environment variable is a named value supplied through the shell to a program. The examples assume familiarity with shell commands and paths; the page does not teach those foundations.

Capabilities

CODEX_HOME controls the root for configuration, authentication state, logs, sessions, skills and standalone package metadata. CODEX_SQLITE_HOME controls SQLite-backed state. CODEX_INSTALL_DIR changes the visible command location, while CODEX_NON_INTERACTIVE makes the standalone installer accept default prompt responses.

The authentication entries cover API keys, access tokens and workload identity. OPENAI_WORKLOAD_IDENTITY_CONTEXT supplies bounded JSON identifiers for audit attribution without changing authentication or authorization. Certificate variables select a PEM certificate-authority bundle, and RUST_LOG controls logging filters and verbosity.

Using it

Requirements

A custom CODEX_HOME directory must already exist. OPENAI_IDENTITY_TOKEN_FILE requires an absolute path to a file containing the current OIDC token or SPIFFE JWT-SVID. Custom certificate settings require a PEM CA bundle.

Authentication requires credentials or an appropriately configured workload identity. The selected page does not establish account eligibility, credential issuance steps, minimum Codex versions or a complete operating-system support matrix.

Mechanism

The page positions environment variables as shell-scoped controls for overrides, secrets, installer behavior and diagnostics. Applicability varies across the CLI, IDE extension, app-server, SDK and installers.

Precedence is setting-specific: the sqlite_home configuration option overrides CODEX_SQLITE_HOME, and CODEX_CA_CERTIFICATE overrides SSL_CERT_FILE. Relative SQLite paths resolve from the current working directory. Custom model-provider secret names are selected through env_key in provider configuration rather than a fixed Codex variable name.

Setup

The default state root is ~/.codex. The standalone command defaults to ~/.local/bin on macOS and Linux, and %LOCALAPPDATA%\Programs\OpenAI\Codex\bin on Windows. Changing CODEX_INSTALL_DIR leaves the standalone package cache under CODEX_HOME/packages/standalone.

For scripted installation or updates, CODEX_NON_INTERACTIVE accepts 1, true or yes. It uses default prompt responses, and the page advises against using it for first-run setup. For non-interactive API authentication, the page recommends setting CODEX_API_KEY inline for the intended command instead of across the whole job when repository-controlled code runs.

Example

For interactive troubleshooting, the page shows RUST_LOG=debug codex -c log_dir=./.codex-log followed by tail -F ./.codex-log/codex-tui.log. The documented purpose is to enable debug logging, explicitly request a plaintext log and follow that file.

It also supports targeted filters such as codex_core=debug,codex_tui=debug. The page says codex exec prints diagnostic messages inline and defaults to error-level output. These examples were not executed.

Assessment & evidence

Limitations

The reference excludes internal development variables, test variables and provider-specific secret names chosen through env_key. Its installer controls apply specifically to the named standalone installation scripts.

Linked authentication, provider, filesystem and installation materials are outside the selected page. Their contents, installer behavior and compatibility with particular Codex releases have not been assessed.

Reasoning

The documented precedence and applicability details make this reference especially useful for diagnosing why a setting has no effect. For example, a configured sqlite_home can explain why changing CODEX_SQLITE_HOME does not change the database location. An explicit log_dir is also necessary when the goal is a plaintext interactive log.

Alternatives

The page identifies config.toml as the route for durable settings. It also shows a command-line configuration override through -c log_dir=./.codex-log and directs custom providers to env_key for selecting a secret variable. These offer different configuration routes within Codex; the page provides no comparison with other tools or guides.

Evidence

The complete selected page at [https://learn.chatgpt.com/docs/config-file/environment-variables.md] supplies variable tables, explanatory notes and shell examples. It supports statements about documented names, defaults and precedence, but provides no runtime test results or performance measurements.

Access & freshness

Costs

The page gives no pricing for Codex access, API usage, accounts or model providers. Those costs are unknown from this source. Configuration instructions do not establish that the associated services are free.

Rights

The selected page contains no explicit documentation license or redistribution terms. Permission to redistribute the page or linked installer scripts is therefore not established by this evidence.

Freshness

The source capture is dated 15 November 2026 at 00:34:59 UTC. The page supplies no publication date, last-update date or applicable Codex release range. Its description of these variables as stable does not establish compatibility with every installed version.

Actions

Choose whether the setting belongs in durable configuration or the shell running the command, then check the variable's listed consumers and precedence. Ensure a custom CODEX_HOME exists before using it.

Use non-interactive installation when accepting default answers is intended. Follow the page's narrow credential-scoping advice for automation, and set log_dir explicitly when you need a plaintext interactive log. Consult the linked authentication or provider guides for setup details absent here.

Evidence for this report

selected-page.txtselected · checked 2026-11-15