Configuration Guide¶
Environment Variables¶
All configuration is done through environment variables. Create a .env file or set system environment variables directly.
Anthropic API Configuration¶
Required Configuration:
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxx
Optional Configuration (for custom API endpoints):
ANTHROPIC_BASE_URL=https://api.anthropic.com
ANTHROPIC_API_VERSION=2023-06-01
MiniMax Configuration¶
If using MiniMax as a model provider, configure as follows:
ANTHROPIC_BASE_URL=https://api.minimaxi.chat/v1
ANTHROPIC_API_KEY=your_minimax_api_key
Serper.dev Web Search¶
Enable Serper.dev as a web search engine:
SERPER_API_KEY=your_serper_api_key
Note: If not configured, Anthropic's native search functionality will be used.
Disable Interleaved Thinking¶
To disable the model's interleaved thinking feature:
ANTHROPIC_DISABLE_INTERLEAVED_THINKING=true
Other Configuration¶
# Runtime Environment
NODE_ENV=development|production
# Log Level
LOG_LEVEL=debug|info|warn|error
# Debug Mode
DEBUG=*
Configuration Priority¶
Environment variable loading priority (from high to low):
- System Environment Variables - Variables set directly in the system
- .env File -
.envfile in project root - .env.local - Local environment file (not committed to Git)
- Default Values - Default values in code
Configuration File Locations¶
.env File¶
Create a .env file in the project root:
open-claude-code/
├── .env # Main configuration file
├── .env.local # Local overrides (not committed)
├── .env.example # Example configuration (committed)
└── ...
.gitignore Configuration¶
Ensure the following files are in .gitignore to avoid committing sensitive configurations:
.env
.env.local
.env.*.local
Common Configuration Scenarios¶
Scenario 1: Local Development¶
ANTHROPIC_API_KEY=your_api_key
NODE_ENV=development
LOG_LEVEL=debug
Scenario 2: Production Environment¶
ANTHROPIC_API_KEY=your_prod_api_key
NODE_ENV=production
LOG_LEVEL=info
SERPER_API_KEY=your_serper_key
Scenario 3: MiniMax + Serper¶
ANTHROPIC_BASE_URL=https://api.minimaxi.chat/v1
ANTHROPIC_API_KEY=minimax_key
SERPER_API_KEY=serper_key
NODE_ENV=production
Scenario 4: Offline Mode (Local Tools Only)¶
ANTHROPIC_API_KEY=placeholder_key
# Use only local tools like file operations, Git, etc.
Verify Configuration¶
1. Check Environment Variables¶
# Display all configured Anthropic-related variables
env | grep ANTHROPIC
2. Test API Connection¶
bun run cli advisor "test connection"
3. View Configuration Logs¶
Enable debug mode to view configuration loading process:
DEBUG=* bun run cli --version
Troubleshooting¶
Issue: Invalid API Key¶
Solution: 1. Verify the key is correctly copied 2. Check if the key has expired 3. Ensure the key has proper permissions 4. Review API documentation to confirm key format
Issue: Web Search Not Working¶
Solution:
1. Verify SERPER_API_KEY is configured
2. Check if API quota is exhausted
3. If using custom URL, check network connection
Issue: Slow Model Response¶
Solution:
1. Check network connection
2. If using custom endpoint, verify endpoint availability
3. Try disabling interleaved thinking: ANTHROPIC_DISABLE_INTERLEAVED_THINKING=true
Best Practices¶
- Don't Commit Sensitive Configurations
- Use
.env.localto store local overrides -
Ensure
.envand.env.localare in.gitignore -
Use Configuration Examples
- Commit
.env.exampleas a configuration template -
New developers can start from the example file
-
Environment Isolation
- Use different API keys for different environments (development, testing, production)
-
Separate configurations using
.env.development,.env.test, etc. -
Document Configuration Changes
- Record new configuration options in CHANGELOG
- Update configuration instructions in documentation
Next Steps¶
- Check Installation Guide to complete basic setup
- Browse Development Environment to understand development workflow
- Read Architecture Documentation to understand project design