customendpoint BYOK provider returns "Invalid API Key" against local server despite correct, verified API key
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
### Type: Bug
**VS Code Version:** 1.135.0
**Copilot Chat Extension Version:** 0.63.0
**OS Version:** Windows_NT x64
**Copilot SKU:** copilot_for_business_seat_quota
### Description
Configuring a `customendpoint` BYOK provider (`apiType: chat-completions`) against a local OpenAI-compatible server fails with a generic "Invalid API Key" error, even though the exact same API key against the exact same endpoint succeeds when called directly (e.g. via PowerShell `Invoke-RestMethod`).
### Steps to Reproduce
1. Run a local OpenAI-compatible server (in my case a custom wrapper around LM Studio) on `http://127.0.0.1:49491/v1/chat/completions`.
2. Configure `chatLanguageModels.json`:
\`\`\`json
[
{
"name": "Bionic",
"vendor": "customendpoint",
"apiKey": "",
"apiType": "chat-completions",
"models": [
{
"id": "D:\\LMstudio\\Models\\lmstudio-community\\Qwen3.5-35B-A3B\\Qwen3.5-35B-A3B-Q4_K_M.gguf",
"name": "Qwen3.5-35B-A3B",
"url": "http://127.0.0.1:49491/v1/chat/completions",
"toolCalling": true,
"vision": false,
"thinking": true,
"streaming": true,
"maxInputTokens": 32768,
"maxOutputTokens": 4096
}
]
}
]
\`\`\`
3. Select "Qwen3.5-35B-A3B" from the Chat model picker (both Ask and Agent mode).
4. Send any message (e.g. "hello")
### Expected
Request succeeds, same as when calling the endpoint directly:
\`\`\`powershell
$k=''
Invoke-RestMethod -Uri 'http://127.0.0.1:49491/v1/chat/completions' -Method Post `
-Headers @{Authorization="Bearer $k"} -ContentType 'application/json' `
-Body (@{model='...';messages=@(@{role='user';content='hola'});max_tokens=20;temperature=0.8;stream=$false} | ConvertTo-Json -Depth 10)
# => returns a valid chat.completion response
Contributor guide
Assessment
This issue has not been assessed yet.