A rebranded fork of oai-compatible-copilot under the MIT license. See NOTICE for attribution.
Model Bridge registers itself as a model provider for GitHub Copilot Chat. Point it at any OpenAI-compatible gateway — a hosted router, a self-hosted vLLM, a local Ollama — and every model you register shows up in the Copilot model picker with correct context limits, vision and tool-calling capabilities.
New in this fork: the configuration UI is rebuilt as a tabbed control center. Every colour resolves from your active VS Code theme, borders meet WCAG 3:1 non-text contrast, focus is always visible, and the whole console is keyboard navigable. Behaviour is unchanged.
Why Model Bridge
|
|
| Five protocols |
openai, openai-responses, ollama, anthropic, gemini — one provider, no extra plugins. |
| Many providers at once |
Per-provider keys and base URLs. Same model can appear twice with different configId. |
| Capabilities that are honest |
Declare vision and tool calling per model so Copilot routes work correctly. |
| Resilient by default |
Retries on 429/5xx with backoff, per-model throttle delay. |
| Eyes on spend |
Live tok/s in the status bar, five-minute speed chart on hover, token budget bar. |
| Commit messages |
Generate them from the Source Control panel in 14 languages. |
Features
- Multi-API support: OpenAI / Ollama / Anthropic / Gemini (ModelScope, SiliconFlow, DeepSeek, vLLM…)
- Vision models: image input for models that support it
- Advanced configuration: thinking / reasoning control per model
- Multi-provider management: configure several providers with automatic API key handling
- Multi-config per model: e.g. GLM-4.6 with and without thinking
- Visual control center: tabbed console for global policy, providers and models
- Auto-retry: handles 429/500/502/503/504 with backoff
- Token usage: real-time counting, live generation speed, five-minute speed chart
- Git integration: generate commit messages from the SCM view
- Import / export: share and back up configuration
- Tools optimization: keeps agent
read_file calls from reading large files in tiny chunks
Requirements
- VS Code 1.120.0 or higher.
- An API key for at least one OpenAI-compatible endpoint.
Quick start
- Install Model Bridge: download the latest VSIX and run
code --install-extension model-bridge-0.4.3.vsix, or build from source with npm ci && npm run build.
- Run Model Bridge: 打开 Model Bridge 控制台 from the Command Palette.
- In 服务商, add a provider: Base URL + API key, then 保存并同步.
- Pick the models you want and apply.
- Open Copilot Chat, click the model picker, choose Model Bridge.
Prefer JSON? Set modelbridge.baseUrl and modelbridge.models directly:
"modelbridge.baseUrl": "https://api-inference.modelscope.cn/v1",
"modelbridge.models": [
{
"id": "Qwen/Qwen3-Coder-480B-A35B-Instruct",
"owned_by": "modelscope",
"context_length": 256000,
"max_tokens": 8192,
"temperature": 0,
"top_p": 1
}
]
Configuration UI
The extension provides a visual configuration interface that makes it easy to manage global settings, providers, and models without editing JSON files manually.
Opening the Configuration UI
There are two ways to open the configuration interface:
From the Command Palette:
- Press
Ctrl+Shift+P (or Cmd+Shift+P on macOS)
- Search for "Model Bridge: Open Model Bridge Console" (打开 Model Bridge 控制台)
- Select the command to open the configuration panel
From the Status Bar:
- Click the Model Bridge status bar item in the bottom-right corner of VS Code
Click Here for Details
Workflow Example
Add a Provider:
- Click "Add Provider" in the Provider Management section
- Enter Provider ID: "modelscope"
- Enter Base URL: "https://api-inference.modelscope.cn/v1"
- Enter API Key: Your ModelScope API key
- Select API Mode: "openai"
- Click "Save"
Add a Model:
- Click "Add Model" in the Model Management section
- Select Provider: "modelscope"
- Enter Model ID: "Qwen/Qwen3-Coder-480B-A35B-Instruct"
- Configure basic parameters (context length, max tokens, etc.)
- Click "Save Model"
Use the Model in VS Code:
- Open GitHub Copilot Chat (
Ctrl+Shift+I or Cmd+Shift+I)
- Click the model picker in the chat input
- Select "Manage Models..."
- Choose the Model Bridge provider
- Select your configured models
- Start chatting with the model!
Tips & Best Practices
- Important: If you use the configuration UI, the global baseURL and API key become invalid.
- Provider IDs: Use descriptive names that match the service (e.g., "modelscope", "iflow", "anthropic")
- Model IDs: Use the exact model identifier from the provider's documentation
- Config IDs: Use meaningful names like "thinking", "no-thinking", "fast", "accurate" for multiple configurations
- Base URL Overrides: Set model-specific base URLs when using models from different endpoints of the same provider
- Save Frequently: Changes are saved to VS Code settings immediately
- Refresh: Use the "Refresh" buttons to reload current configuration from VS Code settings
Model family & System Prompts
VS Code Copilot has optimized system prompts for specific models. Detailed introduction
Below are the model family settings supported by Copilot:
| Model Family |
General family |
Specific Model family |
Notes |
| Anthropic |
'claude', 'Anthropic' |
'claude-sonnet-4-5', 'claude-haiku-4-5' |
|
| Gemini |
'gemini' |
'gemini-3-flash' |
"github.copilot.chat.alternateGeminiModelFPrompt.enabled": true |
| xAI |
'grok-code' |
|
|
| OpenAI |
'gpt', 'o4-mini', 'o3-mini', 'OpenAI' |
'gpt-4.1', 'gpt-5-codex', 'gpt-5', 'gpt-5-mini', !!family.startsWith('gpt-') && family.includes('-codex'), !!family.match(/^gpt-5\.\d+/i) |
"github.copilot.chat.alternateGptPrompt.enabled": true |
✨ Multi-API Mode
The extension supports five different API protocols to work with various model providers. You can specify which API mode to use for each model via the apiMode parameter.
Supported API Modes
openai (default) - OpenAI Chat Completions API
- Endpoint:
/chat/completions
- Header:
Authorization: Bearer <apiKey>
- Use for: Most OpenAI-compatible providers (ModelScope, SiliconFlow, etc.)
openai-responses - OpenAI Responses API
- Endpoint:
/responses
- Header:
Authorization: Bearer <apiKey>
- Use for: OpenAI official Responses API (and compatible gateways like rsp4copilot)
ollama - Ollama native API
- Endpoint:
/api/chat
- Header:
Authorization: Bearer <apiKey> (or no header for local Ollama)
- Use for: Local Ollama instances
anthropic - Anthropic Claude API
- Endpoint:
/v1/messages
- Header:
x-api-key: <apiKey>
- Use for: Anthropic Claude models
gemini - Gemini native API
- Endpoint:
/v1beta/models/{model}:streamGenerateContent?alt=sse
- Header:
x-goog-api-key: <apiKey>
- Use for: Google Gemini models (and compatible gateways like rsp4copilot)
Click Here for Details
Configuration Examples
Mixed configuration with multiple API modes:
"modelbridge.models": [
{
"id": "GLM-4.6",
"owned_by": "modelscope",
},
{
"id": "llama3.2",
"owned_by": "ollama",
"baseUrl": "http://localhost:11434",
"apiMode": "ollama"
},
{
"id": "claude-3-5-sonnet-20241022",
"owned_by": "anthropic",
"baseUrl": "https://api.anthropic.com",
"apiMode": "anthropic"
}
]
Important Notes
- The
apiMode parameter defaults to "openai" if not specified.
- When using
ollama mode, you can omit the API key (ollama by default) or set it to any string.
- Each API mode uses different message conversion logic internally to match provider-specific formats (tools, images, thinking).
"openai-responses" (and the responses wire API in general) is subject to a VS Code tool-count cap — see Tool count limit.
✨ Multi-Provider Guide
owned_by (alias: provider / provide) in model config is used for grouping provider-specific API keys. The storage key is modelbridge.apiKey.<providerIdLowercase>.
- Open VS Code Settings and configure
modelbridge.models.
- Open command center ( Ctrl+Shift+P ), and search "Model Bridge: Set Provider API Key" to configure provider-specific API keys.
- Open GitHub Copilot Chat interface.
- Click the model picker and select "Manage Models...".
- Choose the Model Bridge provider.
- Select the models you want to add to the model picker.
Click Here for Details
Settings Example
"modelbridge.baseUrl": "https://api-inference.modelscope.cn/v1",
"modelbridge.models": [
{
"id": "Qwen/Qwen3-Coder-480B-A35B-Instruct",
"owned_by": "modelscope",
"context_length": 256000,
"max_tokens": 8192,
"temperature": 0,
"top_p": 1
},
{
"id": "qwen3-coder",
"owned_by": "iflow",
"baseUrl": "https://apis.iflow.cn/v1",
"context_length": 256000,
"max_tokens": 8192,
"temperature": 0,
"top_p": 1
}
]
✨ Multi-config for the same model
You can define multiple configurations for the same model ID by using the configId field. This allows you to have the same base model with different settings for different use cases.
Click Here for Details
To use this feature:
- Add the
configId field to your model configuration
- Each configuration with the same
id must have a unique configId
- The model will appear as separate entries in the VS Code model picker
Settings Example
"modelbridge.models": [
{
"id": "glm-4.6",
"configId": "thinking",
"owned_by": "zai",
"temperature": 0.7,
"top_p": 1,
"thinking": {
"type": "enabled"
}
},
{
"id": "glm-4.6",
"configId": "no-thinking",
"owned_by": "zai",
"temperature": 0,
"top_p": 1,
"thinking": {
"type": "disabled"
}
}
]
In this example, you'll have three different configurations of the glm-4.6 model available in VS Code:
glm-4.6::thinking - use GLM-4.6 with thinking
glm-4.6::no-thinking - use GLM-4.6 without thinking
You can specify custom HTTP headers that will be sent with every request to a specific model's provider. This is useful for:
- API versioning headers
- Custom authentication headers (in addition to the standard Authorization header)
- Provider-specific headers required by certain APIs
- Request tracking or debugging headers
Click Here for Details
"modelbridge.models": [
{
"id": "custom-model",
"owned_by": "provider",
"baseUrl": "https://api.example.com/v1",
"headers": {
"X-API-Version": "2024-01",
"X-Request-Source": "vscode-copilot",
"Custom-Auth-Token": "additional-token-if-needed"
}
}
]
Important Notes:
- Custom headers are merged with default headers (Authorization, Content-Type, User-Agent)
- If a custom header conflicts with a default header, the custom header takes precedence
- Headers are applied on a per-model basis, allowing different headers for different providers
- Header values must be strings
✨ Custom Request body parameters
The extra field allows you to add arbitrary parameters to the API request body. This is useful for provider-specific features that aren't covered by the standard parameters.
How it works
- Parameters in
extra are merged directly into the request body
- Works with all API modes (
openai, openai-responses, ollama, anthropic, gemini)
- Values can be any valid JSON type (string, number, boolean, object, array)
Click Here for Details
Common use cases
- OpenAI-specific parameters:
seed, logprobs, top_logprobs, suffix, presence_penalty (if not using standard parameter)
- Provider-specific features: Custom sampling methods, debugging flags
- Experimental parameters: Beta features from API providers
Configuration Example
"modelbridge.models": [
{
"id": "custom-model",
"owned_by": "openai",
"extra": {
"seed": 42,
"logprobs": true,
"top_logprobs": 5,
"suffix": "###",
"presence_penalty": 0.1
}
},
{
"id": "local-model",
"owned_by": "ollama",
"baseUrl": "http://localhost:11434",
"apiMode": "ollama",
"extra": {
"keep_alive": "5m",
"raw": true
}
},
{
"id": "claude-model",
"owned_by": "anthropic",
"baseUrl": "https://api.anthropic.com",
"apiMode": "anthropic",
"extra": {
"service_tier": "standard_only"
}
}
]
Show thinking in Copilot
These are provider-specific parameters that can make Copilot show a Thinking block (if the provider/model supports it).
OpenAI Responses
Use apiMode: "openai-responses" and set the reasoning summary mode:
{
"id": "gpt-4o-mini",
"owned_by": "openai",
"baseUrl": "https://api.openai.com/v1",
"apiMode": "openai-responses",
"reasoning_effort": "high",
"extra": {
"reasoning": {
"summary": "detailed"
}
}
}
Gemini
Use apiMode: "gemini" and enable thought summaries:
{
"id": "gemini-3-flash-preview",
"owned_by": "gemini",
"baseUrl": "https://generativelanguage.googleapis.com",
"apiMode": "gemini",
"extra": {
"generationConfig": {
"thinkingConfig": {
"includeThoughts": true
}
}
}
}
Important Notes
- Parameters in
extra are added after standard parameters
- If an
extra parameter conflicts with a standard parameter, the extra value takes precedence
- Use this for provider-specific features only
- Standard parameters (temperature, top_p, etc.) should use their dedicated fields when possible
- API provider must support the parameters you specify
Model Parameters
All parameters support individual configuration for different models, providing highly flexible model tuning capabilities.
id (required): Model identifier
owned_by (required): Model provider
displayName: Display name for the model that will be shown in the Copilot interface.
configId: Configuration ID for this model. Allows defining the same model with different settings (e.g. 'glm-4.6::thinking', 'glm-4.6::no-thinking')
family: Model family (e.g., 'gpt-4', 'claude-3', 'gemini'). Enables model-specific optimizations and behaviors. Defaults to 'oai-compatible' if not specified.
baseUrl: Model-specific base URL. If not provided, the global modelbridge.baseUrl will be used
context_length: The context length supported by the model. Default value is 128000
max_tokens: Maximum number of tokens to generate (range: [1, context_length]). Default value is 4096
max_completion_tokens: Maximum number of tokens to generate (OpenAI new standard parameter). If it would leave less than 25% of context_length for the prompt, it is capped automatically.
vision: Whether the model supports vision capabilities. Defaults to false
temperature: Sampling temperature (range: [0, 2]). Controls the randomness of the model's output:
- Lower values (0.0-0.3): More focused, consistent, and deterministic. Ideal for precise code generation, debugging, and tasks requiring accuracy.
- Moderate values (0.4-0.7): Balanced creativity and structure. Good for architecture design and brainstorming.
- Higher values (0.7-2.0): More creative and varied responses. Suitable for open-ended questions and explanations.
- Best Practice: Set to
0 to align with GitHub Copilot's default deterministic behavior for consistent code suggestions. Thinking-enabled models suggest 1.0 to ensure optimal performance of the thinking mechanism.
top_p: Top-p sampling value (range: (0, 1]). Optional parameter
top_k: Top-k sampling value (range: [1, ∞)). Optional parameter
min_p: Minimum probability threshold (range: [0, 1]). Optional parameter
frequency_penalty: Frequency penalty (range: [-2, 2]). Optional parameter
presence_penalty: Presence penalty (range: [-2, 2]). Optional parameter
repetition_penalty: Repetition penalty (range: (0, 2]). Optional parameter
enable_thinking: Enable model thinking and reasoning content display (for non-OpenRouter providers)
thinking_budget: Maximum token count for thinking chain output. Optional parameter
reasoning: OpenRouter reasoning configuration, includes the following options:
enabled: Enable reasoning functionality (if not specified, will be inferred from effort or max_tokens)
effort: Reasoning effort level (high, medium, low, minimal, auto)
exclude: Exclude reasoning tokens from the final response
max_tokens: Specific token limit for reasoning (Anthropic style, as an alternative to effort)
thinking: Thinking configuration for Zai provider
type: Set to 'enabled' to enable thinking, 'disabled' to disable thinking
reasoning_effort: Reasoning effort level (OpenAI reasoning configuration)
headers: Custom HTTP headers to be sent with every request to this model's provider (e.g., {"X-API-Version": "v1", "X-Custom-Header": "value"}). These headers will be merged with the default headers (Authorization, Content-Type, User-Agent)
extra: Extra request body parameters.
include_reasoning_in_request: Whether to include reasoning_content in assistant messages sent to the API. Supports deepseek-v3.2 and similar models.
apiMode: API mode: 'openai' (Default) for API (/chat/completions), 'openai-responses' for API (/responses), 'ollama' for API (/api/chat), 'anthropic' for API (/v1/messages), 'gemini' for API (/v1beta/models/{model}:streamGenerateContent?alt=sse).
delay: Model-specific delay in milliseconds between consecutive requests. If not specified, falls back to global modelbridge.delay configuration.
useForCommitGeneration: Whether to be used for Git commit message generation. Not supports gemini apiMode.
VS Code's agent host hard-codes a ceiling of 128 tools per request for the BYOK
/responses proxy path:
var Gre = 128;
function ANe(request, limit = Gre) { /* trims request.tools beyond `limit` */ }
When a session exposes more tools than that, VS Code silently drops the extras and shows:
The model only supports 128 tools, 27 tools were not provided to the model. Configure Tools
The cap lives in VS Code, so neither modelbridge.models nor capabilities.toolCalling
can raise it — the extension host coerces toolCalling to a boolean before the agent host
reads it, and the trim is unconditional. The ceiling is on tool count, not tokens, so
it is unrelated to context_length.
Fix: keep the tool inventory at or under 128. Exclude the MCP servers you do not use
with chat.agentHost.copilot.modelCapabilityOverrides:
"chat.agentHost.copilot.modelCapabilityOverrides": {
"*": {
"excludedTools": ["GitKraken/*", "luban/*", "blender/*"]
}
}
Patterns are matched case-insensitively against a tool's server name:
| Pattern |
Matches |
server/* |
every tool from that MCP server |
server/toolName |
one namespaced MCP tool |
builtin:* / builtin:<name> |
VS Code's own runtime tools |
custom:* / custom:<name> |
every tool VS Code registers with the SDK |
* |
all three sources |
The key ("*" above) is the model id, so "deepseek-flash" restricts a single model.
availableTools works the same way but allowlists instead; excludedTools wins over it.
Both are applied when a session launches or resumes, so reload the window afterwards.
Confirm the result in the agent host log — the warning disappears once the count fits:
%APPDATA%\Code\logs\<timestamp>\agenthost.log
[ByokLmProxyService] ... sending 128 of 155 tools ... dropped 27 tool(s)
Thanks to
Thanks to all the people who contribute.
Support & License
| |