Developer and Writer

Setting up aider with Github Copilot

In this letter, I'll teach you how to setup aider ai with Github Copilot as the docs aren't fully updated on that
As of aider 0.86.1, this is the way to use it with GH copilot. I'm pretty sure they will fix it in future versions so keep an eye on this issue, in case it gets fixed.

I like to live inside my terminal and it hurts a lot when I have to leave it.

Even writing this in my browser hurts, I'll probably have to figure out a way to programatically publish markdown files to ghost. Nevertheless, I also can't miss out on the whole AI craze.

I've tried Cursor and Github Copilot on VSCode, I never liked the fact that I have to use another editor for them. So I tried to find neovim friendly solutions and I did find two.

The first one was CopilotChat and the second one was Avante. Out of these two, I found Avante to be the more powerful one and stuck to it for some time. It tried to mimic Cursor but I think it never fully succeeded and the plugin itself was a bit all over the place so I wanted to remove it anyways.

Fast forward a month or two and Claude Code first came out and everyone went crazy. I really liked the idea of it being a CLI tool because then I don't need to install any plugins, I can have it running in another tmux window.

Corporate rules hit me in the face

Unfortunately, my company only allows the use Github Copilot, so I couldn't use Claude Code or it's equivalent that later came out(Gemini CLI, etc...)

I figured there must be a tool that could use Github Copilot and I did some digging. I found out about aider and was thoroughly surprised that I never heard about it before.

Turns out it was released before the days of Claude Code and other similar projects. I true pioneer, I dare say. In any case, the most important thing is that it supports my enterprise Github Copilot license.

Making it work with GH Copilot

I installed aider and looked through the docs for setting it up with copilot. That didn't work for some reason and then as usual, I went digging once again.

I found this GitHub issue talking about the same problem I had. Turns out there is a completely different method of using GH copilot with aider.

To make it work, I first had to configure my aider configs found in ~/.aider.conf.yaml and add the following:

model: github_copilot/gpt-4.1
weak-model: github_copilot/gpt-4.0
show-model-warnings: false
max-chat-history-tokens: 8000

After that I had to create a file named .aider.model.settings.yml with the following:

- name: github_copilot/o3-mini
  # edit_format: diff
  extra_params:
    max_tokens: 80000
    extra_headers:
      User-Agent: GithubCopilot/1.155.0
      Editor-Plugin-Version: copilot/1.155.0
      Editor-Version: vscode/1.85.1
      Copilot-Integration-Id: copilot-chat

- name: github_copilot/o4-mini
  # edit_format: diff
  extra_params:
    max_tokens: 80000
    extra_headers:
      User-Agent: GithubCopilot/1.155.0
      Editor-Plugin-Version: copilot/1.155.0
      Editor-Version: vscode/1.85.1
      Copilot-Integration-Id: vscode-chat

- name: github_copilot/gemini-2.5-pro
  edit_format: diff-fenced
  extra_params:
    max_tokens: 80000
    extra_headers:
      User-Agent: GithubCopilot/1.155.0
      Editor-Plugin-Version: copilot/1.155.0
      Editor-Version: vscode/1.85.1
      Copilot-Integration-Id: vscode-chat

- name: github_copilot/claude-sonnet-4
  # edit_format: diff
  extra_params:
    max_tokens: 80000
    extra_headers:
      User-Agent: GithubCopilot/1.155.0
      Editor-Plugin-Version: copilot/1.155.0
      Editor-Version: vscode/1.85.1
      Copilot-Integration-Id: vscode-chat

- name: github_copilot/gpt-4.1
  # edit_format: diff
  extra_params:
    max_tokens: 80000
    extra_headers:
      User-Agent: GithubCopilot/1.155.0
      Editor-Plugin-Version: copilot/1.155.0
      Editor-Version: vscode/1.85.1
      Copilot-Integration-Id: vscode-chat

Once you have those two files setup and saved, you can now run aider with the following command:

aider --model github_copilot/gpt-4.1 

The first time you do it, it will ask you to authenticate to GitHub, complete that process and you will be able to use Aider with GH copilot models.

Next Steps

I highly recommend taking a look at the usage documentation for aider as it has many tips on how to effectively vibe code with it. Aider is pretty powerful and very customisable but can be pretty overwhelming in the beginning, so make sure to read the docs.

Thanks for reading.

Subscribe to my occasionally chaotic newsletter.

No spam, no sharing to third party. Only you and me.

Member discussion