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": "OpenAI Responses",
"id": "your-openai-model-id",
"owned_by": "openai",
"baseUrl": "https://api.openai.com/v1",
"apiMode": "openai-responses",
"apiKeyId": "openai",
"context_length": 128000,
"max_tokens": 4096,
"enabled": true
}
]apiMode |
Endpoint style | Typical use |
|---|---|---|
openai-responses |
/responses |
Recommended for the official OpenAI API and compatible gateways that implement Responses |
openai |
/chat/completions |
Legacy Chat Completions and OpenAI-compatible gateways such as ModelScope, SiliconFlow, DeepSeek gateways, and custom relay services |
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 for authorized provider or gateway requirements, such asOpenAI-Organization,OpenAI-Project, or an internal gateway header.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.
This extension calls provider APIs directly. Codex-only plugin and remote skill backends require Codex/ChatGPT authentication and host-side checks; spoofing Codex or ChatGPT client headers is not supported. Use openai-responses for the official OpenAI API, or route through your own gateway with honest, authorized headers.
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.



