Skip to main content
VS Code supports adding custom models to Copilot Chat through the built-in language model management. After setup, you can use HaiToken models directly in the VS Code Chat panel.

Protocol Note

VS Code Custom Endpoints support the OpenAI Chat Completions and OpenAI Responses API types. HaiToken supports both: use https://api.haitoken.ai/v1/chat/completions for Chat Completions, or https://api.haitoken.ai/v1/responses for Responses.

What you need

  • VS Code with GitHub Copilot enabled
  • A HaiToken API key
  • At least one available model ID, such as gpt-5.4
  • A full HaiToken request URL that matches the selected API type

Setup Steps

Step 1: Open language model management

In the VS Code Chat panel, click the model picker next to the input box (shown as Auto by default) and select “Manage Language Models” from the dropdown. You can also open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run Chat: Manage Language Models.

Step 2: Add a Custom Endpoint model

On the Language Models management page, click “Add Model” and choose Custom Endpoint from the dropdown. In the naming dialog, give the endpoint a name (you can keep the default Custom Endpoint) and press Enter.

Step 3: Enter your HaiToken API key

In the API Key dialog, paste your HaiToken API key and press Enter.

Step 4: Choose the API type

In the API Type dialog, select Chat Completions for the OpenAI Chat Completions protocol, or select Responses for the OpenAI Responses protocol. Both API types are supported by HaiToken.

Step 5: Edit the config file to set the model ID and URL

After the wizard completes, VS Code automatically opens the chatLanguageModels.json config file. Find the Custom Endpoint entry you just created and fill in the following fields in the models array: Save the file, return to the Chat panel, and the newly added HaiToken model will be available in the model picker.

Verification

  1. Open the VS Code Chat panel.
  2. Select the HaiToken-backed model from the picker.
  3. Send a simple prompt such as hello.
  4. If the response returns normally, the integration works.

Notes

This BYOK path covers Copilot Chat and related agent experiences. Standard code completions (inline suggestions) are outside the documented BYOK scope and may still use Copilot-managed models.

How to switch models

Open the chat model picker in VS Code and select another HaiToken model from the list. If the model you want isn’t listed, go back to Manage Language Models and add it following Step 2–5, or append another model object to the models array of an existing Custom Endpoint in chatLanguageModels.json.

FAQ

Next