Windsurf is a variant of Codex with enhanced features. The configuration is identical for both.
Configuration File
Location:~/.codex/config.toml
Environment Variable
The configuration references an environment variable for the API key:~/.bashrc(bash)~/.zshrc(zsh)~/.config/fish/config.fish(fish)- PowerShell profile (Windows)
Verify Environment Variable
Manual Setup
If you prefer not to use the CLI:Configuration Options
Model Selection
Change the default model in the configuration:gpt-5- Latest GPT modelgpt-4- GPT-4gpt-4o- GPT-4 Optimizedclaude-opus-4-1-20250805- Claude Opusclaude-sonnet-4- Claude Sonnetgemini-2.5-pro- Gemini Pro- See Models Catalog for full list
Tool Settings
Enable or disable integrated tools:Advanced Configuration
Multiple API Keys
If you need different API keys for different purposes:Using Environment Variables
Switching Configurations
Windsurf-Specific Features
Windsurf includes additional configuration options:Verification
Check Configuration File
Test API Connection
Test Codex/Windsurf
Troubleshooting
Configuration file not found
Configuration file not found
Check if directory exists:Create if missing:Verify file path:
API key not working
API key not working
Check environment variable is set:If empty:Verify key format:
- Must start with
sk-mega- - At least 20 characters
- No extra spaces or quotes
Wrong model provider being used
Wrong model provider being used
Check config file:Verify base_url:Ensure no typos:
TOML syntax errors
TOML syntax errors
Validate syntax:Common TOML mistakes:
Codex/Windsurf not detecting configuration
Codex/Windsurf not detecting configuration
Restart Codex/Windsurf:Check for multiple config files:Verify permissions:
Why System-Level Only?
Codex and Windsurf don’t support project-level configuration because:- Single Instance - Codex/Windsurf runs as a single instance across all projects
- Global Settings - Tool preferences apply system-wide
- Simplified Management - One configuration to manage
Best Practices
Backup Configuration
Keep backup of
config.toml before making changesUse Environment Variables
Store API keys in environment variables, not in config file
Version Control
You can commit
config.toml if env_key is used (no hardcoded keys)Regular Updates
Keep Codex/Windsurf updated for latest features
Comparison: Codex vs Windsurf
Both Codex and Windsurf use the same configuration file location and format.
Next Steps
Claude Code Config
Configure Claude Code
OpenCode Config
Configure OpenCode
Examples
See practical examples
All Agents Config
Configure all CLI and GUI agents
Models Catalog
Browse available models

