Aider is a terminal-based AI pair programming tool that edits code directly in your local repository and automatically creates Git commits.
Installation
Or with pipx (recommended to avoid dependency conflicts):
Configuration & Launch
Option 1: Environment Variables (Recommended — persists across sessions)
Mac / Linux (zsh)
Mac / Linux (bash)
Windows (PowerShell)
echo 'export OPENAI_API_KEY="sk-your-api-key"' >> ~/.zshrc
echo 'export OPENAI_API_BASE="https://api.elkapi.com/v1"' >> ~/.zshrc
source ~/.zshrc
After setting the variables, navigate to your project and start:
cd your-project
aider --model gpt-4o
Option 2: CLI Arguments (One-off use)
aider \
--openai-api-key sk-your-api-key \
--openai-api-base https://api.elkapi.com/v1 \
--model gpt-4o
Using Anthropic Models
# Set environment variables
export ANTHROPIC_API_KEY = "sk-your-api-key"
export ANTHROPIC_BASE_URL = "https://api.elkapi.com/anthropic"
# Start with a Claude model
aider --model claude-opus-4-5-20251101
Using a .aider.conf.yml Config File
Create .aider.conf.yml in your project root to avoid passing flags every time:
openai-api-key : sk-your-api-key
openai-api-base : https://api.elkapi.com/v1
model : gpt-4o
Common Commands
Inside the Aider interactive session:
Command Description /add <file>Add a file to the current editing context /drop <file>Remove a file from the context /diffShow all code changes made in this session /undoUndo the last AI-generated Git commit /commitCommit current changes /model <name>Switch to a different model /exitExit Aider
Recommended Models
Use Case Recommended Model General coding gpt-4o Complex refactoring claude-opus-4-5-20251101 Fast iteration gpt-4o-mini
Aider automatically commits all changes to Git by default. Start from a clean Git state so you can easily roll back with /undo.