DEV Community

Adela for BetterToken.ai

Posted on Edited on Originally published at bettertoken.ai

Configure a GitHub Copilot Custom Endpoint

You can connect an external model to Copilot Chat through a BetterToken Custom Endpoint. Your GitHub account, Copilot plan, and API access control different features. Current VS Code versions store the key in local secret storage; you can then verify the request in Chat and the Dashboard. This setup does not change inline completions or GitHub service access.

You need your own API key before configuring the endpoint. Create a BetterToken account

What you are configuring

Copilot has several independent layers. If you separate them before setting up, it will be easier to understand why Chat is responding, but the tooltips in the editor have not changed.

Layer What it controls Does a Custom Endpoint replace it?
GitHub Account Sign in and access GitHub-served features It is not required for BYOK Chat in VS Code, but other features can require it
Copilot Plan Quotas and capabilities of the Copilot service It is not required for BYOK Chat in VS Code; a Custom Endpoint does not grant plan features
Local BYOK / Custom Endpoint Selecting an external model in a supported client and Chat surface Only requests that the client sends to the selected model
Inline completions Completing code directly in the editor No, they remain part of the GitHub Copilot

GitHub specifically describes local BYOK: The key is stored on the device and support varies by client. In a Business or Enterprise organization, your administrator can disable this feature. Enterprise BYOK is a different, server-side scenario with separate requirements.

Check the BetterToken Custom Endpoint setup against the current instructions. BetterToken provides OpenAI-compatible API access and usage history in the Dashboard, but does not issue a GitHub account, activate a Copilot plan, or change GitHub regional rules.

What to check before setting up GitHub Copilot

  1. Install the latest stable version of VS Code.
  2. Run Chat: Manage Language Models or choose Manage Language Models in the Chat interface.
  3. Check that Add Models → Custom Endpoint is available.
  4. Create your own API Key BetterToken and select the exact Model ID from the model directory.

BYOK support does not change at the same time for all clients. The presence of a Custom Endpoint in VS Code does not prove that the same configuration works in JetBrains, Xcode, GitHub.com or another interface. The current list of supported clients and restrictions is published by GitHub.

Regional availability note

GitHub's Trade Restrictions Policy states that Copilot may not be sold or exported to Russia without appropriate permission. A Custom Endpoint does not override this policy. There are no instructions for changing your region, paying through third parties, or bypassing account verification.

How to add BetterToken Custom Endpoint in VS Code

1. Open model management

In the Copilot Chat input field, choose Manage Language Models or run Chat: Manage Language Models from the Command Palette. Then click Add Models → Custom Endpoint.

If this option is not there, first update VS Code. Don't transfer configuration from a random old manual: the command names and file layout may have changed.

2. Create a group and save the key

In the Group Name field, enter BetterToken. When VS Code asks for an API Key, paste your key in the pop-up window and press Enter.

VS Code should save the secret locally and write a link something like this into the configuration:

"apiKey": "${input:betterTokenApiKey}"
Enter fullscreen mode Exit fullscreen mode

Do not replace this reference with the actual key and do not add the key to settings.json, .env inside a public repository or commit.

3. Select Chat Completions protocol

For a verified BetterToken configuration, select Chat Completions. VS Code will then open chatLanguageModels.json.

The minimum guidelines for fields look like this:

[
  {
    "name": "BetterToken",
    "vendor": "customendpoint",
    "apiKey": "${input:betterTokenApiKey}",
    "apiType": "chat-completions",
    "models": [
      {
        "id": "YOUR_MODEL_ID",
        "name": "YOUR_MODEL_ID",
        "url": "https://www.bettertoken.ai/v1/chat/completions"
      }
    ]
  }
]
Enter fullscreen mode Exit fullscreen mode

YOUR_MODEL_ID - placeholder. Replace it with the exact model ID of the available model. The url field here contains the full Chat Completions endpoint; Base URL https://www.bettertoken.ai/v1 alone is not enough for this field. Add parameters toolCalling, vision and token context limits only in accordance with the capabilities of the selected model and the current BetterToken documentation.

4. Reload the VS Code window

Save the file and run the command from the Command Palette:

Developer: Reload Window
Enter fullscreen mode Exit fullscreen mode

After rebooting, open the Copilot Chat selector again and select a model from the BetterToken group.

5. Do a short test

Send a request with an easily verifiable result, for example:

Верни только JSON с двумя полями: language="ru" и sum=2+2.
Enter fullscreen mode Exit fullscreen mode

The connection can be considered confirmed if three conditions are met simultaneously:

  • Copilot Chat returns valid JSON without authorization or Model ID errors;
  • the request appears in the BetterToken Dashboard usage history;
  • inline completion is checked separately and is not accepted as a Custom Endpoint result.

Why Chat works, but inline completion has not changed

Custom Endpoint connects the model to Chat. Autocompletion, which appears directly in the editor, remains a GitHub Copilot feature. For Agent Host sessions, using a BYOK model requires the current experimental setting chat.agentHost.byokModels.enabled; a successful ordinary Chat request does not prove an agent workflow.

Some VS Code features also rely on GitHub services: semantic search, inline suggestions, and embeddings require a GitHub account and internet connection. Plan requirements depend on the individual feature. If you only need Chat, local BYOK can be enough; for Agent Host, completions, or other integrated features, review the current setting, plan, and organization policy separately.

Common Custom Endpoint errors

The model did not appear in the selector

Check that VS Code is up to date, that there is an entry in chatLanguageModels.json and that the Model ID matches exactly. Then run Developer: Reload Window. If the device is managed by an organization, check to see if local BYOK is prohibited by Copilot Business or Enterprise policy.

Error 401 or Invalid token

Re-add the model via Add Models so that VS Code requests the key and stores it in secret storage. The JSON should contain the ${input:...} reference, not the actual value. Check that the key belongs to your BetterToken account and is active.

404 or model not found

For apiType: "chat-completions", check the full URL https://www.bettertoken.ai/v1/chat/completions. Then compare id with the current Model ID in the BetterToken directory. Base URL, full endpoint and Model ID are three different validation fields.

Chat has an answer, but completions remain the same

This is the expected bound of the function. Custom Endpoint does not replace inline completions. They require separate access to the corresponding GitHub Copilot function.

What ultimately depends on GitHub, and what ultimately depends on BetterToken

GitHub controls the account, Copilot plans, regional and organizational restrictions, and built-in features like inline completions. BetterToken in this scenario is responsible for the external OpenAI-compatible request, API Key, available Model ID and usage record in the Dashboard.

Before setting up, check the current BYOK support in your client. Then open the current BetterToken instructions, add a Custom Endpoint through the VS Code interface and complete the verification with a short query and a Dashboard entry.

FAQ

Can I use Custom Endpoint without a paid Copilot plan?

Current VS Code does not require a paid Copilot plan or even GitHub sign-in for BYOK Chat. Semantic search, inline suggestions, and embeddings require a GitHub account and internet connection; plan requirements remain specific to the feature and organization policy.

Does BetterToken replace GitHub Copilot subscription?

No. BetterToken connects an external model where the client supports Custom Endpoint or BYOK. The GitHub account, plan, completions, and other Copilot features remain separate.

Is it possible to store an API Key in chatLanguageModels.json?

The real value of the key should not be written there. Enter the key in the VS Code pop-up window and leave the secret link generated by the application.

Is a VPN needed for this scheme?

To connect to BetterToken API Endpoint from Russia, a VPN is not required. This statement only applies to the BetterToken endpoint. GitHub site access, sign-in, client downloads, updates, and Copilot features are subject to GitHub terms and conditions and your network.


Originally published on the BetterToken blog.

BetterToken provides pay-as-you-go access to AI model APIs through
OpenAI-compatible and Anthropic-compatible endpoints — useful if you are wiring
Claude Code, Codex, or your own tooling to a custom base URL.
See the docs to get started.

Top comments (0)