You can now use local Ollama models as a backend for GitHub Copilot-like coding assistance in Visual Studio Code and other editors. There are two main approaches:
Direct integration via GitHub Copilot's new "Bring Your Own Model" (BYOM) feature (currently in preview and may require a Copilot Pro subscription)
Using third-party extensions (like Continue, CodeGPT, or custom Copilot extensions) that connect VS Code to Ollama
Below are step-by-step instructions for both approaches.
1. Using GitHub Copilot's Native Support for Local Models (BYOM)
Requirements
Latest version of Visual Studio Code
GitHub Copilot extension (ensure it's updated)
Ollama installed and running locally
A supported coding model downloaded in Ollama (e.g., codellama, deepseek-coder, etc.)
Copilot Pro subscription may be required to access BYOM features[9][4][16]
Steps
Install and Start Ollama
Download and install Ollama from the official website.
Pull a coding model, e.g.:
code
ollama pull codellama
Start the Ollama server (usually starts automatically):
code
ollama serve
Update Copilot Settings in VS Code
Open the Copilot sidebar.
Go to "Manage Models" or "Settings."
Click "Add Custom Model."
Select "Ollama" as the provider.
Enter the model name (e.g., codellama or deepseek-coder:6.7b).
Save and select your local model as the active Copilot model[4][9][16].
Test the Integration
Start coding and invoke Copilot suggestions as usual.
The completions should now come from your local Ollama model.
Note:
Some users report that only certain models appear or work; try with well-supported models like qwen2.5-coder or command-r7b if you encounter issues[4].
The feature may not be available for all Copilot plans and is currently in preview[4][9].
2. Using Third-Party Extensions (Continue, CodeGPT, etc.)
If you don't have Copilot Pro or want more flexibility, you can use extensions like Continue or CodeGPT to connect VS Code to Ollama.
Example: Using Continue Extension
Install Ollama and a Coding Model
code
ollama pull deepseek-coder:6.7b
ollama pull nomic-embed-text # For embeddings (optional)
Install the Continue Extension in VS Code
Search for "Continue" in the VS Code Extensions Marketplace and install it.
Use Continue's sidebar or inline suggestions for Copilot-like completions, now powered by your local Ollama model.
3. Using Custom Copilot Extensions
Developers have built custom Copilot extensions that route Copilot requests to Ollama. For example, the [ollama-copilot-extension][5][6] project lets you run a local web server that proxies Copilot requests to Ollama.
Basic steps:
Clone the extension repo.
Install dependencies and run the extension locally.
Configure GitHub Copilot to use your extension as an agent (requires GitHub App setup).
Prompts must be prefixed with @your-extension-name in Copilot Chat[6].
This approach is more advanced and mainly for developers comfortable with custom integrations.
Additional Tips
Model Selection: Not all models are optimized for code. Use models like codellama, deepseek-coder, qwen2.5-coder, or starcoder for best results[4][8][18].
Privacy: When using local models, code and prompts stay on your machine. However, some Copilot features may still send telemetry to Microsoft, depending on your subscription and settings[4].
Remote Access: To use Ollama on a remote server, set OLLAMA_HOST=0.0.0.0 and open port 11434. Update your extension config to point to the remote server[15].
Troubleshooting
Model Not Appearing: Ensure the model is downloaded and running in Ollama. Try restarting both Ollama and VS Code.
Errors on Selection: Some features are only available to Copilot Pro users[9].
No Suggestions: Try switching to a different model or check Ollama logs for errors.
Summary Table: Integration Methods
Method
Copilot Plan Needed
Offline
Custom Models
Setup Complexity
Notes
Copilot BYOM (native)
Pro (likely)
Yes
Yes
Medium
In preview, limited to some users
Continue/CodeGPT
Free/Any
Yes
Yes
Easy
Full local/offline, flexible
Custom Copilot Extension
Any
Yes
Yes
Advanced
Requires GitHub App setup
References
[Reddit: Copilot now supports Ollama][4][9][16]
[Continue extension setup][8][15]
[Custom Copilot extension with Ollama][5][6]
[VS Code integration guides][13][14][17]
In summary:
You can now use local Ollama models as your Copilot in VS Code either via Copilot's new BYOM feature (if available to you), or more flexibly via extensions like Continue or CodeGPT, by configuring them to use your local Ollama server and model of choice. This setup keeps your code private and avoids cloud costs, while delivering Copilot-like AI coding assistance directly from your own hardware[8][4][9].