GitHub Copilot in VS Code can use models from outside GitHub through its bring-your-own-key (BYOK) Custom Endpoint provider. With Tokens, the Custom Endpoint sends OpenAI Chat Completions requests to https://tokens.bd/v1/chat/completions, and the models show up in Copilot Chat's model picker.
The Custom Endpoint provider replaces the older "OpenAI Compatible" provider and the github.copilot.chat.customOAIModels setting, both deprecated. If you configured Tokens that way before, move to the steps below.
What BYOK covers in Copilot#
Per VS Code's docs, BYOK models are used for chat and utility tasks only. Inline suggestions, semantic search and embeddings still go through GitHub. Your Copilot subscription still matters for those.
On Copilot Business and Enterprise, admins can disable BYOK by policy. If the Custom Endpoint option is missing, ask whoever manages your organization's Copilot settings.
Add a Custom Endpoint for Tokens in VS Code#
1. Create a key#
Create a key in the dashboard. A key used only by Copilot, with its own monthly spend cap, is easy to track and revoke. API keys explains the options.
2. Run the wizard#
- Open the model picker in Copilot Chat, click the gear, and choose Manage Language Models. You can also run Chat: Manage Language Models from the command palette.
- Choose Add Models, then Custom Endpoint.
- Enter a group name (
Tokens), a display name, and your API key. - Choose the API type Chat Completions.
VS Code then opens chatLanguageModels.json.
3. Edit chatLanguageModels.json#
Make the Tokens entry look like this:
[
{
"name": "Tokens",
"vendor": "customendpoint",
"apiKey": "${input:tokensApiKey}",
"apiType": "chat-completions",
"models": [
{
"id": "deepseek/deepseek-v4.1-flash",
"name": "DeepSeek V4.1 Flash (Tokens)",
"url": "https://tokens.bd/v1/chat/completions",
"toolCalling": true,
"vision": false,
"maxInputTokens": 120000,
"maxOutputTokens": 8192
}
]
}
]Notes on the fields:
idis the exact Tokens model ID, sent upstream as is.urlcan be the full endpoint, as here. VS Code uses a URL that already ends in/chat/completions,/responsesor/messageswithout changes. Otherwise it appends the path for the API type, and inserts/v1if it's missing. Writing the full URL removes any guesswork.apiKeyuses an input variable, so the raw key isn't stored in the JSON file. If you paste a literal key instead, treat this file as a secret.toolCalling: trueis needed for Copilot's agent mode. Set it only for models that support tool calling.visionshould betrueonly for models with image input.maxInputTokensandmaxOutputTokensare example values. Use the model's limits from the model catalog.
The key is sent as Authorization: Bearer, which Tokens accepts.
Switch models#
Add one object to models per Tokens model, each with its own id, name and limits. They appear under the Tokens group in the Copilot Chat model picker. Get exact IDs from the catalog or:
curl -s https://tokens.bd/v1/models -H "Authorization: Bearer $TOKENS_API_KEY"For help picking, see Choosing a model.
Anthropic Messages variant#
The Custom Endpoint also supports the Anthropic Messages API. Set "apiType": "messages" and "url": "https://tokens.bd/v1/messages". With this type VS Code sends the key in x-api-key, which Tokens also accepts. The request format is in Messages. Chat Completions is the simpler default.
Verify it works#
Test the key outside VS Code first:
export TOKENS_API_KEY=tok_live_your_key
curl -s https://tokens.bd/v1/chat/completions \
-H "Authorization: Bearer $TOKENS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek/deepseek-v4.1-flash", "max_tokens": 16, "messages": [{"role": "user", "content": "Reply with OK"}]}'Then open Copilot Chat, pick "DeepSeek V4.1 Flash (Tokens)" in the model picker, and ask a question. In agent mode, ask it to read a file to confirm tool calling. The request shows in your dashboard usage analytics.
Troubleshooting#
No Custom Endpoint option. Your VS Code or Copilot Chat version is older, or an organization policy disables BYOK.
401 invalid_api_key or missing_api_key. The key wasn't entered or is wrong, revoked or rotated. Rotating a key stops the old secret immediately. Re-run the wizard to enter the new one.
404 model_not_found. The id must be the full Tokens ID, such as deepseek/deepseek-v4.1-flash.
404 with an odd path. Check url. A doubled path such as /v1/chat/completions/chat/completions means you combined a full URL with something that appends a path. Use the full URL exactly as shown.
The model isn't offered in agent mode. Set toolCalling: true.
Inline suggestions don't use Tokens. Expected; BYOK doesn't cover them.
402 insufficient_credits or 429 errors. Top up in billing, or see Troubleshooting for rate limits.
Copilot's requests follow Chat Completions. If you'd rather have an agent that runs everything through your key, see Cline or Continue.
Source: VS Code docs, language models and Custom Endpoint, checked October 2026.