Use Cases
| You can use MaiToken through a VS Code Custom Endpoint, Copilot CLI, or the GitHub Copilot App. Users configuring it for the first time should start with VS Code. |
|---|
1. VS Code: Recommended Method
Update VS Code: Update VS Code to a stable version that includes Language Models management.
Open Model Management: Press
Cmd/Ctrl + Shift + Pto open the Command Palette, and runChat: Manage Language Models. You can also click the gear icon in the Chat model selector.Add a Custom Endpoint: Click Add Models → Custom Endpoint.
Enter the Basic Information: Enter
MaiTokenas the group name,MaiToken - Model IDas the display name, and your MaiToken Key as the API Key.Select the API Type: Select Chat Completions.
Edit the Configuration File: VS Code will open
chatLanguageModels.json. Replace<your MaiToken Key>and<Model ID>in the following example with your actual values, and then save the file.Select the Model: Return to Chat and select the MaiToken model from the model selector. If the model does not appear immediately, restart VS Code.
{ "name": "MaiToken", "vendor": "customendpoint", "apiKey": "<your MaiToken Key>", "apiType": "chat-completions", "models": [ { "id": "<Model ID>", "name": "MaiToken - <Model ID>", "url": "https://api.maitoken.com/v1/chat/completions", "toolCalling": true, "streaming": true, "maxInputTokens": 128000, "maxOutputTokens": 8192 } ]}128000 and 8192 are examples only. Adjust them according to the model's actual context window and maximum output limit. If the model does not support tool calling, set toolCalling to false; however, the model will not be available for Agent tasks. |
|---|
Test the Configuration
Test a Basic Conversation: Enter “Reply with OK only” in the chat box. If you receive a valid response, the API Key, API address, and Model ID are configured correctly.
Test Project Reading: Open a test project and enter “Read the current project directory and list only the files at the first level. Do not modify any files.”
Test Agent Capabilities: Ask the Agent to create a file named
test-maitoken.txtand writehellointo it. Confirm that the file was created successfully. Do not use a real production project for testing.
2. Copilot CLI: For Terminal Users
Before starting Copilot CLI, set the following environment variables in the current terminal session.
macOS / Linux
export COPILOT_PROVIDER_BASE_URL="https://api.maitoken.com/v1"export COPILOT_PROVIDER_TYPE="openai"export COPILOT_PROVIDER_API_KEY="<your MaiToken Key>"export COPILOT_MODEL="<Model ID>" copilotWindows PowerShell
$env:COPILOT_PROVIDER_BASE_URL="https://api.maitoken.com/v1"$env:COPILOT_PROVIDER_TYPE="openai"$env:COPILOT_PROVIDER_API_KEY="<your MaiToken Key>"$env:COPILOT_MODEL="<Model ID>" copilot| Environment Variable | Value |
|---|---|
COPILOT_PROVIDER_BASE_URL |
https://api.maitoken.com/v1 |
COPILOT_PROVIDER_TYPE |
openai |
COPILOT_PROVIDER_API_KEY |
<your MaiToken Key> |
COPILOT_MODEL |
<Model ID> |
Copilot CLI Agent tasks require a model that supports streaming output and tool calling. If basic chat works but the Agent reports an error, switch to a model that supports tool_calls, streaming, and a larger context window. |
|---|
3. GitHub Copilot App
Open Settings: Start the GitHub Copilot App, and then open Settings → Model providers.
Add a Provider: Click Add provider and select OpenAI-compatible HTTP endpoint.
Enter the Parameters: Enter
MaiTokenas the display name; enter https://api.maitoken.com/v1 as the Base URL; enter your MaiToken Key as the API Key; and enter<Model ID>as the model.Save and Select the Model: Save the configuration, select the model from the model selector, and then start an Agent session.
| Custom provider support in the GitHub Copilot App may still be a preview feature. Entry names and available options may change between versions. |
|---|
Common Issues
| Issue | Solution |
|---|---|
| The model does not appear in VS Code | Restart VS Code after saving chatLanguageModels.json, and confirm that the current workspace is trusted. |
| The model cannot be selected for Agent tasks | The model must have toolCalling enabled, and the endpoint must return OpenAI-compatible tool-calling data. |
| BYOK is unavailable for an enterprise account | The organization administrator may have disabled the BYOK policy. Contact the administrator to enable it. |
