Run local LM Studio models inside VS Code Copilot Chat with streaming responses, tool calling, and optional image generation.
If LM Studio is installed on your machine, the extension is designed to work out of the box. It also supports connecting to remote LM Studio servers.
Install from the VS Code Marketplace:
DanLambiase.lmstudio-copilot-provider
- Adds LM Studio models to the Copilot Chat model picker
- Streams responses directly into VS Code chat
- Can auto-start LM Studio and lazy-load the selected model on first use (when using localhost)
- Supports remote LM Studio servers without local CLI dependencies
- VS Code 1.104.0 or later
- LM Studio server accessible at the configured URL (default:
http://localhost:1234) - For local usage: LM Studio installed on your machine
- For remote usage: Access to a running LM Studio server on another machine
- Install this extension.
- Open Copilot Chat.
- Pick an LM Studio model.
- Send a prompt.
No separate CLI install, PATH setup, or manual model preload should be required for local setups.
You can connect to an LM Studio server running on a remote machine:
- Set
lmstudio-copilot.serverUrlto the remote server's URL (e.g.,http://your-server:1234). - Ensure the remote server is running and accessible.
- When using a remote server, local CLI features (auto-start, model discovery via CLI) are automatically disabled to avoid attempting to control the remote instance.
This is useful for setups where LM Studio runs on a dedicated server or in a container.
If you tunnel a remote LM Studio over SSH, its URL on your local machine is still http://localhost:1234. The extension would normally treat this as a local installation and attempt CLI operations, which will fail because LM Studio is not actually installed locally.
Enable Treat As Remote to prevent this:
"lmstudio-copilot.treatAsRemote": trueWith this option enabled the extension skips all local CLI operations (auto-start, lms ls model discovery, lms server stop) regardless of how the server URL looks.
If the VS Code GUI for adding a custom chat model is bugged, you can fall back to a manual provider definition and paste a model entry like this:
{
"name": "LM Studio",
"vendor": "customendpoint",
"apiKey": "lm-studio",
"apiType": "chat-completions",
"models": [
{
"id": "qwen/qwen3.6-27b",
"name": "qwen/qwen3.6-27b",
"url": "http://YOUR_TAILSCALE_IP:1234/v1/chat/completions",
"toolCalling": true,
"vision": false,
"maxInputTokens": 80000,
"maxOutputTokens": 16000,
"streaming": true
}
]
}Replace the model id, display name, and url with the values exposed by your LM Studio server. Set toolCalling and vision to match the capabilities of the model you are exposing.
You do not need to install the LM Studio CLI separately.
The CLI ships with LM Studio, and the extension will try to find it automatically for local installations.
The extension tries to find the CLI in this order:
lmstudio-copilot.cliPathlmsonPATH- common LM Studio install locations
For most users, nothing needs to be configured here. CLI features are skipped when using remote servers.
Most users can leave the defaults alone. These are the settings that matter most:
lmstudio-copilot.serverUrl: LM Studio server URL (default:http://localhost:1234)lmstudio-copilot.treatAsRemote: Always treat the server as remote — disables all local CLI operations. Enable this when you tunnel a remote LM Studio over SSH so its URL looks likelocalhost.lmstudio-copilot.cliPath: Override the LM Studio CLI path if auto-detection does not find itlmstudio-copilot.autoStartServer: Start LM Studio automatically when the extension activateslmstudio-copilot.launchCommand: Fallback terminal command if CLI-based startup is unavailablelmstudio-copilot.enableToolCalling: Enable tool calling for supported modelslmstudio-copilot.maxTools: Limit the number of tools exposed per requestlmstudio-copilot.imageGenEndpointUrl: Base URL for DALL-E/OpenAI-compatible or A1111 image generationlmstudio-copilot.imageGenApiKey: Dedicated API key for image generation backends such as OpenAI DALL-Elmstudio-copilot.logLevel: Controls output logging verbosity. Default isverbose; set toinfo,warning,error, ornone.
LM Studio: Refresh Available ModelsLM Studio: Start Server in Integrated TerminalLM Studio: Stop Server TerminalLM Studio: Check Server Connection
Select an LM Studio model in Copilot Chat and start chatting. The extension will use LM Studio automatically and, when possible, start the local server and load the selected model for you.
- Tool calling for supported local models
- Optional image generation through A1111 or DALL-E-compatible endpoints
Use these settings for OpenAI image generation:
{
"lmstudio-copilot.imageGenBackend": "dalle",
"lmstudio-copilot.imageGenEndpointUrl": "https://api.openai.com",
"lmstudio-copilot.imageGenApiKey": "sk-...",
"lmstudio-copilot.imageGenModel": "dall-e-3"
}lmstudio-copilot.imageGenApiKey is completely separate from lmstudio-copilot.apiKey. Chat requests keep using the LM Studio server key, and image generation uses only the dedicated image backend key.
For other OpenAI-compatible image servers, do not assume dall-e-3 exists. Set lmstudio-copilot.imageGenModel to the exact model ID exposed by that server, or leave it blank so the extension can avoid forcing the OpenAI default.
- Make sure LM Studio is running
- Check
lmstudio-copilot.serverUrl - Run
LM Studio: Check Server Connection - If LM Studio is installed in a non-standard location, set
lmstudio-copilot.cliPath
If you see this Copilot error:
No utility model is configured for 'copilot-utility-small' while the selected main agent model is BYOK.
the extension now auto-fixes this on startup by setting compatible defaults when the chat utility model settings are not already explicitly configured.
To disable auto-fix behavior:
{
"lmstudio-copilot.autoFixByokUtilityModel": false
}Manual fallback (if you prefer explicit chat settings):
{
"chat.byokUtilityModelDefault": "mainAgent",
"chat.utilityModel": "",
"chat.utilitySmallModel": ""
}Then run Developer: Reload Window.
- LM Studio performance depends on your hardware and the model size
- Consider using a smaller/faster model
- Increase the timeout in settings if needed
Some Gemma-family models may stream channel-style thinking markers instead of standard OpenAI-style hidden reasoning.
This extension automatically transforms Gemma channel-thinking output by default.
If needed, you can toggle this behavior:
{
"lmstudio-copilot.gemmaChannelThinkingTransform": true
}# Install dependencies
npm install
# Compile and watch
npm run watch
# Package the extension
npm run package
# Build a VSIX for local install / Marketplace submission
npm run package:vsix
# Publish to VS Code Marketplace (requires VSCE_PAT)
npm run publish:vsceTypical release flow used by this project:
- Rebuild:
npm run compile - Production bundle:
npm run package - VSIX artifact:
npm run package:vsix - Publish:
npm run publish:vsce
If publishing from CI or a non-interactive shell, export VSCE_PAT before step 4.
MIT