Custom Endpoint Agent Host Bridge
A minimal VS Code extension that registers your self-hosted / custom-endpoint BYOK models for the Agent Host (Copilot CLI) model picker.
Why This Exists
VS Code's chatLanguageModels.json does not support the targetChatSessionType field — it only works through the vscode.lm.registerLanguageModelChatProvider() API at runtime. This extension does exactly that: registers your custom endpoint models with targetChatSessionType: "copilotcli" so they appear in the Agent Host picker.
Setup
1. Install dependencies and compile
cd c:\Users\SSI63\Documents\custom-endpoint-agent-host
npm install
npm run compile
2. Install the extension locally
Press F5 in VS Code to launch an Extension Development Host, or package and install:
npx vsce package
code --install-extension custom-endpoint-agent-host-0.0.1.vsix
Add to your VS Code settings.json:
"customEndpointAgentHost.models": [
{
"id": "glm-5.2-fp8",
"name": "glm-5.2-fp8",
"url": "http://px106.prod.exalead.com:8000/v1",
"apiKey": "your-api-key",
"maxInputTokens": 200000,
"maxOutputTokens": 59968,
"toolCalling": true,
"vision": false
},
{
"id": "moonshotai/Kimi-K2.7-Code",
"name": "moonshotai/Kimi-K2.7-Code",
"url": "http://px105.prod.exalead.com:8000/v1",
"apiKey": "your-api-key",
"maxInputTokens": 200000,
"maxOutputTokens": 62144,
"toolCalling": true,
"vision": false
}
]
4. Use it
- Ensure
"chat.agentHost.enabled": true in your settings.
- Open the Agent Host picker (select
Agent Host - Copilot).
- Your models will appear in the model list.
How It Works
chatLanguageModels.json → regular Chat view (no targetChatSessionType)
↓
This extension → Agent Host picker (targetChatSessionType: "copilotcli")
The extension calls vscode.lm.registerLanguageModelChatProvider() with vendor "custom-ah" and tags each model with targetChatSessionType: "copilotcli". VS Code's filterModelsForSession() then routes these models to the Agent Host session picker.
Limitations
- Only supports OpenAI-compatible
/v1/chat/completions streaming endpoints
- No vision/image input support yet (text-only)
- Token counting is a rough estimate (~4 chars/token)