Visual Studio 2026 BYOM: Connect LM Studio, OpenRouter and Custom Models

Bring Your Own Model (BYOM) became generally available in Visual Studio 2026 version 18.12 on November 11, 2026. You can connect an approved hosted provider, an internal gateway, or a local model server and select its model in Visual Studio Agent Mode. The GA release adds named provider connections, more explicit protocol settings, and improved proxy handling.
What changed since the August preview?
| Area | Earlier preview | 18.12 GA |
|---|---|---|
| Provider setup | BYOM available as a preview. | Multiple named connections can coexist for a provider. |
| Custom services | Earlier endpoint setup. | Dedicated Custom Endpoint for services such as OpenRouter and local LM Studio. |
| API compatibility | Earlier preview configuration. | Selectable OpenAI-compatible Completions or Responses, or Anthropic-compatible Messages. |
| Networks | Preview proxy integration. | Provider connections and Agent Mode use Visual Studio’s resolved proxy. |
How to connect LM Studio to Visual Studio
- Install Visual Studio 2026 18.12 or later. In LM Studio, load the intended model and start its local server. Copy the OpenAI-compatible base URL displayed by the server.
- In Visual Studio, open Chat, open the model picker, and select Manage models.
- Select Add model provider → Custom Endpoint. Name it for its purpose, enter the server URL and supply authentication if your server requires it.
- Add the model using the ID reported by the endpoint. Where model discovery is supported, choose from the discovered entries. Select the API format your server actually implements.
- Set context and output limits to match the deployment. Enable tool calling or vision only if supported by both the model and its serving stack.
- Open a disposable C# solution. Select the model in Agent Mode and first ask it to summarize one file. Then test a scoped file or test action and review any approval prompt.
For OpenRouter, the Visual Studio path is also Custom Endpoint. Use the provider’s current OpenAI-compatible base URL, an authorized API key and the exact provider model identifier. Give the hosted connection a distinct name so a developer can tell where repository context is going before sending a request.
Why protocol and model capability are separate
A gateway may accept a text prompt while failing an agent tool call. Tool calls require the selected model, endpoint and protocol to agree on the request and response format. Likewise, a model can support images while a gateway does not expose that feature. Validate those paths independently with an innocuous task before connecting sensitive repositories.
Troubleshooting
- Add model provider is missing. Confirm the IDE version and check whether organizational policy disables BYOM.
- Connection fails or discovery is empty. Check the base URL, endpoint reachability and proxy. If the provider does not support compatible discovery, use the documented model ID.
- Authentication is rejected. Check the credential at the configured provider or gateway, including any endpoint-side access controls. Avoid pasting keys into Copilot Chat.
- Agent Mode cannot complete a tool task. Check the configured API format and the deployment’s tool-calling support. Compare a text-only request with a simple tool-driven request.
FAQs
Do I need a GitHub sign-in for BYOM?
Microsoft says BYOM works without a GitHub sign-in, provided the selected endpoint is reachable and its authentication requirements are met.
How much does it cost?
Hosted inference depends on the provider, model and account agreement. A local model uses your own hardware and may have licensing or infrastructure costs.
Can teams enforce approved endpoints?
Admins can control whether BYOM is enabled. Review your provider and network policies separately for endpoint restrictions, logging and code retention.
Related reading on ASP.NET PB: OpenRouter integration in ASP.NET Core.
Comments
Post a Comment