### Install Aider with pip Source: https://aider.chat/docs/install.html Standard pip installation, recommended for use within a virtual environment. ```bash python -m pip install -U --upgrade-strategy only-if-needed aider-chat ``` -------------------------------- ### Install Aider via one-liner scripts Source: https://aider.chat/docs/install.html Quick installation for Mac, Linux, and Windows using shell or PowerShell scripts. ```bash curl -LsSf https://aider.chat/install.sh | sh ``` ```bash wget -qO- https://aider.chat/install.sh | sh ``` ```powershell powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex" ``` -------------------------------- ### Start Aider with LM Studio Model Source: https://aider.chat/docs/llms/lm-studio.html Navigate to your project directory and start Aider, specifying the LM Studio model to use. ```bash # Change directory into your codebase cd /to/your/project ``` ```bash aider --model lm_studio/ ``` -------------------------------- ### Quick Start Aider with Copilot Source: https://aider.chat/docs/llms/github.html Navigate to your project directory and start Aider, specifying a Copilot model like 'openai/gpt-4o'. ```bash # change into your project cd /to/your/project # talk to Copilot aider --model openai/gpt-4o ``` -------------------------------- ### Install Aider Locally from Source Source: https://aider.chat/docs/faq.html Clone the repository, navigate to the directory, create a virtual environment, and install aider in editable mode to run from the latest source files. ```bash # Clone the repository git clone git@github.com:Aider-AI/aider.git # Navigate to the project directory cd aider # It's recommended to make a virtual environment # Install aider in editable/development mode, # so it runs from the latest copy of these source files python -m pip install -e . # Run the local version of aider python -m aider ``` -------------------------------- ### Start Ollama Server and Aider Source: https://aider.chat/docs/llms/ollama.html Commands to pull a model, start the Ollama server with an increased context length, and then start Aider in your project directory using an Ollama model. ```bash # Pull the model ollama pull ``` ```bash # Start your ollama server, increasing the context window to 8k tokens OLLAMA_CONTEXT_LENGTH=8192 ollama serve ``` ```bash # In another terminal window, change directory into your codebase cd /to/your/project ``` ```bash aider --model ollama_chat/ ``` -------------------------------- ### Install Aider Source: https://aider.chat/docs/llms/deepseek.html Install the aider package using pip. This is the first step before configuring API keys. ```bash python -m pip install aider-install aider-install ``` -------------------------------- ### Start Aider with OpenAI Compatible API Source: https://aider.chat/docs/llms/openai-compat.html Navigate to your project directory and start aider, prefixing the model name with openai/. This command initiates a session with your configured API. ```bash # Change directory into your codebase cd /to/your/project # Prefix the model name with openai/ aider --model openai/ ``` -------------------------------- ### Install and Launch Aider Browser UI Source: https://aider.chat/docs/usage/browser.html Install the aider-chat package and set your API key before launching the browser UI. Ensure you restart your shell after setting the API key on Windows. ```bash python -m pip install -U aider-chat ``` ```bash export OPENAI_API_KEY= # Mac/Linux ``` ```bash setx OPENAI_API_KEY # Windows, restart shell after setx ``` ```bash aider --browser ``` -------------------------------- ### Install Aider Source: https://aider.chat/docs/llms/gemini.html Install the Aider package using pip. ```bash python -m pip install aider-install aider-install ``` -------------------------------- ### Install Aider with pipx Source: https://aider.chat/docs/install.html Use pipx to install Aider in an isolated environment. ```bash python -m pip install pipx # If you need to install pipx pipx install aider-chat ``` -------------------------------- ### Ask/Code Workflow Example Source: https://aider.chat/docs/usage/modes.html Demonstrates a typical ask/code workflow where initial discussion and planning occur in ask mode, followed by code edits in code mode. The example shows two interactions in ask mode to refine a print statement, followed by two terse commands in code mode to apply the changes. ```bash > /ask What's the best thing to print if we're making a quick little demo program? It sounds like you'd like to write a "Hello, world!" program. That's a very popular phrase to use for small demo programs. > /ask Yes, that's the idea. What are some more creative options? 1. "Greetings, Earthlings!" 2. "Beep boop, I am a computer!" 3. "To code, or not to code, that is the question." 4. "I think, therefore I print." 5. "01001000 01101001!" (Binary for "Hi!") > do 4 hello.py >>>>>>> SEARCH ======= def main(): print("I think, therefore I print.") <<<<<<< REPLACE > ALL CAPS! hello.py >>>>>>> SEARCH print("I think, therefore I print.") ======= print("I THINK, THEREFORE I PRINT!") <<<<<<< REPLACE ``` -------------------------------- ### Start Aider with Grok 3 Models Source: https://aider.chat/docs/llms/xai.html Navigate to your project directory and start Aider using different xAI Grok 3 models. Choose the model that best suits your needs for speed and cost. ```bash # Change directory into your codebase cd /to/your/project # Grok 3 aider --model xai/grok-3-beta # Grok 3 fast (faster, more expensive) aider --model xai/grok-3-fast-beta # Grok 3 Mini aider --model xai/grok-3-mini-beta # Grok 3 Mini fast (faster, more expensive) aider --model xai/grok-3-mini-fast-beta ``` -------------------------------- ### Start Aider with OpenRouter Model Source: https://aider.chat/docs/llms/openrouter.html Navigate to your project directory and start aider using an OpenRouter model. You can specify a provider and model, or list available models. ```bash # Change directory into your codebase cd /to/your/project ``` ```bash # Or any other open router model aider --model openrouter// ``` ```bash # List models available from OpenRouter aider --list-models openrouter/ ``` -------------------------------- ### Update Markdown Documentation Source: https://aider.chat/docs/usage/not-code.html Add an installation section to a README file. ```markdown + ## Installation + ``` + # Homebrew + brew install cool-app-10k + + # PyPI + pipx install cool-app-10k + ``` ``` -------------------------------- ### Install Aider with uv Source: https://aider.chat/docs/install.html Use the uv tool manager to install Aider with a specific Python version. ```bash python -m pip install uv # If you need to install uv uv tool install --force --python python3.12 --with pip aider-chat@latest ``` -------------------------------- ### Install Aider Source: https://aider.chat/docs/llms/cohere.html Install the aider package using pip. This command is used to set up the aider tool for your project. ```bash python -m pip install aider-install ``` ```bash aider-install ``` -------------------------------- ### Start Aider with DeepSeek Chat v3 Source: https://aider.chat/docs/llms/deepseek.html Navigate to your project directory and start Aider, specifying the DeepSeek Chat v3 model using the --model flag. ```bash # Change directory into your codebase cd /to/your/project # Use DeepSeek Chat v3 aider --model deepseek/deepseek-chat ``` -------------------------------- ### Install Boto3 Dependency Source: https://aider.chat/docs/llms/bedrock.html Install the required boto3 package using various package managers. ```bash # If you installed with aider-install or `uv tool` uv tool run --from aider-chat pip install boto3 # Or with pipx... pipx inject aider-chat boto3 # Or with pip pip install -U boto3 ``` -------------------------------- ### Install Aider with Pipx on Replit Source: https://aider.chat/docs/troubleshooting/imports.html Use these commands to install and run Aider with pipx in a Replit environment. This helps manage dependencies separately. ```bash pip install pipx pipx run aider-chat ...normal aider args... ``` -------------------------------- ### Start Aider with Cohere Source: https://aider.chat/docs/llms/cohere.html Begin using Aider with the Cohere Command-R+ model. Navigate to your project directory first. This command initializes Aider for your codebase. ```bash # Change directory into your codebase cd /to/your/project ``` ```bash aider --model command-r-plus-08-2024 ``` -------------------------------- ### Start Aider with specific models Source: https://aider.chat/docs/install.html Initialize Aider within a project directory using specific AI models and API keys. ```bash # Change directory into your codebase cd /to/your/project # DeepSeek aider --model deepseek --api-key deepseek= # Claude 3.7 Sonnet aider --model sonnet --api-key anthropic= # o3-mini aider --model o3-mini --api-key openai= ``` -------------------------------- ### Start Aider with Groq Llama 3 70B Source: https://aider.chat/docs/llms/groq.html Begin an aider session using the Groq Llama 3 70B model. Ensure you are in your project's root directory before running this command. ```bash # Change directory into your codebase cd /to/your/project aider --model groq/llama3-70b-8192 ``` -------------------------------- ### Install and Run Aider with Pipx on Replit Source: https://aider.chat/docs/install/replit.html Use these commands in the Replit shell to install pipx and then run Aider Chat. Ensure you replace '...normal aider args...' with your specific Aider arguments. ```bash pip install pipx pipx run aider-chat ...normal aider args... ``` -------------------------------- ### Configure Anthropic API Key Source: https://aider.chat/docs/llms/anthropic.html Environment variable setup for Mac/Linux and Windows systems. ```bash export ANTHROPIC_API_KEY= # Mac/Linux setx ANTHROPIC_API_KEY # Windows, restart shell after setx ``` -------------------------------- ### Configure Azure o3-mini Model Settings Source: https://aider.chat/docs/config/reasoning.html This example shows how to configure Aider to use 'o3-mini' via Azure. It includes settings for `use_temperature: false`, which is often a requirement for reasoning models. The configuration also specifies `weak_model_name`, `editor_model_name`, and other provider-specific details. ```yaml - name: azure/o3-mini edit_format: diff weak_model_name: azure/gpt-4o-mini use_repo_map: true use_temperature: false # <--- editor_model_name: azure/gpt-4o editor_edit_format: editor-diff accepts_settings: ["reasoning_effort"] ``` -------------------------------- ### Run Aider with Gemini Models Source: https://aider.chat/docs/llms/gemini.html Commands to start Aider with specific Gemini models or list available models. ```bash # Change directory into your codebase cd /to/your/project # You can run the Gemini 2.5 Pro model with this shortcut: aider --model gemini # You can run the Gemini 2.5 Pro Exp for free, with usage limits: aider --model gemini-exp # List models available from Gemini aider --list-models gemini/ ``` -------------------------------- ### Example Source Code Source: https://aider.chat/docs/unified-diffs.html This is the original source code before any edits are applied. It includes a function with a comment and a print statement. ```python import sys def main(args): # show a greeting print("Hello!") return main(sys.argv[1:]) ``` -------------------------------- ### Example Repository Map Structure Source: https://aider.chat/docs/repomap.html A partial representation of a repository map showing class and method signatures for specific files. ```text aider/coders/base_coder.py: ⋮... │class Coder: │ abs_fnames = None ⋮... │ @classmethod │ def create( │ self, │ main_model, │ edit_format, │ io, │ skip_model_availabily_check=False, │ **kwargs, ⋮... │ def abs_root_path(self, path): ⋮... │ def run(self, with_message=None): ⋮... aider/commands.py: ⋮... │class Commands: │ voice = None │ ⋮... │ def get_commands(self): ⋮... │ def get_command_completions(self, cmd_name, partial): ⋮... │ def run(self, inp): ⋮... ``` -------------------------------- ### Start Aider and Request Code Changes Source: https://aider.chat/docs/usage.html Initiate an Aider session by providing a source file. Aider will then prompt you to describe the code changes you need. ```bash $ aider factorial.py Aider v0.37.1-dev Models: gpt-4o with diff edit format, weak model gpt-3.5-turbo Git repo: .git with 258 files Repo-map: using 1024 tokens Use /help to see in-chat commands, run with --help to see cmd line args ─────────────────────────────────────────────────────────────────────── > Make a program that asks for a number and prints its factorial ... ``` -------------------------------- ### Example of Reasoning Tagged Output Source: https://aider.chat/docs/config/reasoning.html Illustrates how a model's reasoning output is wrapped in a specified XML tag, like '', and how Aider processes it separately from other output. ```xml The user wants me to greet them! Hello! ``` -------------------------------- ### Pip Dependency Conflict Example Source: https://aider.chat/docs/troubleshooting/imports.html This is an example of a dependency conflict message that may appear when installing packages with pip. ```text aider-chat 0.23.0 requires somepackage==X.Y.Z, but you have somepackage U.W.V which is incompatible. ``` -------------------------------- ### AI Comment for Refactoring a Function Source: https://aider.chat/docs/usage/watch.html This example demonstrates using 'ai refactor...' comments to guide the LLM in refactoring existing code into a new function. ```python # ai refactor... ``` ```python # ... to compute_factorial() ai! ``` -------------------------------- ### AI Comment Syntax Examples Source: https://aider.chat/docs/usage/watch.html Examples of one-liner comments that Aider monitors for instructions. ```text # Make a snake game. AI! # What is the purpose of this method AI? ``` ```text // Write a protein folding prediction engine. AI! ``` -------------------------------- ### Run Aider with Qwen2.5 Coder 14B Instruct (Whole) Source: https://aider.chat/docs/leaderboards/edit.html Execute Aider with the 'openai/Qwen2.5-Coder-14B-Instruct' model, which uses the 'whole' edit format. ```bash aider --model openai/Qwen2.5-Coder-14B-Instruct ``` -------------------------------- ### Display Aider startup information Source: https://aider.chat/docs/troubleshooting.html Use the output printed at startup to provide version and model details when reporting issues. ```text Aider v0.37.1-dev Models: gpt-4o with diff edit format, weak model gpt-3.5-turbo Git repo: .git with 243 files Repo-map: using 1024 tokens ``` -------------------------------- ### Example Shared Chat URL Source: https://aider.chat/docs/faq.html An example of a complete URL that displays an Aider chat history in a web format. ```markdown https://aider.chat/share/?mdurl=https://gist.github.com/Aider-AI/2087ab8b64034a078c0a209440ac8be0 ``` -------------------------------- ### Install PortAudio on Mac Source: https://aider.chat/docs/install/optional.html Install the PortAudio library on macOS using Homebrew for Aider's voice coding feature. ```bash brew install portaudio ``` -------------------------------- ### Run Aider with Qwen2.5 Coder 7B Instruct (Whole) Source: https://aider.chat/docs/leaderboards/edit.html This command launches Aider with the 'openai/Qwen2.5-Coder-7B-Instruct' model, configured for the 'whole' edit format. ```bash aider --model openai/Qwen2.5-Coder-7B-Instruct ``` -------------------------------- ### Install Playwright Chromium Source: https://aider.chat/docs/install/optional.html Install Playwright's Chromium browser and its dependencies to enable Aider to scrape all web pages effectively, especially those relying on JavaScript. ```bash playwright install --with-deps chromium ``` -------------------------------- ### Configure Aider with Reasoning Models Source: https://aider.chat/docs/config/reasoning.html Use command-line arguments to specify the model and its reasoning parameters like thinking tokens or effort. ```bash # Sonnet uses a thinking token budget aider --model sonnet --thinking-tokens 8k # o3-mini uses low/medium/high reasoning effort aider --model o3-mini --reasoning-effort high # R1 doesn't have configurable thinking/reasoning aider --model r1 ``` -------------------------------- ### Run Aider with Azure Models Source: https://aider.chat/docs/llms/azure.html Initialize Aider in a project directory and list available Azure models. ```bash # Change directory into your codebase cd /to/your/project aider --model azure/ # List models available from Azure aider --list-models azure/ ``` -------------------------------- ### Configure Aider IO for Python Source: https://aider.chat/docs/scripting.html Use the InputOutput class to configure settings like automatic confirmation. ```python from aider.io import InputOutput io = InputOutput(yes=True) # ... coder = Coder.create(model=model, fnames=fnames, io=io) ``` -------------------------------- ### Sample .env File Configuration for Aider Source: https://aider.chat/docs/config/dotenv.html This sample .env file demonstrates how to configure various aspects of aider, including LLM parameters, API keys, model settings, cache, repomap, and history files. Place this file at the root of your git repository or specify its location using the --env-file parameter. ```dotenv ########################################################## # Sample aider .env file. # Place at the root of your git repo. # Or use `aider --env ` to specify. ########################################################## ################# # LLM parameters: # # Include xxx_API_KEY parameters and other params needed for your LLMs. # See https://aider.chat/docs/llms.html for details. ## OpenAI #OPENAI_API_KEY= ## Anthropic #ANTHROPIC_API_KEY= ##... ############# # Main model: ## Specify the model to use for the main chat #AIDER_MODEL= ######################## # API Keys and settings: ## Specify the OpenAI API key #AIDER_OPENAI_API_KEY= ## Specify the Anthropic API key #AIDER_ANTHROPIC_API_KEY= ## Specify the api base url #AIDER_OPENAI_API_BASE= ## (deprecated, use --set-env OPENAI_API_TYPE=) #AIDER_OPENAI_API_TYPE= ## (deprecated, use --set-env OPENAI_API_VERSION=) #AIDER_OPENAI_API_VERSION= ## (deprecated, use --set-env OPENAI_API_DEPLOYMENT_ID=) #AIDER_OPENAI_API_DEPLOYMENT_ID= ## (deprecated, use --set-env OPENAI_ORGANIZATION=) #AIDER_OPENAI_ORGANIZATION_ID= ## Set an environment variable (to control API settings, can be used multiple times) #AIDER_SET_ENV= ## Set an API key for a provider (eg: --api-key provider= sets PROVIDER_API_KEY=) #AIDER_API_KEY= ################# # Model settings: ## List known models which match the (partial) MODEL name #AIDER_LIST_MODELS= ## Specify a file with aider model settings for unknown models #AIDER_MODEL_SETTINGS_FILE=.aider.model.settings.yml ## Specify a file with context window and costs for unknown models #AIDER_MODEL_METADATA_FILE=.aider.model.metadata.json ## Add a model alias (can be used multiple times) #AIDER_ALIAS= ## Set the reasoning_effort API parameter (default: not set) #AIDER_REASONING_EFFORT= ## Set the thinking token budget for models that support it. Use 0 to disable. (default: not set) #AIDER_THINKING_TOKENS= ## Verify the SSL cert when connecting to models (default: True) #AIDER_VERIFY_SSL=true ## Timeout in seconds for API calls (default: None) #AIDER_TIMEOUT= ## Specify what edit format the LLM should use (default depends on model) #AIDER_EDIT_FORMAT= ## Use architect edit format for the main chat #AIDER_ARCHITECT= ## Enable/disable automatic acceptance of architect changes (default: True) #AIDER_AUTO_ACCEPT_ARCHITECT=true ## Specify the model to use for commit messages and chat history summarization (default depends on --model) #AIDER_WEAK_MODEL= ## Specify the model to use for editor tasks (default depends on --model) #AIDER_EDITOR_MODEL= ## Specify the edit format for the editor model (default: depends on editor model) #AIDER_EDITOR_EDIT_FORMAT= ## Only work with models that have meta-data available (default: True) #AIDER_SHOW_MODEL_WARNINGS=true ## Check if model accepts settings like reasoning_effort/thinking_tokens (default: True) #AIDER_CHECK_MODEL_ACCEPTS_SETTINGS=true ## Soft limit on tokens for chat history, after which summarization begins. If unspecified, defaults to the model's max_chat_history_tokens. #AIDER_MAX_CHAT_HISTORY_TOKENS= ################# # Cache settings: ## Enable caching of prompts (default: False) #AIDER_CACHE_PROMPTS=false ## Number of times to ping at 5min intervals to keep prompt cache warm (default: 0) #AIDER_CACHE_KEEPALIVE_PINGS=false ################### # Repomap settings: ## Suggested number of tokens to use for repo map, use 0 to disable #AIDER_MAP_TOKENS= ## Control how often the repo map is refreshed. Options: auto, always, files, manual (default: auto) #AIDER_MAP_REFRESH=auto ## Multiplier for map tokens when no files are specified (default: 2) #AIDER_MAP_MULTIPLIER_NO_FILES=true ################ # History Files: ## Specify the chat input history file (default: .aider.input.history) #AIDER_INPUT_HISTORY_FILE=.aider.input.history ## Specify the chat history file (default: .aider.chat.history.md) #AIDER_CHAT_HISTORY_FILE=.aider.chat.history.md ## Restore the previous chat history messages (default: False) #AIDER_RESTORE_CHAT_HISTORY=false ## Log the conversation with the LLM to this file (for example, .aider.llm.history) #AIDER_LLM_HISTORY_FILE= ################## # Output settings: ``` -------------------------------- ### Run Aider with o3-pro Source: https://aider.chat/docs/leaderboards Command to initialize Aider using the o3-pro model. ```bash aider --model o3-pro ``` -------------------------------- ### Install PortAudio on Linux Source: https://aider.chat/docs/install/optional.html Install the PortAudio library on Linux systems for Aider's voice coding feature. Some Linux environments may also require the ALSA sound plugins. ```bash sudo apt-get install libportaudio2 ``` ```bash sudo apt install libasound2-plugins ``` -------------------------------- ### Initialize Aider with specific models Source: https://aider.chat/docs/leaderboards/edit.html Use these commands to launch Aider with a specific model. Some models require provider prefixes or specific API base configurations. ```bash aider --model gpt-3.5-turbo-0301 ``` ```bash aider --model gpt-4-turbo-2024-04-09 ``` ```bash aider --model gemini/gemini-1.5-pro-latest ``` ```bash aider --model gpt-3.5-turbo-1106 ``` ```bash aider --model gpt-4o-mini ``` ```bash aider --model together_ai/qwen/Qwen2-72B-Instruct ``` ```bash aider --model openrouter/x-ai/grok-2-mini ``` ```bash aider --sonnet ``` ```bash aider --model bedrock/us.amazon.nova-pro-v1:0 ``` ```bash aider --model ollama/qwen2.5:32b ``` ```bash aider --model openai/hf:01-ai/Yi-Coder-9B-Chat --openai-api-base https://glhf.chat/api/openai/v1 ``` ```bash aider --model gemini/gemini-1.5-flash-exp-0827 ``` ```bash aider --model ollama/qwen2.5-coder:7b-instruct-q8_0 ``` ```bash aider --model gemini/gemini-1.5-flash-002 ``` ```bash aider --model mistral/codestral-2405 ``` ```bash aider --model gpt-3.5-turbo-0613 ``` ```bash aider -3 ``` ```bash aider --model ollama/qwen2:72b-instruct-q8_0 ``` ```bash aider --model groq/llama3-70b-8192 ``` ```bash aider --model Codestral-22B-v0.1-Q4_K_M ``` ```bash aider --model ollama/codestral:22b-v0.1-q8_0 ``` ```bash aider --model claude-3-haiku-20240307 ``` ```bash aider --model ollama/codestral ``` ```bash aider --model ollama/yi-coder:9b-chat-q4_0 ``` ```bash aider --model gemini/gemini-1.5-flash-latest ``` ```bash aider --model openrouter/microsoft/wizardlm-2-8x22b ``` ```bash aider --model ollama/yi-coder:9b-chat-fp16 ``` ```bash aider --model openai/Qwen2.5-Coder-3B-Instruct ``` ```bash aider --model ollama/mistral-small ``` ```bash aider --model gemini/gemini-1.5-flash-8b-exp-0924 ``` ```bash aider --model command-r-08-2024 ``` ```bash aider --model command-r-plus-08-2024 ``` ```bash aider --model gemini/gemini-1.5-flash-8b-exp-0827 ``` ```bash aider --model fireworks_ai/accounts/fireworks/models/llama-v3p1-8b-instruct ``` ```bash aider --model together_ai/qwen/qwen1.5-110b-chat ``` ```bash aider --model ollama/gemma2:27b-instruct-q8_0 ``` ```bash aider --model ollama/codeqwen:7b-chat-v1.5-q8_0 ``` ```bash aider --model ollama/mistral-nemo:12b-instruct-2407-q4_K_M ``` ```bash aider --model ollama/codegeex4 ``` ```bash aider --model openai/Qwen2.5-Coder-1.5B-Instruct ``` ```bash aider --model command-r-plus ``` ```bash aider --model ollama/hermes3:8b-llama3.1-fp16 ``` ```bash aider --model ollama/wojtek/opencodeinterpreter:6.7b ``` ```bash aider --model o1-mini ``` ```bash aider --model ollama/tulu3 ``` ```bash aider --model ollama/llama3.2:3b-instruct-fp16 ``` ```bash aider --model ollama/hermes3 ``` ```bash aider --model ollama/granite3-dense:8b ``` ```bash aider --model openai/Qwen2.5-Coder-0.5B-Instruct ``` -------------------------------- ### Initialize Aider with OpenAI Models Source: https://aider.chat/docs/llms/openai.html Commands to launch Aider within a project directory using specific OpenAI models or to list available models. ```bash # Change directory into your codebase cd /to/your/project # o3-mini aider --model o3-mini # o1-mini aider --model o1-mini # GPT-4o aider --model gpt-4o # List models available from OpenAI aider --list-models openai/ ``` -------------------------------- ### Run Aider with Qwen-2.5 72B Instruct (Diff) Source: https://aider.chat/docs/leaderboards/edit.html Command to run Aider with the 'openrouter/qwen/qwen-2.5-72b-instruct' model, utilizing the 'diff' edit format. ```bash aider --model openrouter/qwen/qwen-2.5-72b-instruct ``` -------------------------------- ### Modify Docker Setup Source: https://aider.chat/docs/usage/not-code.html Update Dockerfile and docker-compose.yml for security and service configuration. ```dockerfile + USER appuser + HEALTHCHECK --interval=30s --timeout=3s \ + CMD curl -f http://localhost:8000/health || exit 1 ``` ```yaml services: postgres: image: postgres:15 + ports: + - "5432:5432" + volumes: + - pgdata:/var/lib/postgresql/data ``` -------------------------------- ### List Available xAI Models Source: https://aider.chat/docs/llms/xai.html Use the '--list-models' flag with a xAI provider prefix to see all available models from xAI. ```bash # List models available from xAI aider --list-models xai/ ``` -------------------------------- ### In-context Instruction Example Source: https://aider.chat/docs/usage/watch.html Adding an AI comment directly within a function to request specific changes. ```javascript app.get('/sqrt/:n', (req, res) => { const n = parseFloat(req.params.n); // Add error handling for NaN and less than zero. AI! const result = math.sqrt(n); res.json({ result: result }); }); ``` -------------------------------- ### Implement Function via AI Comment Source: https://aider.chat/docs/usage/watch.html Example of using an AI comment to trigger the implementation of a function. ```javascript function factorial(n) // Implement this. AI! ``` ```javascript function factorial(n) { if (n === 0 || n === 1) { return 1; } else { return n * factorial(n - 1); } } ``` -------------------------------- ### Markdown Code Block Example Source: https://aider.chat/docs/faq.html Illustrates the standard markdown format for code blocks using triple backticks. ```markdown Here's some code: ``` print("hello") ``` ``` -------------------------------- ### Run Aider with Anthropic Source: https://aider.chat/docs/llms/anthropic.html Commands to initialize Aider in a project directory and list available Anthropic models. ```bash # Change directory into your codebase cd /to/your/project # Aider uses Claude 3.7 Sonnet by default aider # List models available from Anthropic aider --list-models anthropic/ ``` -------------------------------- ### Add Factorial Function Source: https://aider.chat/docs/usage/modes.html Adds a recursive Python function to calculate the factorial of a number. Includes example usage. ```python def factorial(n): if n == 0 or n == 1: return 1 else: return n * factorial(n - 1) # Example usage print(factorial(5)) # Output: 120 ``` -------------------------------- ### Run Aider with Qwen 2.5 Coder (OpenRouter) Source: https://aider.chat/docs/leaderboards/edit.html Command to run Aider with the 'openrouter/qwen/qwen-2.5-coder-32b-instruct' model, utilizing the 'diff' edit format. ```bash aider --model openrouter/qwen/qwen-2.5-coder-32b-instruct ``` -------------------------------- ### Minimal Variable Rename Diff Source: https://aider.chat/docs/unified-diffs.html A surgical diff example showing a variable rename across multiple lines. ```text @@ ... @@ -def factorial(n): +def factorial(number): - if n == 0: + if number == 0: return 1 else: - return n * factorial(n-1) + return number * factorial(number-1) ``` -------------------------------- ### Capture script execution output Source: https://aider.chat/docs/usage/lint-test.html Example of a Python traceback captured after running a script via the /run command. ```text Traceback (most recent call last): File "myscript.py", line 22, in raise ValueError("something bad happened") ValueError: something bad happened ``` -------------------------------- ### Run Aider with Grok 3 Mini Beta Source: https://aider.chat/docs/leaderboards Execute this command to utilize the Grok 3 Mini Beta model through OpenRouter. Verify your OpenRouter configuration. ```bash aider --model openrouter/x-ai/grok-3-mini-beta ``` -------------------------------- ### List supported models with Aider Source: https://aider.chat/docs/llms/other.html Use the --list-models flag to search for available models matching a partial name. ```bash $ aider --list-models turbo Aider v0.29.3-dev Models which match "turbo": - gpt-4-turbo-preview (openai/gpt-4-turbo-preview) - gpt-4-turbo (openai/gpt-4-turbo) - gpt-4-turbo-2024-04-09 (openai/gpt-4-turbo-2024-04-09) - gpt-3.5-turbo (openai/gpt-3.5-turbo) - ... ``` -------------------------------- ### Multiple AI Comments Example Source: https://aider.chat/docs/usage/watch.html Using multiple AI comments across a file to coordinate complex refactoring tasks. ```python @app.route('/factorial/') def factorial(n): if n < 0: return jsonify(error="Factorial is not defined for negative numbers"), 400 # AI: Refactor this code... result = 1 for i in range(1, n + 1): result *= i # ... into to a compute_factorial() function. AI! return jsonify(result=result) ``` -------------------------------- ### Enable Analytics Opt-in Source: https://aider.chat/docs/more/analytics.html Use this command to trigger the initial opt-in prompt for analytics collection. ```bash aider --analytics Aider respects your privacy and never collects your code, prompts, chats, keys or any personal info. For more info: https://aider.chat/docs/more/analytics.html Allow collection of anonymous analytics to help improve aider? (Y)es/(N)o [Yes]: ``` -------------------------------- ### High-Level Variable Rename Diff Source: https://aider.chat/docs/unified-diffs.html A high-level diff example that presents the entire function body for better context and accuracy. ```text @@ ... @@ -def factorial(n): - if n == 0: - return 1 - else: - return n * factorial(n-1) +def factorial(number): + if number == 0: + return 1 + else: + return number * factorial(number-1) ``` -------------------------------- ### Sample Aider YAML Configuration Source: https://aider.chat/docs/config/aider_conf.html A comprehensive sample of the `.aider.conf.yml` file, illustrating all valid configuration entries. This file can be placed in your home directory or the root of your git repository. ```yaml ########################################################## # Sample .aider.conf.yml # This file lists *all* the valid configuration entries. # Place in your home dir, or at the root of your git repo. ########################################################## # Note: You can only put OpenAI and Anthropic API keys in the YAML # config file. Keys for all APIs can be stored in a .env file # https://aider.chat/docs/config/dotenv.html ########## # options: ## show this help message and exit #help: xxx ############# # Main model: ## Specify the model to use for the main chat #model: xxx ######################## # API Keys and settings: ## Specify the OpenAI API key #openai-api-key: xxx ## Specify the Anthropic API key #anthropic-api-key: xxx ## Specify the api base url #openai-api-base: xxx ## (deprecated, use --set-env OPENAI_API_TYPE=) #openai-api-type: xxx ## (deprecated, use --set-env OPENAI_API_VERSION=) #openai-api-version: xxx ## (deprecated, use --set-env OPENAI_API_DEPLOYMENT_ID=) #openai-api-deployment-id: xxx ## (deprecated, use --set-env OPENAI_ORGANIZATION=) #openai-organization-id: xxx ## Set an environment variable (to control API settings, can be used multiple times) #set-env: xxx ## Specify multiple values like this: #set-env: # - xxx # - yyy # - zzz ## Set an API key for a provider (eg: --api-key provider= sets PROVIDER_API_KEY=) #api-key: xxx ## Specify multiple values like this: #api-key: # - xxx # - yyy # - zzz ################# # Model settings: ## List known models which match the (partial) MODEL name #list-models: xxx ## Specify a file with aider model settings for unknown models #model-settings-file: .aider.model.settings.yml ## Specify a file with context window and costs for unknown models #model-metadata-file: .aider.model.metadata.json ## Add a model alias (can be used multiple times) #alias: xxx ## Specify multiple values like this: #alias: # - xxx # - yyy # - zzz ## Set the reasoning_effort API parameter (default: not set) #reasoning-effort: xxx ## Set the thinking token budget for models that support it. Use 0 to disable. (default: not set) #thinking-tokens: xxx ## Verify the SSL cert when connecting to models (default: True) #verify-ssl: true ## Timeout in seconds for API calls (default: None) #timeout: xxx ## Specify what edit format the LLM should use (default depends on model) #edit-format: xxx ## Use architect edit format for the main chat #architect: false ## Enable/disable automatic acceptance of architect changes (default: True) #auto-accept-architect: true ## Specify the model to use for commit messages and chat history summarization (default depends on --model) #weak-model: xxx ## Specify the model to use for editor tasks (default depends on --model) #editor-model: xxx ## Specify the edit format for the editor model (default: depends on editor model) #editor-edit-format: xxx ## Only work with models that have meta-data available (default: True) #show-model-warnings: true ## Check if model accepts settings like reasoning_effort/thinking_tokens (default: True) #check-model-accepts-settings: true ## Soft limit on tokens for chat history, after which summarization begins. If unspecified, defaults to the model's max_chat_history_tokens. #max-chat-history-tokens: xxx ################# # Cache settings: ## Enable caching of prompts (default: False) #cache-prompts: false ## Number of times to ping at 5min intervals to keep prompt cache warm (default: 0) #cache-keepalive-pings: false ################### # Repomap settings: ## Suggested number of tokens to use for repo map, use 0 to disable #map-tokens: xxx ## Control how often the repo map is refreshed. Options: auto, always, files, manual (default: auto) #map-refresh: auto ## Multiplier for map tokens when no files are specified (default: 2) #map-multiplier-no-files: true ################ # History Files: ## Specify the chat input history file (default: .aider.input.history) #input-history-file: .aider.input.history ``` -------------------------------- ### Diff edit format example Source: https://aider.chat/docs/more/edit-formats.html The diff format uses search/replace blocks with the file path specified before the fenced block. ```text mathweb/flask/app.py <<<<<<< SEARCH from flask import Flask ======= import math from flask import Flask >>>>>>> REPLACE ``` -------------------------------- ### Run Aider with Ollama Qwen2.5 Coder 7B (Whole) Source: https://aider.chat/docs/leaderboards/edit.html Command to run Aider with the 'ollama/Qwen2.5.1-Coder-7B-Instruct-GGUF:Q8_0-32k' model, utilizing the 'whole' edit format. ```bash aider --model ollama/Qwen2.5.1-Coder-7B-Instruct-GGUF:Q8_0-32k ``` -------------------------------- ### Run Aider with Gemini 2.5 Pro Source: https://aider.chat/docs/leaderboards Command to initialize Aider using the Gemini 2.5 Pro model with specific thinking token configuration. ```bash aider --model gemini/gemini-2.5-pro-preview-06-05 --thinking-tokens 32k ``` -------------------------------- ### Unified Diff Hunk Example Source: https://aider.chat/docs/unified-diffs.html A representation of a unified diff hunk used for search and replace operations without line numbers. ```text @@ ... @@ def main(args): # show a greeting - print("Hello!") + print("Goodbye!") return ```