Connect multiple OpenAI-compatible gateways and model providers to GitHub Copilot Chat.
English | 简体中文
Copilot Switch is a VS Code extension for users who want to use custom model providers inside GitHub Copilot Chat.
The original inspiration came from the need to connect Copilot Chat to an OpenAI-compatible API. This project focuses on a more flexible workflow: one extension can manage multiple gateway providers, multiple model entries, separate API keys, import/export, and model-level options from a visual Models Editor.
It is useful when you use several relay platforms, self-hosted gateways, local Ollama, or different API formats and want to switch between them from the Copilot Chat model picker.
- Register custom models in the GitHub Copilot Chat model picker.
- Manage multiple gateway providers instead of being limited to one relay endpoint.
- Add, edit, enable, disable, import, export, and refresh model configurations from the Models Editor.
- Store API keys in VS Code SecretStorage instead of plaintext configuration files.
- Fetch model IDs from supported provider endpoints when configuring a gateway.
- Support OpenAI Chat Completions, OpenAI Responses, Ollama, Anthropic Messages, and Gemini API modes.
- Configure model-level context length, output tokens, reasoning options, headers, extra request body fields, vision support, and request delay.
- Use a selected model to generate Git commit messages from the Source Control view.
- VS Code
1.111.0or later. - GitHub Copilot Chat installed and enabled.
- At least one provider API key or a local Ollama endpoint.
- Install and enable Copilot Switch.
- Run
Copilot Switch: Open Models Editorfrom the command palette, or click theCopilot Switchstatus bar item. - Add a provider endpoint with
baseUrl,apiMode, and API key. - Click
Fetch Modelswhen the provider supports model listing, or enter the model ID manually. - Save the model and enable it.
- Open GitHub Copilot Chat, choose
Manage Models..., selectCopilot Switch, and enable the models you want to use.
Copilot Switch stores model configuration in the user profile:
~/.copilot/copilot-switch/models.json
API keys are stored separately in VS Code SecretStorage and referenced by apiKeyId. This keeps secrets out of the JSON configuration and makes it safer to import, export, or share model templates.
Most users should use the Models Editor. Advanced users can edit the model JSON directly:
[
{
"displayName": "Qwen Coder via ModelScope",
"id": "Qwen/Qwen3-Coder-480B-A35B-Instruct",
"owned_by": "modelscope",
"baseUrl": "https://api-inference.modelscope.cn/v1",
"apiMode": "openai",
"apiKeyId": "modelscope",
"context_length": 256000,
"max_tokens": 8192,
"temperature": 0,
"top_p": 1,
"enabled": true
}
]apiMode |
Endpoint style | Typical use |
|---|---|---|
openai |
/chat/completions |
OpenAI-compatible gateways such as ModelScope, SiliconFlow, DeepSeek gateways, and custom relay services |
openai-responses |
/responses |
OpenAI Responses API and compatible gateways |
ollama |
/api/chat |
Local or remote Ollama |
anthropic |
/v1/messages |
Anthropic Claude API and compatible gateways |
gemini |
Gemini stream API | Google Gemini API and compatible gateways |
Common fields:
displayName: name shown in Copilot Chat and the Models Editor.id: provider model ID.owned_by: provider or gateway group ID.baseUrl: provider or gateway endpoint.apiMode: one ofopenai,openai-responses,ollama,anthropic,gemini.apiKeyId: SecretStorage key reference used to find the API key.configId: optional suffix for multiple configurations of the same model.family: optional Copilot model family hint.context_length,max_tokens,temperature,top_p: common generation parameters.vision: set totruefor image-capable models.reasoning,reasoning_effort,thinking,enable_thinking,thinking_budget: reasoning options supported by different providers.headers: custom HTTP headers.extra: extra JSON fields merged into the request body.delay: model-specific delay in milliseconds.enabled: whether the model is available in the picker.useForCommitGeneration: whether this model can generate Git commit messages.
npm install
npm run compile
npm run lint
npm run test
npm run buildCopilot Switch is inspired by and respectfully references oai-compatible-copilot. Thanks to the original project for exploring the OpenAI-compatible Copilot Chat provider idea.
Additional references:
MIT License.



