Skip to content

GitHub Copilot With Azure OpenAI

This guide describes how to configure GitHub Copilot Chat in VS Code to use Azure OpenAI models through the OAI Compatible Provider for Copilot extension.

Important

Please disable code completions if you plan to use GitHub Copilot. We are charged separately for code completions versus conversational interactions. To disable completions, follow these instructions:

  1. Open preferences with CTRL+SHIFT+P and type in Preferences:Open User Settings
  2. Expand the "Extensions" section and select "GitHub Copilot Chat"
  3. Uncheck all settings related to "inline suggestions" or "next edit suggestions". Note that the name for these changes constantly and you may need to do some digging.
    Github Copilot settings to disable

  4. You can also click the GitHub Copilot icon in the bottom right and disable code suggestions using that menu if needed.

Prerequisites

  • Visual Studio Code installed
  • GitHub Copilot access enabled for your GitHub account
  • Azure OpenAI endpoint and API key for the model you want to use

1. Install VS Code

Download and install Visual Studio Code if it is not already installed.

2. Install the OAI Compatible Provider Extension

  1. Open VS Code.
  2. Open the Extensions pane.
  3. Search for OAI Compatible Provider for Copilot.
  4. Install the extension.

3. Open User Settings JSON

Open the VS Code user settings JSON file:

  1. Open the Command Palette with Ctrl+Shift+P.
  2. Run Preferences: Open User Settings (JSON).
  3. Add the Azure OpenAI model configuration to the JSON object.

Do not commit API keys or personal settings files to source control.

4. Add an Azure OpenAI Model

Follow this pattern in settings.json to register an Azure OpenAI model:

{
  "oaicopilot.models": [
    {
      "id": "gpt-5-mini",
      "displayName": "AIML GPT 5 Mini",
      "owned_by": "azure-openai",
      "baseUrl": "https://aif-aiml-dev.services.ai.azure.com/api/projects/aiml/openai/v1",
      "apiMode": "openai-responses",
      "context_length": 128000,
      "max_tokens": 4096
    }
  ]
}

If your settings.json already has other settings, add only the "oaicopilot.models" property and keep the existing JSON valid.

5. Enable OAI Models in Copilot Chat

  1. Open the GitHub Copilot Chat window in VS Code.
  2. Expand the model picker.
  3. Select More Models.
  4. Disable all public hosted models.
  5. Ensure all OAI models are enabled.
  6. Select the Azure OpenAI model you added, such as AIML GPT 5 Mini.

GitHub Copilot Chat should now route chat requests through the configured Azure OpenAI model.