Aider Configuration Guide
Chapter 1 - Installation Guide
macOS Installation
Method 1: Using Homebrew (Recommended)
bash
brew install aider-chatMethod 2: Using pip
bash
pip install aider-chatMethod 3: Using pipx (Recommended)
bash
pipx install aider-chatWindows Installation
Method 1: Using pip
powershell
pip install aider-chatMethod 2: Using pipx
powershell
pipx install aider-chatMethod 3: Installing from Source
powershell
git clone https://github.com/paul-gauthier/aider.git
cd aider
pip install -e .Installation Verification
After installation, verify that Aider is successfully installed:
bash
aider --versionChapter 2 - TokenSwitch API Relay Configuration
Environment Variable Configuration
macOS/Linux Configuration
Edit the ~/.bash_profile or ~/.zshrc file:
bash
# Write configuration
echo 'export OPENAI_API_KEY="your_token"' >> ~/.zshrc
echo 'export OPENAI_API_BASE={{apiUrl}}' >> ~/.zshrc
# Apply changes immediately
source ~/.zshrcWindows Configuration
Execute in PowerShell:
powershell
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "your_token", "User")
[Environment]::SetEnvironmentVariable("OPENAI_API_BASE", {{apiUrl}}, "User")Or use system environment variables settings.
Complete Startup Parameters
Basic Startup Command
bash
# Using Claude Sonnet 4.6 (Recommended)
aider --model cl-so-4.6
# Using Claude Haiku 4.5 (Lightweight)
aider --model cl-ha-4.5-1001
# Using other Claude models
aider --model openai/claude-3-opus-20250514
aider --model cl-ha-4.5-1001Complete Parameter Table
| Parameter | Description | Example |
|---|---|---|
--model | Specify model | cl-so-4.6 |
--api-key | API key (optional, reads from environment variable by default) | sk-xxx |
--base-url | API base URL | https://neolink.com/api/v1 |
--temperature | Model temperature (0-2) | 0.7 |
--max-tokens | Maximum tokens | 4096 |
--no-auto-commits | Disable auto commits | no value |
--no-dirty | Disable dirty file prompts | no value |
--voice | Enable voice input | no value |
--edit | Enable edit mode | no value |
Recommended Startup Command
bash
# Basic startup (using environment variables, recommended to use Claude Sonnet 4.6)
aider --model cl-so-4.6
# Full configuration example
aider \
--model cl-so-4.6 \
--temperature 0.7 \
--max-tokens 4096 \
--no-auto-commits
# Start with specific folder
aider --model cl-so-4.6 ./srcSupported Models List
The following models can be used through TokenSwitch:
| Model ID | Description |
|---|---|
cl-ha-4.5-1001 | Claude Haiku 4.5 (Lightweight, recommended for quick tasks) |
cl-so-4.6 | Claude Sonnet 4.6 (Balanced performance and cost, recommended) |
openai/claude-3-5-sonnet-20241022 | Claude 3.5 Sonnet (High performance) |
openai/claude-3-opus-20250514 | Claude 3 Opus (Most powerful model) |
openai/gpt-4-turbo | GPT-4 Turbo version |
openai/gpt-4o | GPT-4 optimized version |
openai/gpt-4 | GPT-4 base version |
Chapter 3 - /add Command File Path Considerations
/add Command Basics
The /add command adds files to the current conversation context:
bash
/add filename.py
/add path/to/file.js
/add src/components/*.vuePath Type Explanation
Relative Paths
Relative to the current working directory:
bash
/add utils.py # File in current directory
/add src/main.py # File in src folder
/add ../config/app.yaml # File in parent directoryAbsolute Paths
Full file system paths:
bash
# macOS/Linux
/add /Users/username/project/src/main.py
# Windows
/add C:\Users\username\project\src\main.pyWildcard Matching
Supports glob patterns:
bash
/add src/*.py # All Python files in src directory
/add **/*.js # Recursively match all JS files
/add src/**/*.py # Recursively match all Python files under src
/add tests/test_*.py # Match files starting with test_Windows Path Special Handling
Windows uses backslash \ as path separator:
powershell
# ✅ Correct way
/add src\models\user.py
/add C:\project\src\main.py
# Can also use forward slash (recommended)
/add src/models/user.py
/add C:/project/src/main.pyCommon Path Errors and Solutions
| Error | Cause | Solution |
|---|---|---|
File not found | Incorrect path | Check relative path or use absolute path |
Permission denied | No read permission | Check file permissions |
Path too long | Windows path exceeds 260 characters | Use relative path or enable long path support |
| Chinese path issues | Encoding problem | Use absolute path or check system encoding |
Ignore File Configuration
Create .aiderignore file in project root:
node_modules/
__pycache__/
*.pyc
.git/
.env
build/
dist/
*.logFile Loading Best Practices
- Number of files to load at once: Recommended 5-10 files or fewer
- File size limit: Single file recommended not exceeding 100KB
- Priority order: Load core files first, then dependent files
- Incremental loading: Add files gradually as needed, not loading entire project at once
Chapter 4 - Common Built-in Commands
File Management Commands
| Command | Description | Example |
|---|---|---|
/add | Add file to context | /add src/main.py |
/drop | Remove file from context | /drop src/main.py |
/list | List files in current context | /list |
/ls | Shorthand for /list | /ls |
/files | Show file list and sizes | /files |
Edit and Commit Commands
| Command | Description | Example |
|---|---|---|
/undo | Undo last edit | /undo |
/diff | View all uncommitted changes | /diff |
/commit | Commit changes to Git | /commit -m "message" |
/reset | Reset all changes | /reset |
Session Management Commands
| Command | Description | Example |
|---|---|---|
/clear | Clear conversation history | /clear |
/exit | Exit Aider | /exit |
/help | Show help information | /help |
/history | View command history | /history |
Advanced Commands
| Command | Description | Example |
|---|---|---|
/architect | Switch to architect mode | /architect |
/auto | Auto-fix all files | /auto |
/lint | Run code linter | /lint |
/test | Run tests | /test |
/git | Execute Git commands | /git status |
Special Commands
bash
# Get help
/help # Show all available commands
/? # Same as /help
# Query information
/stats # Show token usage statistics
/version # Show Aider version
# Switch modes
/architect # Architect mode (more detailed planning)
/code # Code mode (default)Chapter 5 - Complete Workflow Examples
Example 1: Creating New Module
bash
# 1. Start Aider
aider --model cl-so-4.6 src/
# 2. Add related files
/add src/models/__init__.py
/add src/models/base.py
# 3. Communicate with AI
Create a new User model with id, name, and email fields
# 4. View changes
/diff
# 5. Commit changes
/commit -m "feat: add User model"Example 2: Refactoring Code
bash
# 1. Add files to refactor
/add src/utils/helpers.py
/add src/utils/validators.py
# 2. Request refactoring
Extract duplicate code in these two files into common utility functions
# 3. View suggested changes
/diff
# 4. Accept and commit
/commit -m "refactor: extract common utility functions"Example 3: Fixing Bugs
bash
# 1. Add related files
/add src/services/auth.py
/add tests/test_auth.py
# 2. Describe the problem
User login fails with error "Invalid token", please check and fix
# 3. Run tests to verify
/test
# 4. Commit the fix
/commit -m "fix: resolve token validation issue in auth service"Chapter 6 - Troubleshooting
Common Problem Solutions
Q1: Cannot Connect to API
Error: Connection refused / Cannot connect to APISolution:
- Check network connection
- Verify
OPENAI_API_BASEis correctly configured - Confirm API key is valid
bash
# Verify environment variables
echo $OPENAI_API_KEY
echo $OPENAI_API_BASEQ2: File Not Found
Error: File not found: xxxSolution:
- Check if relative path is correct
- Test with absolute path
- Confirm current working directory
bash
# Check current directory
pwd
# List files
ls -la src/Q3: Permission Denied
Error: Permission deniedSolution:
bash
# Check file permissions
ls -l filename
# Change permissions
chmod 644 filenameQ4: Windows Path Issues
Solution:
Use forward slash instead of backslash, or use full UNC path:
powershell
# ✅ Recommended
/add src/models/user.py
# Also acceptable
/add src\models\user.pyChapter 7 - Best Practices
Workflow Recommendations
- Always use Git: Ensure all changes are in Git repository
- Incremental file loading: Don't load entire project at once
- Clear requirement descriptions: Provide detailed instructions rather than vague commands
- Verify changes: Check
/diffoutput before committing - Regular commits: Use meaningful commit messages
Performance Optimization
- Loading 5-10 related files at a time works best
- For large projects, have separate conversations for each functional module
- Avoid loading binary or generated files
Maximizing Effectiveness
- Provide sufficient context: Add related test and configuration files
- Use clear English descriptions for requirements
- Use
/architectmode for complex refactoring - Run
/diffbefore Git commits to check all changes
Chapter 8 - Related Resources
Official Links
Quick Reference
Startup Command Reference
bash
# macOS/Linux - Recommended to use Claude Sonnet 4.6
aider --model cl-so-4.6
# Windows PowerShell
aider --model cl-so-4.6
# Specify working directory
aider --model cl-so-4.6 /path/to/projectCommon Commands Reference
/add file.py # Add file
/drop file.py # Remove file
/list # List files
/diff # View changes
/commit -m "msg" # Commit changes
/undo # Undo operation
/help # Show help