microsoft / microsoft/vscode

vscode.lm — Add model visibility (hide/show) APIs

Open
#325,455 1 comment 2 reactions 3 assignees Claimed by @vijayupadya View on GitHub
api feature-request model-byok
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

**Problem Statement**
VS Code's chat model picker (Settings gear → "Manage Models") provides a UI to toggle the visibility of individual models and entire provider groups. Users can show or hide models from the picker. However, there is no extension API to read or write this visibility state programmatically.

The internal ILanguageModelsService already has full support for model visibility:

Extensions like BYOK/wallet dashboard providers, model management tools, and workspace onboarding assistants need these same capabilities to offer a good experience.

**Proposed API**
Add the following to the `vscode.lm` namespace in `vscode.d.ts`:

Use Cases

- BYOK provider extensions — When a user configures a new BYOK provider (e.g., via a wizard), the extension could initially hide lower-tier models so the picker isn't cluttered, giving the user a curated starting set.

- Workspace onboarding — A .code-workspace or devcontainer setup could programmatically configure which models are visible for a team, ensuring consistency (e.g., hide deprecated models, show only approved ones).

- Custom model management UIs — Extensions that provide alternative model management panels can read the current visibility state to display accurate toggle states, and can write back changes so the built-in picker stays in sync.

- Diagnostics/telemetry — Extension authors can inspect which models users have hidden to better understand adoption patterns and surface relevant guidance.

**Prior Art**
The internal ILanguageModelsService already implements all of these methods. The model visibility state is persisted in VS Code's profile storage (state.vscdb under key "chatModelVisibility") as:

``` ts
export namespace lm {

// ... existing APIs ...

/**
* An event that fires when any model or group visibility state changes
* (e.g., when a user toggles "Show/Hide" in the Manage Models UI, or
* when {@link lm.setModelHidden} or {@link lm.setGroupHidden} is called).
*/
export const onDidChangeModelVisibility: Event;

/**
* Returns whether the given model is hidden from the chat model picker.
*
* @param modelIdentifier A model identifier string, e.g. `"copilot/gpt-4o"`.
* Obtainable from {@link LanguageModelChat.id} when prefixed with the vendor,
* or from the result of {@link selectChatModels}.
*/
export function isModelHidden(modelIdentifier: string): boolean;

/**
* Returns whether every model in the given (vendor, groupName) bucket
* is hidden from the chat model picker.
*
* @param vendor The vendor identifier, e.g. `"openai"` or `"copilot"`.
* @param groupName The configured group name for that vendor.
*/
export function isGroupHidden(vendor: string, groupName: string): boolean;

/**
* Hide or show a single model in the chat model picker.
*
* Hidden models are not removed — they remain usable via
* {@link selectChatModels} and can still be sent requests. Hiding only
* removes them from the user-facing picker UI.
*
* @param modelIdentifier A model identifier string.
* @param hidden `true` to hide the model, `false` to show it.
*/
export function setModelHidden(modelIdentifier: string, hidden: boolean): void;

/**
* Hide or show every model in a (vendor, groupName) bucket.
*
* This is a convenience that operates on all resolved models belonging
* to the given vendor + group combination at the time of the call.
* Models resolved later for the same bucket are NOT automatically hidden.
*
* @param vendor The vendor identifier.
* @param groupName The configured group name for that vendor.
* @param hidden `true` to hide, `false` to show.
*/
export function setGroupHidden(vendor: string, groupName: string, hidden: boolean): void;

/**
* Returns the list of model identifiers that are currently hidden.
*
* This can be used to persist or synchronize visibility preferences
* across machines, or to build custom model management UIs that stay
* in sync with the built-in picker state.
*/
export function getHiddenModelIds(): string[];
}
```

The proposed API would simply expose a subset of this existing internal interface through the vscode.lm namespace, with no new storage or behavior — just a bridge from the extension host to the existing main-thread service.

**Non-Goals**
This proposal does not add the ability to hide models from vscode.lm.selectChatModels() — hidden models remain selectable and fully functional. The toggle only affects the user-facing model picker UI.
This proposal does not expose the raw IStorageService or allow extensions to read/write arbitrary storage keys.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.