Codex CLI Configuration
Codex CLI is customized through configuration files. This section describes the structure of the config file, the various configuration options, and how to adjust them to your needs.
Config file locations
Codex's configuration file is located under the user's home directory at ~/.codex/config.toml:
~/.codex/config.toml
If the file does not exist, you need to create it manually. On first launch, Codex creates a default configuration file.
After changing the config, you need to restart Codex for it to take effect.
Configuration file structure
A complete configuration file may contain the following sections:
Complete configuration example
~/.codex/config.toml
Basic settings
[model]
default = "o4-mini" # the model used by default
TUI settings
[tui]
alternate_screen = "auto" # alternate screen mode: auto/always/never
Skill configuration
[skills]
enabled = true
Feature flags
[features]
js_repl = false # whether to enable the JavaScript REPL
MCP server configuration
[mcp_servers]
Notification settings
[notify]
enabled = false
Model Configuration
Codex supports multiple models, which you can choose according to task needs:
| Configuration Item | Type | Description |
|---|---|---|
model.default |
string | The model used by default |
model.reasoning_effort |
string | Reasoning effort: low/medium/high |
Available models
Models available in Codex CLI include:
o4-mini- Fast and efficient, suitable for simple taskso4-mini-high- A higher-reasoning version of o4-minio3- Powerful reasoning capabilityo3-pro- A professional version of o3
Different models have different speeds and prices; choosing the right one can optimize both experience and cost.
TUI configuration
Terminal user interface settings:
| Configuration Item | Type | Description | Default value |
|---|---|---|---|
tui.alternate_screen |
string | Alternate screen mode: auto/always/never | auto |
tui.width |
number | Terminal width | 0 (automatic) |
tui.height |
number | Terminal height | 0 (automatic) |
Alternate screen mode description
auto- Auto-detect; automatically disabled in terminal multiplexers such as Zellijalways- Always use the alternate screen (default experience)never- Never use the alternate screen (preserve scrollback history)
Runtime overrides
You can override these settings at runtime via command-line arguments:
Override config from the command line
Disable alternate screen mode
codex
--no-alt-screen
Skill configuration
Skills are Codex's extension mechanism, allowing you to customize workflows:
| Configuration Item | Type | Description |
|---|---|---|
skills.enabled |
boolean | Whether to enable the skill system |
skills.directory |
string | Skill file directory |
Customize the skill directory
Configure the skill directory
[skills]
enabled = true
directory = "~/my-codex-skills"
MCP server configuration
MCP (Model Context Protocol) servers allow Codex to integrate with external tools and services:
Configure MCP servers
[mcp_servers.docs]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "./docs"]
Tool permission configuration
[mcp_servers.docs.tools.search]
approval_mode = "approve"
MCP tool permissions
You can set permissions individually for each MCP server's tools:
approve- Auto-approve, no promptingdeny- Auto-rejectask- Ask before each execution (default)
Be careful when configuring MCP servers; make sure to enable only tools you trust.
Feature flags
Enable or disable specific Codex features:
| Configuration Item | Type | Description |
|---|---|---|
features.js_repl |
boolean | Enable the JavaScript REPL |
features.js_repl_tools_only |
boolean | Restrict to only the js_repl tool |
JavaScript REPL configuration
Enable the JavaScript REPL
[features]
js_repl = true
You can also specify the Node.js path:
Specify the Node.js path
js_repl_node_path = "/usr/local/bin/node"
Notification configuration
Codex can send notifications when a task completes:
| Configuration Item | Type | Description |
|---|---|---|
notify.enabled |
boolean | Enable notifications |
Configure notification hooks
You can configure a custom notification script via environment variables:
CODEX_NOTIFY_HOOK=/path/to/your/notify-script.sh
SQLite state database
Codex uses SQLite to store internal state:
| Environment Variables | Description | Default value |
|---|---|---|
CODEX_SQLITE_HOME |
SQLite database directory | Same as CODEX_HOME |
Configure the SQLite directory
export
CODEX_SQLITE_HOME
=
/
path
/
to
/
sqlite
codex
Log configuration
Codex uses Rust's env_logger, and you can configure the log level:
Configure log output
View logs
tail
-f
~
/
.codex
/
log
/
codex-tui.log
Set the logging level
RUST_LOG
=
codex_core
=info,
codex_tui
=info,
codex_rmcp_client
=info codex
| Log level | Description |
|---|---|
error |
Show errors only |
warn |
Show warnings and errors |
info |
Show general info, warnings, and errors |
debug |
Display debugging information |
trace |
Show detailed trace information |
By default, the log level in TUI mode is info, while the default in non-interactive mode (exec) is error.
Plan mode configuration
Configure Codex's behavior in plan mode:
Configure plan mode
Set the default reasoning effort for plan mode
Possible values: low/medium/high/none
plan_mode_reasoning_effort = "medium"
Common configuration examples
Basic configuration
Minimal configuration
Use default settings
Codex already provides sensible defaults
High-performance configuration
Performance-optimized configuration
[model]
default = "o4-mini"
[tui]
alternate_screen = "always"
[features]
js_repl = true
Developer configuration
Developer configuration
[model]
default = "o4-mini"
reasoning_effort = "high"
[tui]
alternate_screen = "never"
[skills]
enabled = true
directory = "~/codex-skills"