{"id":4411,"library":"aider-chat","title":"Aider","description":"Aider is an AI pair programming tool that allows you to chat with an AI model directly in your terminal, making it easy to edit code in your local git repository. It integrates with various LLM providers (OpenAI, Anthropic, Gemini, OpenRouter, etc.) and supports many programming languages. The current version is 0.86.2, with active development and frequent releases focusing on new model support and user experience improvements.","status":"active","version":"0.86.2","language":"en","source_language":"en","source_url":"https://github.com/Aider-AI/aider","tags":["ai","cli","pair-programming","developer-tool","llm","git"],"install":[{"cmd":"pip install aider-chat","lang":"bash","label":"Install Aider"}],"dependencies":[],"imports":[],"quickstart":{"code":"# 1. Set your API key (e.g., OpenAI, Anthropic, Gemini, OpenRouter)\n# For OpenAI, set OPENAI_API_KEY. For other providers, check Aider docs.\n# export OPENAI_API_KEY=\"sk-...\" (Linux/macOS)\n# $env:OPENAI_API_KEY=\"sk-...\" (PowerShell)\n\nimport os\nimport subprocess\nimport shutil\n\n# Using a dummy key for demonstration; replace with your actual key\nopenai_api_key = os.environ.get('OPENAI_API_KEY', 'sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')\n\nif not openai_api_key.startswith('sk-'):\n    print(\"WARNING: OPENAI_API_KEY not set or invalid. Aider will likely fail without a valid key.\")\n\n# Create a dummy project directory and a file to edit\nproject_dir = \"aider_quickstart_project\"\nif os.path.exists(project_dir):\n    shutil.rmtree(project_dir) # Clean up previous run\nos.makedirs(project_dir)\n\nos.chdir(project_dir)\n\nwith open(\"main.py\", \"w\") as f:\n    f.write(\"def hello_world():\\n    print('Hello')\\n\")\n\n# Initialize a git repo (Aider works best with git)\nsubprocess.run([\"git\", \"init\", \"-b\", \"main\"], check=True, capture_output=True)\nsubprocess.run([\"git\", \"add\", \"main.py\"], check=True, capture_output=True)\nsubprocess.run([\"git\", \"commit\", \"-m\", \"Initial commit\"], check=True, capture_output=True)\n\nprint(f\"\\nCreated '{project_dir}/main.py' and initialized git. Now launching Aider...\\n\")\nprint(\"To interact, type your requests into the terminal. E.g., 'Add 'world!' to the print statement.'\")\nprint(\"Type '/help' for Aider commands, or '/exit' to quit.\\n\")\n\n# Run Aider. The user will interact with it in the terminal.\n# Use a model alias like 'gpt-4o' if OPENAI_API_KEY is set.\n# Set environment variables for the subprocess call.\n# Note: This will block until Aider exits.\nresult = subprocess.run(\n    [\"aider\", \"--model\", \"gpt-4o\", \"main.py\"],\n    env={**os.environ, 'OPENAI_API_KEY': openai_api_key},\n    check=False # Aider might exit with non-zero if user cancels, etc.\n)\n\nprint(f\"\\nAider process exited with code {result.returncode}.\")\nprint(f\"Check '{os.path.join(project_dir, 'main.py')}' for changes.\")\n\n# Clean up (optional)\nos.chdir(\"..\")\nshutil.rmtree(project_dir)\nprint(f\"Cleaned up '{project_dir}'.\")\n","lang":"python","description":"This quickstart demonstrates how to set up a dummy project with a `main.py` file and a git repository, then launch Aider via the command line. Aider operates interactively in your terminal, acting as an AI pair programmer. You'll need to set an API key for your chosen LLM provider (e.g., OpenAI, Anthropic, Gemini) as an environment variable or pass it via CLI arguments. The example uses a `subprocess.run` call to execute Aider, allowing for direct terminal interaction."},"warnings":[{"fix":"Always explicitly specify your desired model using `aider --model your/model-name ...` to ensure consistent behavior, or regularly check release notes for alias changes.","message":"Aider frequently updates its default model aliases (e.g., `gemini`, `flash`, `sonnet`, `opus`) and provider priorities across releases. This can lead to users unintentionally using different models or providers than expected if they don't explicitly specify their desired model with the `--model` flag.","severity":"gotcha","affected_versions":"All versions (a continuous development pattern)"},{"fix":"Ensure the correct API key environment variable for your chosen provider is set before running Aider. Refer to the official Aider documentation for specific provider setup instructions (aider.chat/docs/llms.html).","message":"Aider requires API keys for LLM providers (e.g., OpenAI, Anthropic, Google Gemini, OpenRouter) to function. These keys must be configured correctly, typically as environment variables (e.g., `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `OPENROUTER_API_KEY`). Misconfiguration or missing keys will prevent Aider from communicating with LLMs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use a Python environment manager (e.g., `pyenv`, `conda`, `venv`) to ensure you are running Aider with a compatible Python version (e.g., Python 3.10, 3.11, or 3.12). For example, `python3.12 -m pip install aider-chat`.","message":"Aider has strict Python version requirements, currently `Python >=3.10, <3.13`. Installing or running Aider with unsupported Python versions (e.g., Python 3.9 or Python 3.13+) will lead to installation failures, dependency conflicts, or runtime errors as indicated by pip's `Requires-Python` metadata.","severity":"breaking","affected_versions":"All versions (check `requires_python` metadata)"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}