Overview
Global options can be used with any Codex CLI command. They are processed before subcommands and affect the behavior of the entire CLI session.Configuration Override
string
Override configuration values using key=value pairs. Can be specified multiple times.Examples:Common configuration keys:
model- Override the AI modelsandbox_mode- Control sandbox restrictionsapproval_policy- Set approval modefeatures.<name>- Toggle feature flags
Profile Selection
string
Select a configuration profile from config.tomlExample:Profiles allow you to maintain different sets of configuration for different use cases (development, production, experimental, etc.).
Working Directory
path
Change the working directory before executing the commandExample:
Model Selection
string
Specify the AI model to use for the sessionExample:Common models:
o4-mini- Fast, efficient reasoning model (default)gpt-4.1- Advanced reasoning and codingo3- Advanced reasoning model with extended thinking
Open Source Models
boolean
Use open-source models instead of proprietary modelsExample:
Sandbox Control
enum
Control the sandbox mode for command executionOptions:
workspace-write- Allow writes within the workspace directoryfull-access- Allow full filesystem access (use with caution)
Approval Policy
enum
Set when the agent should ask for approval before executing commandsOptions:
on-request- Ask for approval when the agent requests italways- Always ask before executing any commandnever- Never ask (use with caution)
boolean
Enable fully automatic mode (equivalent to
--ask-for-approval never)Example:boolean
Bypass both approval prompts and sandbox restrictions
Web Search
boolean
Enable web search capabilities for the agentExample:
Image Input
string
Provide image files as input (comma-separated paths)Example:
Directory Context
string
Add directories to the agent’s context (can be specified multiple times)Example:
Version Information
boolean
Display the Codex CLI versionExample:
boolean
Display help informationExample:
Combining Options
Global options can be combined to create powerful workflows:Order of Precedence
When the same option is specified in multiple places, Codex uses this priority:- Command-line flags (highest priority)
-cconfig overrides- Environment variables
- Profile settings (from
--profile) config.tomlbase configuration- Built-in defaults (lowest priority)
Related
Feature Flags
Enable experimental features
Configuration
Learn about config.toml