Use NexRouter with GitHub Copilot
Connect GitHub Copilot with your site API address, key, and model.
Follow these steps to use your NexRouter key and model in GitHub Copilot.
This guide starts with an installed client. See the official documentation below for product setup.
1. Get three things ready
- API address: open this site’s connection settings and copy the address required below.
- API key: create or copy a key in API key management. Do not use your login password.
- Model ID: copy the exact ID from the model list, not its display name.
Use an address and key from the same site. Domestic and overseas credentials are separate.
2. Configure GitHub Copilot
Replace these values in the example; do not leave YOUR_... unchanged:
| Placeholder | Replace with |
|---|---|
YOUR_API_BASE_URL | The OpenAI Base URL including /v1 from connection settings |
YOUR_MODEL_ID | The exact model ID you copied |
YOUR_MODEL_NAME | A display name you recognize, or the model ID |
In the VS Code Chat model picker, open Manage Language Models → Add Models → Custom Endpoint. Choose Chat Completions and enter your key when prompted.
Use these settings in chatLanguageModels.json:
[
{
"name": "NexRouter",
"vendor": "customendpoint",
"apiKey": "${input:nexrouterApiKey}",
"apiType": "chat-completions",
"models": [
{
"id": "YOUR_MODEL_ID",
"name": "YOUR_MODEL_NAME",
"url": "YOUR_API_BASE_URL/chat/completions",
"toolCalling": true,
"vision": false,
"maxInputTokens": 120000,
"maxOutputTokens": 8000
}
]
}
]url is the full endpoint, including /v1/chat/completions. Adjust the example token limits, tool support, and vision capability to match your model. Save and select the model in Chat. This does not replace Copilot inline completion.
3. Send a test message
Select the model you just configured, open a new chat, and send:
Please reply with only: ConnectedA normal reply means your first connection worked. You can now start your own task.
If no reply arrives, check the error:
- 401 / API key error: copy the full key again and check that the address and key belong to the same site.
- 404 / endpoint not found: compare the URL with the format above, especially missing or repeated
/v1. - Model not found: copy the exact model ID again and check that your key has access.
See Troubleshooting for other errors. To check the API separately, use the first request example.
Learn more
For installation, complete settings, and advanced features, see the official GitHub Copilot documentation.