GitHub Copilot¶
In VS Code, Copilot Chat can use models you bring yourself. Add the gateway as one of them and chat, agent mode and inline chat on that model are governed: checked against your policies, charged to your team and recorded in Request logs. Copilot's code completions and its own models stay with GitHub.
What it is¶
GitHub Copilot is GitHub's AI assistant, in VS Code, other editors and on github.com. In VS Code, the chat lets you
add models from a Custom Endpoint ("bring your own key"): you give an address, a key and the API type, and VS Code
sends that model's requests there. Copilot in JetBrains editors, the Copilot CLI (providers[].baseUrl) and the
Copilot app accept a custom endpoint too; github.com, the cloud agent and code review don't, so they can't use the
gateway.
The two settings¶
- In the chat's model picker, choose Manage Language Models, then Add Models › Custom Endpoint.
- Enter a group name (for example
Vidai), a display name and your Vidai key (startsvk_). - Choose the API type: Chat Completions for any model, or Messages for Claude models.
- VS Code opens
chatLanguageModels.json; fill in the models and save.
[
{
"name": "Vidai",
"vendor": "customendpoint",
"apiKey": "${input:vidaiKey}",
"apiType": "chat-completions",
"models": [
{
"id": "gpt-4.1",
"name": "GPT-4.1 (Vidai)",
"url": "https://<your-gateway>/v1/chat/completions",
"toolCalling": true,
"vision": true,
"maxInputTokens": 128000,
"maxOutputTokens": 16000
},
{
"id": "gemini-3.5-flash",
"name": "Gemini 3.5 Flash (Vidai)",
"url": "https://<your-gateway>/v1/chat/completions",
"toolCalling": true,
"vision": true,
"maxInputTokens": 200000,
"maxOutputTokens": 32000
}
]
}
]
[
{
"name": "Vidai Claude",
"vendor": "customendpoint",
"apiKey": "${input:vidaiKey}",
"apiType": "messages",
"models": [
{
"id": "claude-sonnet-4.5",
"name": "Claude Sonnet 4.5 (Vidai)",
"url": "https://<your-gateway>/v1/messages",
"toolCalling": true,
"vision": true,
"maxInputTokens": 200000,
"maxOutputTokens": 32000
}
]
}
]
| Setting | Field | Value |
|---|---|---|
| Base address | url on each model |
https://<your-gateway>/v1/chat/completions (or /v1/messages); the full path avoids guessing |
| Key | apiKey, best as an input variable such as ${input:vidaiKey} |
Your Vidai key |
VS Code sends the key as Authorization: Bearer for Chat Completions and as x-api-key for Messages; the gateway
accepts both. Don't point a model at an Azure-style URL: VS Code then sends the key in Azure's api-key header, which
the gateway doesn't accept. The gateway's address is under Connect your app on the Keys page and in
System › Settings › Gateway; the key comes from Keys › Issue a key (its secret is shown once). The token limits in the
examples are placeholders: use your model's own.
A minimal call¶
- Save
chatLanguageModels.jsonand pick GPT-4.1 (Vidai) in the chat's model picker (restart VS Code if it doesn't appear). - Send "Reply with exactly: ok". A short answer means the address and key are right.
Streaming¶
Chat streams its answers. A stream from Claude or Gemini on the Chat Completions type arrives as OpenAI chunks.
Tool calls¶
Agent mode only offers models marked "toolCalling": true. Tool calls work on every provider the gateway translates
to.
Reading what the gateway did¶
VS Code doesn't show response headers. Look the call up in Request logs: filter on Key, Model or Path.
Errors¶
The chat shows the gateway's error message. Common ones: 401 invalid_api_key, 403 model_not_allowed, 404
model_not_found (check id), 429 (a limit on the key or team). The full list is in
Headers and errors.
Model names¶
id is the name your organisation approved under Models in the Control room; name is the label in VS Code's
picker.
What goes through the gateway¶
| Copilot feature | Through the gateway |
|---|---|
| Chat, agent mode and inline chat with a model you added | Yes |
| Utility tasks (titles, summaries, commit messages) | Only if you set chat.utilityModel and chat.utilitySmallModel to a model you added |
| Inline suggestions (code completions) | No: always GitHub's service |
| Embeddings and semantic search of your workspace | No: GitHub's service |
| Copilot's own models, Copilot on github.com, other editors | No |
| The Responses API type | OpenAI models only: Responses isn't translated to other providers |
Check it works in a minute¶
Send "Reply with exactly: ok" with your model selected, then open Request logs a few seconds later and filter on your key.
Good to know¶
- On Copilot Business and Enterprise, an organisation admin can turn this off with the Bring Your Own Language Model Key in VS Code policy on GitHub. If Custom Endpoint is missing, ask them.
- The older
github.copilot.chat.customOAIModelssetting is deprecated; use the Custom Endpoint provider. - VS Code's docs: AI language models in VS Code.