AI Personal Learning
and practical guidance
CyberKnife Drawing Mirror

Aider: open source programming assistant tool, use AI assistant for code writing and file editing

General Introduction

Aider is a powerful open source AI programming assistant tool that helps developers write, edit and refactor code through natural language conversations. As an interactive AI pair programming tool, Aider supports multiple mainstream programming languages, integrates seamlessly into Git workflows, and can automate code commits. It supports a variety of top-tier language models (e.g. GPT-4, Claude 3.5 Sonnet, etc.) and has achieved excellent results in SWE Bench benchmarks.Aider is particularly well suited for development work in existing codebases, where it understands the project context and assists developers with a wide range of programming tasks ranging from simple code modifications to complex feature implementations.

What makes Aider different from other AI code tools:

  • Completely open source with super flexible model selection: Aider is completely open source, so you can use it however you want. It also supports all kinds of big language models, such as OpenAI, Anthropic and other popular ones, as long as you have an API key, you can use them directly. Even local models can be used, so you can decide what models you want to use.
  • Sidecar architecture for performance: Aider's Sidecar architecture, written in Rust, is exceptionally performant and whooshes through edits. It's much faster than many other AI code tools.
  • Contextual Memory, Deep Reasoning: Aider remembers your code changes in real time, whether they are made by you or by the AI, it remembers them clearly. And it's smart enough to break complex code changes into small logical units for you to understand and manage.
  • Lightweight and cross-platform: Aider works on macOS, Windows, and Linux, and it's exceptionally light to run once loaded, making it smooth to use even with large projects.
  • The interface looks like VS Code: Aider's interface is similar to VS Code, so people who are used to using VS Code can basically get started without learning it.

Aider: open source programming assistant tool, use AI assistant for code writing and file editing-1

 

Function List

  • Support for multiple programming languages (Python, JavaScript, TypeScript, PHP, HTML, CSS, etc.)
  • Automated Git code commits with sensible commit messages
  • Integration with leading IDEs and editors
  • Supports editing multiple files at the same time
  • Better handling of large codebases with Git repository mapping functionality
  • Supports import and processing of images and URL content
  • Provides voice programming function
  • Compatible with many top-level language models (Claude 3.5 Sonnet, DeepSeek V3, GPT-4, etc.)
  • Support AI annotation function, can be triggered through the comments of the code changes
  • Provides real-time code editing preview
  • Support for bug fixing and test case generation

 

Using Help

1. Installation and configuration

  1. Installation of Aider.
pip install aider-chat
  1. Configure the API key:
  • Set the API key for the desired language model (e.g. OpenAI, Anthropic, etc.)
  • This can be set via an environment variable or configuration file

2. Basic methods of use

  1. Start Aider:
aider path/to/your/code
  1. Dialogue mode:
  • Directly enter a natural language description of the task you want to accomplish
  • Aider will understand your needs and suggest code changes accordingly.
  • You may accept, reject or request modifications to these proposals

3. Use of special features

AI annotation function

Aider can be triggered by using special comments in the code:

# 实现新功能 AI!  # 触发代码修改
# 这段代码是做什么的?AI? # 触发问答模式

File Monitor Mode

Enable the file monitoring function:

aider --watch-files

This allows you to add AI comments in the editor, which Aider will respond to automatically.

Git Integration

  • Aider automatically detects Git repositories
  • Automatic creation of commits
  • Keep submission history clear and traceable

Multi-file editing

  1. Mentioning multiple files that need to be changed in a dialog
  2. Aider will coordinate changes to handle multiple documents
  3. Ensure consistency of changes

IDE Integration

Aider can be used in IDEs such as VSCode:

  1. Activate Aider's file monitoring mode
  2. Editing code in the IDE
  3. Using AI annotations to trigger Aider's functionality

4. Techniques of use

  1. Use context wisely:
  • Provide sufficient contextual information when describing requirements
  • Use of project-related terminology
  • Clearly identify the specific location of the code
  1. Iterative development:
  • Implement basic functions first
  • Progressive refinement and optimization
  • Timely code reviews
  1. Version Control:
  • Commit code frequently
  • Keep submission information clear
  • Use branching development when necessary
  1. Performance Optimization:
  • Choosing the right language model
  • Proper use of file monitoring mode
  • Avoid too frequent API calls

5. Troubleshooting

Common problem solving:

  1. API connectivity issues
    • Checking API key configuration
    • Confirm network connection
    • Verify API access
  2. Code Generation Issues
    • Provide a clearer description of requirements
    • Checking the capacity constraints of a language model
    • Consider using a different model
  3. Git Integration Issues
    • Ensure that Git repositories are properly initialized
    • Checking the Git Configuration
    • Resolving possible conflicts

 

Aider launches web version

Aider was originally an AI tool for "pair programming" with developers through a command line interface, but now it has added the ability to generate code in direct conversations on the web.


The command line interface is honestly cool, but not very practical, it's too much of a hassle to either type or look up, and with the web version, the overall experience is so much better.
Aider: open source programming assistant tool, use AI assistant for code writing and file editing-1
The first step is to get the key and model name in the volcano engine

Aider: open source programming assistant tool, use AI assistant for code writing and file editing-1

 

Step 2: Install dependencies

python -m pip install -U aider-chat

Step 3: Configure environment variables

export OPENAI_API_KEY=<key> # Mac/Linux用户
setx   OPENAI_API_KEY <key> # Windows用

Because the volcano engine is directly compatible with OPENAI_API, in addition Aider itself is based on LiteLLM development, so basically all the models on the market can be accessed normally.

If you are using the Volcano engine, the environment variables should look like this, with the OPENAI_API_BASE variable unchanged, and the main thing is to change the KEY inside the first step.

export OPENAI_API_BASE=https://ark.cn-beijing.volces.com/api/v3
export OPENAI_API_KEY=1eex4-320f-435

Step 4: Open the page
Use the following command line

aider --browser --model openai/deepseek-v3-250324 --no-show-model-warnings

It would have been fine to just openai/deepseek-v3-250324, but because Aider compatibility issues can't get the context size and specific costing content, we need to add a separate --no-show-model-warnings to skip the warnings.

Next, it's ready to go.

Aider: open source programming assistant tool, use AI assistant for code writing and file editing-1

 

Use it to write a Flask Demo, correctly run, now the ability to large models are no problem, this web version of the interactive operation is still quite creative!

Aider: open source programming assistant tool, use AI assistant for code writing and file editing-1

More features such as to other clients to use can refer to the official website, this project is still quite interesting, itself is also open source, you can look at its specific implementation, in addition to Aider's biggest application scenarios is to write python scripts and production modification of small web pages, in addition, if it is used to organize the document, it is also a good choice for a lightweight and easy to use web page Cursor.

May not be reproduced without permission:Chief AI Sharing Circle " Aider: open source programming assistant tool, use AI assistant for code writing and file editing
en_USEnglish