Aider
Aider: CONVENTIONS.md, .aider.conf.yml and API keys
How do I give Aider project conventions and configure it with .aider.conf.yml and .env?
Write your coding guidelines in a small markdown file such as CONVENTIONS.md and load it read-only with aider --read CONVENTIONS.md, or add read: CONVENTIONS.md to .aider.conf.yml so it always loads. Aider reads .aider.conf.yml from your home directory, the git repo root and the current directory, with later files taking priority. API keys go in environment variables, a .env file, command line switches or the YAML config.
Load a conventions file
Aider has no special conventions format. You create a short markdown file listing your guidelines, for example preferred libraries or type hints, and add it to the chat. Loading it with --read or the /read command marks it read-only, and it is cached if prompt caching is enabled.
CONVENTIONS.md
- Prefer httpx over requests for making http requests. - Use types everywhere possible.
Load for one session
aider --read CONVENTIONS.md useragent.py
.aider.conf.yml (always load)
# one file read: CONVENTIONS.md # or several files # read: [CONVENTIONS.md, anotherfile.txt]
Where .aider.conf.yml lives
- Your home directory.
- The root of your git repo.
- The current directory.
Aider loads these files in that order, and files loaded last take priority. Passing --config with a filename loads only that one config file. Most options can also be set as AIDER_ environment variables, for example AIDER_DARK_MODE=true.
Key options
- model: the model for the main chat.
- auto-commits: commit LLM changes automatically (default true).
- dirty-commits: commit when the repo is found dirty (default true).
- lint-cmd and auto-lint: lint commands per language, and automatic linting after changes (default true).
- test-cmd and auto-test: the test command, and automatic testing after changes (default false).
- read: read-only files to add to every chat.
- yes-always: always say yes to every confirmation (default false).
.aider.conf.yml
model: YOUR_MODEL auto-commits: false dirty-commits: true auto-lint: true test-cmd: YOUR_TEST_COMMAND auto-test: true read: - CONVENTIONS.md
API keys and .env
Aider looks for a .env file in your home directory, the git repo root, the current directory, and any file passed with --env-file, loading them in that order with later files taking priority. A .env file works for every provider and can also hold general aider options.
.env
OPENAI_API_KEY=YOUR_VALUE ANTHROPIC_API_KEY=YOUR_VALUE GEMINI_API_KEY=YOUR_VALUE AIDER_MODEL=YOUR_MODEL
OpenAI and Anthropic keys also have dedicated switches and YAML entries. Other providers use --api-key provider=YOUR_VALUE on the command line or the api-key list in YAML, which sets the matching PROVIDER_API_KEY environment variable.
.aider.conf.yml keys
openai-api-key: YOUR_VALUE anthropic-api-key: YOUR_VALUE api-key: - gemini=YOUR_VALUE - openrouter=YOUR_VALUE
Sources
More on Aider
Other guides
Get the weekly agent stack update
New official MCP servers, spec changes and harness releases, checked against the source. One email a week, no fluff.
Reviewed Oct 6, 2026. Settings change often; the linked vendor docs are the source of truth.