Configuration Locations
Claude Code
JSON files in
~/.claude/ or ./.claude/Codex/Windsurf
TOML file in
~/.codex/OpenCode
JSON file in
~/.config/opencode/ or ./Configuration Levels
System-Level (Global)
Applies to all projects on your machine.| Tool | Location |
|---|---|
| Claude Code | ~/.claude/settings.json~/.claude.json |
| Codex/Windsurf | ~/.codex/config.toml |
| OpenCode | ~/.config/opencode/opencode.json |
Project-Level (Local)
Applies only to the current project directory.| Tool | Location |
|---|---|
| Claude Code | ./.claude/settings.json./.claude/settings.local.json |
| Codex/Windsurf | Not supported |
| OpenCode | ./opencode.json |
Environment Variables
The CLI automatically sets these environment variables in your shell configuration file.Claude Code
Codex/Windsurf
OpenCode
Note: Codex/Windsurf and OpenCode share the same
MEGALLM_API_KEY environment variable.Verify Environment Variables
Configuration Priority
When multiple configurations exist, they’re applied in this order (highest to lowest):1
Environment Variables
Highest priority - overrides all file-based configurations
2
Project-Level Config
Second priority - applies only to current project
3
System-Level Config
Default - applies globally across all projects
Backup Files
The CLI automatically creates backup files before modifying configurations:Tool-Specific Configuration
Select your AI tool for detailed configuration information:Claude Code Configuration
JSON configuration, environment variables, and statusline setup
Codex/Windsurf Configuration
TOML configuration and model provider setup
OpenCode Configuration
JSON configuration and API settings
Quick Configuration Checks
Verify All Configurations
Test API Connection
Manual Configuration
If you prefer not to use the CLI, you can configure manually:- Claude Code
- Codex/Windsurf
- OpenCode
Configuration Best Practices
Use Project-Level for Teams
Keep project-specific configurations in version control (without API keys)
Secure API Keys
Never commit API keys. Use
.gitignore and environment variablesRegular Backups
CLI creates automatic backups, but keep your own copies of important configs
Test After Changes
Always verify configuration works after manual modifications

