Skip to main content

Use CodeGate with Aider

Aider is an open source AI coding assistant that lets you pair program with LLMs in your terminal.

CodeGate works with the following AI model providers through Aider:

note

This guide assumes you have already installed Aider using their installation instructions.

Configure Aider to use CodeGate

To configure Aider to send requests through CodeGate:

You need an OpenAI API account to use this provider.

Before you run Aider, set environment variables for your API key and to set the API base URL to CodeGate's API port. Alternately, use one of Aider's other supported configuration methods to set the corresponding values.

export OPENAI_API_KEY=<YOUR_API_KEY>
export OPENAI_API_BASE=http://localhost:8989/openai
note

To persist these variables, add them to your shell profile (e.g., ~/.bashrc or ~/.zshrc).

Replace <YOUR_API_KEY> with your OpenAI API key.

Then run aider as normal. For more information, see the Aider docs for connecting to OpenAI.

Verify configuration

To verify that you've successfully connected Aider to CodeGate, type /ask codegate-version into the Aider chat in your terminal. You should receive a response like "CodeGate version 0.1.0":

Next steps

Learn more about CodeGate's features:

Remove CodeGate

If you decide to stop using CodeGate, follow these steps to remove it and revert your environment.

  1. Stop Aider and unset the environment variables you set during the configuration process:

    OpenAI: unset OPENAI_API_BASE (macOS/Linux) or setx OPENAI_API_BASE "" (Windows)

    Ollama: unset OLLAMA_API_BASE (macOS/Linux) or setx OLLAMA_API_BASE "" (Windows)

  2. Re-launch Aider.

  3. Stop and remove the CodeGate container:

    docker stop codegate && docker rm codegate
  4. If you launched CodeGate with a persistent volume, delete it to remove the CodeGate database and other files:

    docker volume rm codegate_volume