惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
U
Unit 42
腾讯CDC
D
Docker
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
I
InfoQ
Jina AI
Jina AI
爱范儿
爱范儿
宝玉的分享
宝玉的分享
博客园 - Franky
G
Google Developers Blog
P
Proofpoint News Feed

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Running Local AI (Self-hosted) Coding Assistants in VS Co...
Zepher Ashe · 2026-05-14 · via DEV Community

Introduction

GitHub Copilot now supports Bring Your Own Key (BYOK), allowing developers to connect local or self-hosted AI models directly into VS Code.

This means you can run coding assistants locally using tools like Ollama (offline AI) without sending prompts to external providers.


Architecture

VS Code
   ↓
GitHub Copilot Chat (BYOK)
   ↓
Ollama API
   ↓
Local LLM

Enter fullscreen mode Exit fullscreen mode

Example:

VS Code → localhost:11434 → Qwen2.5-Coder

Enter fullscreen mode Exit fullscreen mode


Step 0 - Prerequisites


Step 1 - Install Ollama

Linux

Official:

sudo curl -fsSL https://ollama.com/install.sh | sh

Enter fullscreen mode Exit fullscreen mode

Reference: https://docs.ollama.com/integrations/vscode


Verify

ollama --version

Enter fullscreen mode Exit fullscreen mode

Start service:

systemctl enable ollama --now

Enter fullscreen mode Exit fullscreen mode

Check service:

systemctl status ollama

Enter fullscreen mode Exit fullscreen mode


Step 2 - Pull a Model

Best Starting Models

Model Approx VRAM Recommended Hardware Notes
qwen2.5-coder:14b 10–12GB RTX 3090 / 4090 Best balance
qwen2.5-coder:32b 24GB+ RTX 4090 / A5000 Excellent coding performance
deepseek-coder-v2 24GB+ RTX 4090 / A5000 Strong reasoning
phi4 CPU friendly Modern x86 CPU Lightweight
phi4-mini CPU friendly (~3GB RAM free) Modern x86 CPU Lightweight

Note: Hardware requirements vary depending on quantisation level and context size.

  • LLMs can run on CPU-only systems, but response latency may increase significantly depending on model size and quantisation.
  • For practical coding assistance, GPU acceleration is strongly recommended for models larger than 7B–14B parameters.

Step 3 - Test the Model

Run:

ollama pull phi4-mini

Enter fullscreen mode Exit fullscreen mode

ollama run phi4-mini

Enter fullscreen mode Exit fullscreen mode

You should get an interactive prompt.


Step 4 - Confirm API Endpoint

Ollama automatically exposes:

http://localhost:11434

Enter fullscreen mode Exit fullscreen mode

Test:

curl http://localhost:11434/api/tags

Enter fullscreen mode Exit fullscreen mode

You should see JSON listing models.


Step 5 - Configure VS Code

Open:

Ctrl+Shift+P 
(macOS: Command+Shift+P)

Enter fullscreen mode Exit fullscreen mode

Run:

Chat: Manage Language Models

Enter fullscreen mode Exit fullscreen mode

Then:

Add Models → Ollama

Enter fullscreen mode Exit fullscreen mode

NOTE: this section must show “tools”

Otherwise GitHub Copilot cannot select

VS Code should auto-detect:

http://localhost:11434

Enter fullscreen mode Exit fullscreen mode

Or, if using a remote Ollama server (not run locally) - see step 8

https://ollama.internal.domain:443

Enter fullscreen mode Exit fullscreen mode

VS Code Language Models

Reference: https://docs.ollama.com/integrations/vscode


Step 6 - Select Your Model

Inside Copilot Chat (set session target) select Local:

  • Open model picker
  • Choose (other models Ollama):

    • qwen2.5-coder
    • etc…

Now your prompts go to your local model.

GitHub Copilot Models


Important Limitation

This currently applies mainly to:

  • ✅ Chat
  • ✅ Agent mode
  • ✅ AI interactions

But NOT fully to:

  • ❌ inline autocomplete

Homelab Setup

Small Setup

High-level overview

Mini PC / NUC
Debian Server
Ollama
Qwen2.5-Coder 14B
Tailscale

Enter fullscreen mode Exit fullscreen mode



Step 7 - Remote Access (Optional)

If your inference server is elsewhere (not hosted locally):

Example:

http://ai-node:11434

Enter fullscreen mode Exit fullscreen mode

or

https://ollama.internal.domain

Enter fullscreen mode Exit fullscreen mode

Then configure Ollama accordingly.


SECURITY (VERY IMPORTANT)

Do NOT expose Ollama publicly.

Bad:

0.0.0.0:11434

Enter fullscreen mode Exit fullscreen mode

without auth/firewall.

Use:

  • Tailscale
  • WireGuard
  • reverse proxy auth
  • firewall ACLs

There are already reports of exposed Ollama servers online.


Step 8 - Configure Nginx Reverse Proxy (Optional)

You can skip this step if testing

If you plan to access Ollama remotely, it is recommended to place it behind a reverse proxy rather than exposing the API directly.

VS Code
   ↓
HTTPS
   ↓
Nginx Reverse Proxy
   ↓
Ollama API
   ↓
Local Model

Enter fullscreen mode Exit fullscreen mode

Install Nginx

Debian/Ubuntu:

sudo apt update
sudo apt install nginx -y

Enter fullscreen mode Exit fullscreen mode

RHEL/AlmaLinux:

sudo dnf install nginx -y

Enter fullscreen mode Exit fullscreen mode

Enable and start the service:

sudo systemctl enable --now nginx

Enter fullscreen mode Exit fullscreen mode

Verify:

systemctl status nginx

Enter fullscreen mode Exit fullscreen mode


Create Reverse Proxy Configuration

Create a new Nginx site configuration:

sudo vim /etc/nginx/conf.d/ollama.conf

Enter fullscreen mode Exit fullscreen mode

Example configuration:

This step uses HTTP for testing (not recommended for production)

server {
    listen 80;
    server_name ollama.internal.domain;

    location / {
        proxy_pass http://127.0.0.1:11434;

        proxy_http_version 1.1;

        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Enter fullscreen mode Exit fullscreen mode

Test configuration:

sudo nginx -t

Enter fullscreen mode Exit fullscreen mode

Reload Nginx:

sudo systemctl reload nginx

Enter fullscreen mode Exit fullscreen mode


Verify Reverse Proxy

Test locally:

curl http://localhost/api/tags

Enter fullscreen mode Exit fullscreen mode

Or remotely (DNS must resolve for this to work):

curl http://ollama.internal.domain/api/tags

Enter fullscreen mode Exit fullscreen mode

You should receive JSON output listing available models.


Step 9 - Testing

Inside VS Code Copilot Chat:

  1. Select the Ollama model
  2. Ensure the session target is set to Local
  3. Open a source file
  4. Highlight a small code block
  5. Test prompts such as:
Explain this function

Enter fullscreen mode Exit fullscreen mode

or:

Suggest improvements

Enter fullscreen mode Exit fullscreen mode

If successful:

  • responses should come from the local model
  • Ollama logs will show /v1/chat/completions
  • no external provider API keys are required

Monitor logs:

journalctl -u ollama -f

Enter fullscreen mode Exit fullscreen mode

Example successful request:

POST "/v1/chat/completions"

Enter fullscreen mode Exit fullscreen mode


References

Official VS Code Docs

VS Code Language Models Documentation

Official Ollama VS Code Integration

Ollama VS Code Integration Docs

GitHub Copilot BYOK Docs

GitHub Copilot BYOK Documentation

VS Code BYOK Announcement

Expanding Model Choice in VS Code with BYOK

vLLM

vLLM GitHub Repository

Ollama

https://ollama.com