Skip to main content

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.

Project-Level (Local)

Applies only to the current project directory.
Codex/Windsurf only supports system-level configuration

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:
To restore from backup:

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:

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 variables

Regular Backups

CLI creates automatic backups, but keep your own copies of important configs

Test After Changes

Always verify configuration works after manual modifications

Next Steps

Claude Code Config

Detailed Claude Code configuration

Codex Config

Detailed Codex/Windsurf configuration

OpenCode Config

Detailed OpenCode configuration

Examples

Practical configuration examples