How to configure an OpenAI Compatibe Model Provider which supports dynamic model discovery? #200311
Replies: 5 comments 1 reply
-
|
Right now, VS Code doesn’t expose automatic model discovery for custom endpoints configured through chatLanguageModels.json the same way it does for built-in providers or provider extensions. That JSON-based setup is static, you must define models manually. Dynamic discovery (for example, calling an OpenAI-compatible /v1/models endpoint and populating the model list automatically) is handled by provider implementations, not by the generic custom endpoint configuration. So if you want users to enter only a base URL + API key and have models appear automatically, the supported path today is to build a language model provider extension that implements discovery logic and surfaces the models to VS Code. Without an extension, there isn’t currently a built-in mechanism for auto-discovering models from arbitrary custom endpoints. |
Beta Was this translation helpful? Give feedback.
-
|
You're not missing anything — this is a real gap, not user error. The built-in "Custom OpenAI Compatible" path through chatLanguageModels.json is in the manual-entry bucket of BYOK providers: some providers auto-discover models with just a base URL + key, others require you to hand-list each model. Custom endpoints currently fall in the second group, and there's already an open bug (microsoft/vscode#289015/#289003) about custom OpenAI-compatible configs not even reliably appearing in the picker, so it's a rough edge right now, not just a missing nice-to-have. |
Beta Was this translation helpful? Give feedback.
-
|
The short answer is that you are encountering a hard limitation of VS Code's current architecture for custom endpoints. You are required to build an extension or use a third-party extension to achieve automatic model discovery. The manual configuration is the only method available for a "vanilla" custom endpoint setup . Why Manual Configuration is Required When you use the built-in Chat: Manage Language Models option to add a Custom Endpoint, you are directly writing to the chatLanguageModels.json configuration file . This file defines a static list of models. Because it is a static configuration, there is no built-in mechanism for dynamic model discovery for these specific endpoints . This is intended to provide users with fine-grained control over which models appear . How to Achieve Dynamic Model Discovery To get the automatic model listing you want, you have a few options that go beyond the manual JSON configuration:
|
Beta Was this translation helpful? Give feedback.
-
|
As of today, if you're using VS Code's built-in custom model endpoint support via chatLanguageModels.json, there is no built-in mechanism for dynamic model discovery. You must explicitly define each model in the JSON configuration. The automatic discovery you're seeing with providers like Google, Ollama, or Marketplace extensions happens because those providers implement the necessary logic themselves. They can query an endpoint (for example, /models on an OpenAI-compatible API), retrieve the available models, and register them with VS Code programmatically. A plain custom endpoint configuration is essentially static metadata. VS Code knows the base URL and credentials, but it does not automatically call the provider's model-listing API and populate the model picker. Therefore, if your goal is to enter only a base URL and API key and have models appear automatically, you'll need some code that performs discovery and registers the models. In practice, that means writing a VS Code extension (or modifying an existing one) that acts as a language model provider. The extension can query the OpenAI-compatible /models endpoint and dynamically expose whatever models are available. So the answer is: with the built-in custom endpoint configuration alone, no; for dynamic discovery, a provider extension is currently required. |
Beta Was this translation helpful? Give feedback.
-
|
Hey @singhal-shagun....... I went through the discussion and here's the simple version. From what I understood, what you want isn't fully supported in VS Code yet. Right now, you have 3 options:
The main reason this doesn't work today is because So I'd try Addi first, then VS Code Insiders, and only consider writing an extension if those don't meet your needs. Hope that helps... i tried my best to tell u |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
🏷️ Discussion Type
Question
💬 Feature/Topic Area
VS Code
Body
Hi! I'm trying to set up a custom chat model provider in VS Code, and I'm running into a limitation.
The current situation:
Chat: Manage Language ModelsmodalChat: Manage Language ModelschatLanguageModels.jsonWhat I'm trying to do:
I want to configure an OpenAI-compatible API provider where:
Is there a way to set up such a dynamic model discovery for custom endpoints without building a full VS Code extension? Or is writing an extension the only way to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions