How to Use Custom Models with API Keys in GitHub Copilot (VSCode) — Bring Your Own Key (BYOK)

Murtuzaali Surti
Murtuzaali Surti

• 3 min read

Updated

Table of Contents

With the "March 2025 (v1.99.0)" Visual Studio Code release, GitHub Copilot supports BYOK (Bring Your Own Keys), meaning, I can now use my own custom API key and use any models associated with it in GitHub Copilot VSCode extension.

Note that BYOK feature is not available to Copilot Business or Enterprise users yet. - code.visualstudio.com

GitHub Copilot Chat supports API keys generated from major AI platforms/providers, namely, Anthropic, Azure, OpenRouter, OpenAI, Gemini and Ollama.

In this tutorial, I will demonstrate how you can use custom API keys from multiple AI providers and use any models associated with them in GitHub Copilot Chat VSCode extension.

1. Open GitHub Copilot Chat

Go to the GitHub Copilot Chat window by clicking the copilot icon besides the search bar in VSCode. You can also access github copilot chat by using the shortcut Ctrl + Alt + I (Windows) or Ctrl + Command + I (MacOS).

github copilot chat vscode window panel

GitHub Copilot Chat

2. Manage Models

Click on the model name dropdown (claude-3-5-sonnet-202041022 in the image below) and select "Manage Models...".

github copilot chat vscode window panel (manage models)

GitHub Copilot Chat Manage Models Feature

3. Configuring AI Provider

Once you click on 'Manage Models...', a window will appear, listing all of the configured AI model providers. The manage models feature supports Anthropic, OpenAI, OpenRouter, Ollama, Azure, Groq, xAI, and Google. If you want to configure another available AI model provider which is not yet configured, click on 'Add Models' button.

github copilot chat vscode dialog (manage models > configure AI provider)

GitHub Copilot Chat Manage Models Feature (Configuring AI Provider)

4. Add Your API Key

Once you add a new AI platform/provider or modify a configured one, you will be asked to provide an API key (or you will be asked to sign in to microsoft account if you select Azure).

github copilot chat vscode dialog (manage models > select AI provider > insert API key)

GitHub Copilot Chat Manage Models Feature (Adding API keys)

5. Select AI Models

Once you enter the API key, the window listing configured AI model providers/platforms will refresh, and you can hide/show models which you plan to use with GitHub Copilot.

github copilot chat vscode dialog (manage models > select AI provider > insert API key > show/hide models to be used)

GitHub Copilot Chat Manage Models Feature (Selecting Models)

Using the AI Models

For instance, if I selected a total of five AI models across two AI providers, all of those five models will be listed in the model selection dropdown.

github copilot chat vscode panel (selecting AI model)

GitHub Copilot Chat (Selecting Model)

One thing that's missing in this Manage Models feature is the ability to show the AI platform/provider besides the model name. It will be really helpful to differentiate models based on providers, for example, OpenRouter and Anthropic both provide claude-3-5-sonnet model, so it will be helpful to know if I am using a claude model through OpenRouter or Anthropic directly.

I hope they add this in the future, considering the fact that the Manage Models feature in GitHub Copilot is still in preview.

UPDATE: Now, the models are categorized clearly. I can see the default Copilot provided models at the top and models from other providers below that with the name of the provider listed on the left side in a distinctive way.

github copilot chat vscode panel (selecting AI model) now updated with model categorization

Updated GitHub Copilot Chat (Selecting Model)


TypeScript Switches To Go — What Does This Mean for Developers?

Previous

MCP (Model Context Protocol) Explained — All You Need To Know

Next