aider/docs/install.md
Paul Gauthier 9d01f9cb29 copy
2024-04-19 14:50:09 -07:00

5.3 KiB

Installing aider

Install git

Make sure you have git installed. Here are instructions for installing git in various environments.

Get your API key

To work with OpenAI's GPT 3.5 or GPT-4 models you need a paid OpenAI API key. Note that this is different than being a "ChatGPT Plus" subscriber.

To work with Anthropic's models like Claude 3 Opus you need a paid Anthropic API key.

Windows install

# Install aider
py -m pip install aider-chat

# To work with GPT-4 Turbo:
$ aider --openai-api-key sk-xxx... --4turbo

# To work with Claude 3 Opus:
$ aider --anthropic-api-key sk-xxx... --opus

Mac/Linux install

# Install aider
python -m pip install aider-chat

# To work with GPT-4 Turbo:
$ aider --openai-api-key sk-xxx... --4turbo

# To work with Claude 3 Opus:
$ aider --anthropic-api-key sk-xxx... --opus

Working with other LLMs

Aider works well with GPT 3.5, GPT-4, GPT-4 Turbo with Vision, and Claude 3 Opus. It also has support for connecting to almost any LLM.

Tutorial videos

Here are a few tutorial videos:

You are done!

See the usage instructions to start coding with aider.


Optional steps

The steps below are completely optional.

Store your api key (optional)

You can place your api key in an environment variable:

  • export OPENAI_API_KEY=sk-... on Linux or Mac
  • setx OPENAI_API_KEY sk-... in Windows PowerShell

Or you can create a .aider.conf.yml file in your home directory. Put a line in it like this to specify your api key:

openai-api-key: sk-...

Enable Playwright (optional)

Aider supports adding web pages to the chat with the /web <url> command. When you add a url to the chat, aider fetches the page and scrapes its content.

By default, aider uses the httpx library to scrape web pages, but this only works on a subset of web pages. Some sites explicitly block requests from tools like httpx. Others rely heavily on javascript to render the page content, which isn't possible using only httpx.

Aider works best with all web pages if you install Playwright's chromium browser and its dependencies:

playwright install --with-deps chromium

See the Playwright for Python documentation for additional information.

Enable voice coding (optional)

Aider supports coding with your voice using the in-chat /voice command. Aider uses the PortAudio library to capture audio. Installing PortAudio is completely optional, but can usually be accomplished like this:

  • For Windows, there is no need to install PortAudio.
  • For Mac, do brew install portaudio
  • For Linux, do sudo apt-get install libportaudio2

Add aider to your editor (optional)

NeoVim

joshuavial provided a NeoVim plugin for aider:

https://github.com/joshuavial/aider.nvim

VS Code

joshuavial also confirmed that aider works inside a VS Code terminal window. Aider detects if it is running inside VSCode and turns off pretty/color output, since the VSCode terminal doesn't seem to support it well.

MattFlower provided a VSCode plugin for aider:

https://marketplace.visualstudio.com/items?itemName=MattFlower.aider

Other editors

If you are interested in creating an aider plugin for your favorite editor, please let me know by opening a GitHub issue.

Install development versions of aider (optional)

If you want to install the very latest development version of aider:

  • GitHub hosts the latest version, which is under active development:
    • python -m pip install git+https://github.com/paul-gauthier/aider.git
  • If you've git cloned the aider repository already, you can install "live" from your local copy. This is mostly useful if you are developing aider and want your current modifications to take effect immediately.
    • python -m pip install -e .