AI language models in VS Code
Visual Studio Code offers different built-in language models that are optimized for different tasks. You can also bring your own language model API key to use models from other providers. This article describes how to change the language model for chat or code completions, and how to use your own API key.
Choose the right model for your task
By default, chat uses a base model to provide fast, capable responses for a wide range of tasks, such as coding, summarization, knowledge-based questions, reasoning, and more.
However, you are not limited to using only this model. You can choose from a selection of language models, each with its own particular strengths. For a detailed comparison of AI models, see Choosing the right AI model for your task in the GitHub Copilot documentation.
Depending on the chat mode you are using, the list of available models might be different. For example, in agent mode, the list of models is limited to those that have good support for tool calling.
If you are a Copilot Business or Enterprise user, your administrator needs to enable certain models for your organization by opting in to Editor Preview Features
in the Copilot policy settings on GitHub.com.
Change the model for chat conversations
Use the language model picker in the chat input field to change the model that is used for chat conversations and code editing.
You can further extend the list of available models by using your own language model API key.
If you have a paid Copilot plan, the model picker shows the premium request multiplier for premium models. Learn more about premium requests in the GitHub Copilot documentation.
Auto model selection (Preview)
Auto model selection is available as of VS Code release 1.104 and is currently in preview. We are rolling out auto to all GitHub Copilot users in VS Code in the following weeks, starting with the individual GitHub Copilot plans.
With auto model selection, VS Code automatically selects a model to ensure that you get the optimal performance and reduce rate limits due to excessive usage of particular language models. It detects degraded model performance and uses the best model at that point in time. We continue to improve this feature to pick the most suitable model for your needs.
To use auto model selection, select Auto from the model picker in chat.
Currently, auto chooses between Claude Sonnet 4, GPT-5, GPT-5 mini and other models. If your organization has opted out of certain models, auto will not select those models. If none of these models are available or you run out of premium requests, auto will fall back to a model at 0x multiplier.
When using auto model selection, VS Code uses a variable model multiplier, based on the selected model. If you are a paid user, auto will apply a request discount.
At any time, you can see which model and model multiplier are used by hovering over the chat response.
Customize the model picker
If you want to reduce the number of built-in models that are shown in the model picker, you can customize which models you want to show:
-
Open the model picker and select Manage Models or run the Chat: Manage Language Models command from the Command Palette.
-
In the provider list, select Copilot.
-
Select the models you want to show in the model picker.
Change the model for code completions
To change the language model that is used for generating code completions in the editor:
-
Select Configure Code Completions... from the Chat menu in the VS Code title bar.
-
Select Change Completions Model..., and then select one of the models from the list.
The models that are available for code completions might evolve over time as we add support for more models.
Bring your own language model key
This feature is not currently available to Copilot Business or Copilot Enterprise users.
GitHub Copilot in VS Code comes with a variety of built-in language models that are optimized for different tasks. If you want to use a model that is not available as a built-in model, you can bring your own language model API key (BYOK) to use models from other providers.
Using your own language model API key in VS Code has several benefits:
- Model choice: access hundreds of models from different providers, beyond the built-in models.
- Experimentation: experiment with new models or features that are not yet available in the built-in models.
- Local compute: use your own compute for one of the models already supported in GitHub Copilot or to run models not yet available.
- Greater control: by using your own key, you can bypass the standard rate limits and restrictions imposed on the built-in models.
VS Code has built-in support for several model providers and if you have a model that is compatible with the OpenAI API, you can also configure a custom OpenAI-compatible model.
You can add more model providers via VS Code extensions, such as AI Toolkit for VS Code, Cerebras Inference, Hugging Face, and others. You can find more of these extensions in the Visual Studio Marketplace.
Configure models using your API key
To configure a language model from a model provider using your own API key:
-
Select Manage Models from the language model picker in the Chat view or run the Chat: Manage Language Models command from the Command Palette.
-
Hover over a model provider in the list, and select the gear icon to configure the provider details.
-
Enter the provider-specific details, such as the API key or endpoint URL.
-
Depending on the provider, enter the model details or select a model from the list.
The following screenshot shows the model picker for Ollama running locally, with the Phi-4 model deployed.
-
You can now select the model from the model picker in the Chat view and use it for chat conversations.
For a model to be available in agent mode, it must support tool calling. If the model doesn't support tool calling, it won't be shown in the model picker when you are using agent chat mode.
Update the provider details
To update the provider details, such as the API key or endpoint URL:
-
Select Manage Models from the language model picker in the Chat view or run the Chat: Manage Language Models command from the Command Palette.
-
Hover over a model provider in the list, and select the gear icon to edit the provider details.
-
Update the provider details, such as the API key or endpoint URL.
Use an OpenAI-compatible model
Configuring a custom OpenAI-compatible model is currently only available in VS Code Insiders as of release 1.104.
The custom OpenAI provider enables you use any OpenAI-compatible API endpoint and configure the models for use in chat.
To configure a custom OpenAI endpoint and model:
-
Run the Chat: Manage Language Models command from the Command Palette.
-
Select the gear icon next to the OpenAI Compatible provider.
-
Select Manage API Key to set the API key for your custom endpoint, if required.
-
Select Configure Models > Add New Model and follow the prompts to add the details for your model:
- Unique identifier for the model
- Display name for the model in the language model picker
- Full API endpoint URL
- Select the model capabilities, such as tool calling, vision, thinking, and whether the endpoint requires an API key.
- Maximum input and output token limits.
Alternatively, you can manually add your custom model configuration in the github.copilot.chat.customOAIModels setting.
Considerations
There are a number of considerations when using your own language model API key in VS Code:
- Bringing your own model only applies to the chat experience and doesn't impact code completions or other AI-powered features in VS Code, such as commit-message generation.
- The capabilities of each model might differ from the built-in models and could affect the chat experience. For example, some models might not support vision or tool calling.
- The Copilot API is still used for some tasks, such as sending embeddings, repository indexing, query refinement, intent detection, and side queries.
- When using your own model, there is no guarantee that responsible AI filtering is applied to the model's output.
Frequently asked questions
Why is bring your own model key not available for Copilot Business or Copilot Enterprise?
Bringing your own model key is not available for Copilot Business or Copilot Enterprise because it's mainly meant to allow users to experiment with the newest models the moment they are announced, and not yet available as a built-in model in Copilot.
Bringing your own model key will come to Copilot Business and Enterprise plans later this year, as we better understand the requirements that organizations have for using this functionality at scale. Copilot Business and Enterprise users can still use the built-in, managed models.
Can I use locally hosted models with Copilot in VS Code?
You can use locally hosted models in chat by using bring your own model key (BYOK) and using a model provider that supports connecting to a local model. You have different options to connect to a local model:
- Use a built-in model provider that supports local models
- Install an extension from the Visual Studio Marketplace, for example, AI Toolkit for VS Code with Foundry Local
- Configure a custom OpenAI-compatible model
Currently, you cannot connect to a local model for code completions. VS Code provides an extension API InlineCompletionItemProvider
that enables extensions to contribute a custom completion provider. You can get started with our Inline Completions sample.
Currently, using a locally hosted models still requires the Copilot service for some tasks. Therefore, your GitHub account needs to have access to a Copilot plan (for example, Copilot Free) and you need to be online. This requirement might change in a future release.
Can I use a local model without an internet connection?
Currently, using a local model requires access to the Copilot service and therefore requires you to be online. This requirement might change in a future release.
Can I use a local model without a Copilot plan?
No, currently you need to have access to a Copilot plan (for example, Copilot Free) to use a local model. This requirement might change in a future release.