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:

  • Local / self-managed:
  • Hosted:
    • OpenAI and OpenAI-compatible APIs

You can also configure CodeGate muxing to select your provider and model using workspaces.

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:

First, configure your provider(s) and select a model for each of your workspace(s) in the CodeGate dashboard.

Run aider with the OpenAI base URL set to http://localhost:8989/v1/mux. You can do this with the OPENAI_API_BASE environment variable or on the command line as shown below.

The --openai-api-key parameter is required but the value is not used. The --model setting must start with openai/ but the actual model is determined by your CodeGate workspace.

aider --openai-api-base http://localhost:8989/v1/mux --openai-api-key fake-value-not-used --model openai/fake-value-not-used

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.13".

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. Quit 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. Stop and remove the CodeGate container:

    docker rm -f codegate
  3. If you launched CodeGate with a persistent volume, delete it to remove the CodeGate database and other files:

    docker volume rm codegate_volume