Skip to content

Custom BYOK model hidden from picker or fails with 502 when model id matches built-in Copilot model #318968

Description

@zlsbksdxl

Summary

Custom BYOK customendpoint model configured in chatLanguageModels.json cannot be used reliably in Copilot Chat. The model either does not appear in the model picker, or requests fail with 502 Server error.

Environment

Version: 1.122.0
Commit: 6a49527
Date: 2026-05-27T14:03:01-07:00
Electron: 39.8.8
ElectronBuildId: 13870025
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Linux x64 6.17.0-29-generic snap

GitHub Copilot Chat extension version observed in logs: 0.50.0

Configuration

~/.config/Code/User/chatLanguageModels.json:

[
  {
    "name": "Custom Endpoint",
    "vendor": "customendpoint",
    "apiKey": "${input:chat.lm.secret.-60b744f3}",
    "apiType": "responses",
    "models": [
      {
        "id": "gpt-5.5",
        "name": "gpt-5.5",
        "url": "https://sub2api....***/v1",
        "toolCalling": false,
        "vision": true,
        "maxInputTokens": 200000,
        "maxOutputTokens": 200000
      }
    ]
  }
]

What happens

When using this model in Copilot Chat, requests fail with:

Sorry, your request failed. Please try again.

Client Request Id: bff44fcc-a972-4532-8ca0-fa817b922031

Reason: Server error: 502: Error: Server error: 502
    at dG._provideLanguageModelResponse (/snap/code/242/usr/share/code/resources/app/extensions/copilot/dist/extension.js:1710:16552)
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    at async dG.provideLanguageModelResponse (/snap/code/242/usr/share/code/resources/app/extensions/copilot/dist/extension.js:1710:17555)

Earlier logs also showed:

Server error: 502 {"error":{"message":"Upstream request failed","type":"upstream_error"}}event: response.failed

Additional observations

The endpoint and API key appear to work outside VS Code:

  • GET /v1/models returns 200 with the same API key.
  • POST /v1/responses with model gpt-5.5 returns 200.
  • Streaming responses also return 200.
  • A simple tools request also returns 200.

However, in VS Code Copilot Chat:

  1. With toolCalling: true, the model appears usable in Agent mode but requests fail with 502.
  2. With toolCalling: false, the model may disappear from the model picker, even in Ask mode.
  3. The generated Copilot debug models.json contains gpt-5.5, but marks it as:
"model_picker_enabled": false

This suggests the custom model may be colliding with an internal/official Copilot model named gpt-5.5, or the model picker is applying provider policy to the custom endpoint model.

Expected behavior

A custom endpoint model configured in chatLanguageModels.json should:

  1. Appear in the model picker when valid for the current mode.
  2. Not be hidden because its model id matches or resembles an internal Copilot model id.
  3. Use the configured custom endpoint and API key consistently.
  4. Surface enough request/debug information to distinguish extension-side request construction issues from upstream endpoint failures.

Actual behavior

The configured model either:

  • is hidden from the model picker, or
  • fails with 502 Server error when selected/used.

Request

Could you clarify whether custom endpoint model ids can collide with built-in Copilot model ids, and whether model_picker_enabled: false is expected for BYOK/customendpoint models? If this is expected behavior, is there a supported way to set a display id/name separately from the actual upstream model name sent to the custom endpoint?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions