You can use a locally hosted language model in VS Code’s Copilot Chat when your Copilot plan and the current VS Code experience support selecting that model. This keeps model inference on your computer or local network, but setup depends on the model provider and available hardware; first confirm that Copilot Chat offers a local-model connection for your account.
What You’ll Need
- A current VS Code installation and GitHub Copilot Chat enabled with an account that can use it. Some model options or features may require a particular plan.
- A local model runtime that can serve a compatible model through an API, such as Ollama or another provider supported by VS Code’s model-provider settings.
- A downloaded model that fits your computer’s memory and can be run by that runtime.
- Network access between VS Code and the runtime. If both are on the same computer, a local address is usually sufficient.
Step-by-Step
- Update VS Code and open Copilot Chat. Install available VS Code updates, sign in to GitHub, and verify that the Copilot Chat view is available. If you cannot open it or use chat, resolve your Copilot sign-in or entitlement first; a local runtime does not replace the Copilot extension or account setup.
- Choose and install a local model runtime. Pick a runtime that VS Code can connect to and follow its official installation instructions. Install a model through that runtime, checking its documentation for the model name and hardware requirements. Large models may need substantial RAM or GPU memory. Start with a smaller model if you are unsure your computer can run one.
- Start the runtime and verify the model works. Use the runtime’s own command or app to launch the model, then try a short prompt in its interface or API. Note the model identifier and the local endpoint address it reports. Keep the runtime running while you use it from VS Code. Do not assume every model format or runtime is compatible with every VS Code feature.
- Open VS Code’s model settings. Open the Settings view and search for “language models,” “models,” or the provider name. Depending on your VS Code build and installed extensions, you may find model-provider configuration in Settings, the Copilot Chat model picker, or an extension’s setup instructions. Follow the labels shown in your installed version rather than copying a setting name from an older guide.
- Configure the provider connection, if required. If VS Code or a supported provider extension asks for a server address, enter the endpoint supplied by your runtime. If it requests a model name, use the exact identifier from the runtime. Avoid adding a made-up API key; some local services require none, while others require a token or specific connection settings. Do not expose a local server to the public internet just to make the connection work.
- Make the model available to Copilot Chat. Open the chat view and inspect its model selector. Select the local model if it appears. In VS Code versions that use a provider or extension for local models, complete that extension’s registration steps first. A model being installed locally does not automatically make it a Copilot Chat option.
- Test with a simple request. Ask the selected model to explain a short code snippet or draft a small function. Check that the chat identifies the model you selected and returns a response. If the picker offers separate modes, such as chat or editing, choose one supported by that model and test it before relying on it for larger changes.
- Review changes before applying them. Treat generated code as a suggestion. Inspect edits, run relevant tests, and avoid sharing secrets or sensitive project data unless you understand where the prompt is processed. Local inference can keep requests on your machine, but extensions, telemetry, connected tools, and other services may have separate data handling.
Common Mistakes
- Assuming every local model works directly with Copilot. Copilot Chat’s available models and providers change over time and may depend on account eligibility, VS Code version, and extensions. Check the model picker and current VS Code documentation.
- Using the wrong endpoint or model identifier. A provider may expose different URLs for its API and user interface. Copy the API endpoint and exact model name from the runtime’s documentation or status output.
- Stopping the runtime after setup. VS Code cannot get responses from a local service that is not running, unless the runtime starts it automatically.
- Choosing a model too large for the computer. This can cause slow responses, failed loads, or memory errors. Try a smaller model or a suitable quantized version supported by your runtime.
- Expecting all Copilot features to work identically. Tool use, inline suggestions, image input, and other capabilities may depend on the model, provider, or Copilot feature. A successful chat response does not prove every feature is supported.
Tips
- Test the runtime outside VS Code first; this separates model-loading problems from editor configuration problems.
- Keep a note of the runtime, model identifier, endpoint, and any provider settings you changed. This makes later updates easier to diagnose.
- Use a small, self-contained prompt when checking the connection. Add project context only after the basic test succeeds.
- For a runtime on another machine, confirm that the machines can reach each other and use the runtime’s documented secure access method. A localhost address on the remote machine will not point to it from your computer.
- Recheck the model selector after updating VS Code or extensions. Provider labels and support can change between releases.
Troubleshooting
The local model is missing from the selector: Confirm Copilot Chat is enabled and you are signed in. Check whether your VS Code version supports the provider route you chose, and install or enable the required provider extension if its documentation calls for one. Restart VS Code after changing settings, then inspect the selector again.
Connection refused or the request times out: Make sure the model is loaded and the runtime service is running. Check the endpoint for typos and confirm that a firewall or network rule is not blocking communication. If the runtime is on another computer, use its reachable address rather than localhost.
The runtime responds, but Copilot Chat does not: Check that you entered the API endpoint, not the runtime’s web page address, and that the model identifier matches exactly. Review the provider extension’s output or logs for authentication, compatibility, and request errors. Re-test with a model and feature documented as supported.
Responses are extremely slow or the model fails to load: Close other memory-intensive applications, try a smaller model, and verify the runtime’s hardware requirements. If the model runs outside VS Code but not in chat, reduce the prompt size and inspect the extension or VS Code logs for the specific failure.
You cannot select any model: Check Copilot access, sign-in status, and any organization policy that controls model availability. Local setup does not bypass those requirements. Consult your organization’s administrator or current VS Code and Copilot documentation if access is managed.
Frequently Asked Questions
Can GitHub Copilot Chat use a model running on my computer?
It can when your VS Code version, Copilot access, and a supported local provider or extension allow it. Having a model installed alone is not enough.
Do I need an internet connection?
Local inference itself can work without sending prompts to a hosted model, but sign-in, Copilot features, extensions, or other services may still need network access. Exact behavior depends on configuration.
Is Ollama required?
No. It is one possible local runtime. Choose a provider supported by your VS Code setup and follow that provider’s connection instructions.
Will a local model provide every Copilot feature?
No guarantee. Feature support varies by model and provider; some capabilities may only be available with particular models or hosted services.
Why does the model work in its own app but not in VS Code?
The runtime may be using a different API address, model identifier, authentication method, or protocol than the VS Code provider expects. Compare the provider instructions with the runtime’s API details.
Are my prompts always private when I use a local model?
Local inference can keep model requests on your device or network, but privacy also depends on VS Code, extensions, telemetry, tools, and runtime configuration. Review their data-handling settings before sending sensitive information.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Secure Boot Battlefield 6 ASUS: Fix & Enable Guide
- Best Tech Websites to Follow for Pros & Beginners
- Second Wind Quest Walkthrough: Where Winds Meet6.00 min/km
- Enshrouded Weapon Upgrade Guide: How to Improve Gear5.00 min/km
- Connect Phone to Controller for Cloud Gaming
- Python Search Highlighting: Snippets & Matches