~/.codex/config.toml to customize behavior, model settings, approval policies, and integrations.
Configuration File Location
Codex looks for configuration in the following locations:- Global config:
~/.codex/config.toml- Your personal configuration - Project config:
.codex/config.tomlin your project root - Project-specific settings - Environment variables: Override config values using environment variables
Basic Structure
Here’s a minimalconfig.toml example:
Configuration Sections
Codex configuration is organized into several sections:Core Settings
- Model configuration - Select AI models and providers
- Approval policies - Control when Codex asks for permission
- Sandbox mode - Define execution boundaries
- Authentication - API keys and login methods
Advanced Features
- MCP servers - Connect to Model Context Protocol servers
- Custom instructions - Personalize agent behavior
- Profiles - Switch between different configuration sets
- Network permissions - Control network access for tools
UI & Experience
- TUI settings - Customize terminal interface
- Notifications - Desktop notification preferences
- History - Conversation history settings
- Analytics - Usage data collection preferences
Quick Start
If you don’t have a config file yet, Codex will create one automatically on first run. To create or edit your configuration:Configuration Schema
Codex includes a JSON schema forconfig.toml validation at:
Next Steps
Basic Configuration
Learn about essential configuration options
Advanced Configuration
Explore advanced features and customization
Custom Providers
Configure alternative AI providers
MCP Servers
Integrate Model Context Protocol servers
Configuration Layers
Codex merges configuration from multiple sources in this order (later sources override earlier ones):- Built-in defaults
- Global config (
~/.codex/config.toml) - Project config (
.codex/config.toml) - Profile overrides (when using
--profile) - CLI flags (e.g.,
--model,--approval-policy) - Environment variables