A VS Code extension that exposes GitHub Copilot through Ollama-compatible API endpoints using VS Code's official Language Model API.
- 🔗 Ollama-Compatible API: Drop-in replacement for Ollama
- 🤖 GitHub Copilot Integration: Uses VS Code's official Language Model API
- 🔐 Automatic Authentication: No manual token extraction needed
- 🌐 OpenAI-Compatible API: Support for
/v1/chat/completionsendpoint - 🌊 Streaming Support: Real-time streaming responses with SSE
- 📊 Real-time Status: Status bar integration with server status
- 📝 Request Logging: Output channel with detailed request logging
- ⚙️ Configurable: Customizable port and auto-start settings
- 🔧 CORS Enabled: Cross-origin requests supported for web applications
- VS Code 1.84.0 or higher
- GitHub Copilot extension installed and authenticated
- Active GitHub Copilot subscription
-
Install dependencies:
cd copilot-ollama-bridge npm install -
Compile TypeScript:
npm run compile
-
Install extension:
- Open this folder in VS Code
- Press
F5to launch Extension Development Host - Or package:
npx vsce packagethen install the.vsixfile
-
Configure Tools:
- For Copilot Bridge:
http://localhost:11435 - For regular Ollama:
http://localhost:11434(for embeddings, etc.) - Model:
copilot:latest
- For Copilot Bridge:
List available models
curl http://localhost:11435/api/tagsGenerate text completions
curl -X POST http://localhost:11435/api/generate \
-H "Content-Type: application/json" \
-d '{"model":"copilot:latest","prompt":"def fibonacci(n):"}'Chat-style completions
curl -X POST http://localhost:11435/api/chat \
-H "Content-Type: application/json" \
-d '{"model":"copilot:latest","messages":[{"role":"user","content":"Write a function"}]}'OpenAI-compatible chat completions with streaming support
# Non-streaming request
curl -X POST http://localhost:11435/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer dummy-token" \
-d '{
"model": "copilot:latest",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, how are you?"}
],
"stream": false
}'
# Streaming request
curl -X POST http://localhost:11435/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer dummy-token" \
-d '{
"model": "copilot:latest",
"messages": [
{"role": "user", "content": "Tell me a joke"}
],
"stream": true,
"stream_options": {"include_usage": true}
}'Features:
- ✅ OpenAI API format compatibility
- ✅ Streaming and non-streaming responses
- ✅ Complex message content support (text arrays)
- ✅ Usage statistics with
stream_options.include_usage - ✅ CORS support for web applications
- ✅ Works with any OpenAI-compatible client
| Setting | Default | Description |
|---|---|---|
copilot-bridge.port |
11435 |
Server port (Copilot Bridge default) |
copilot-bridge.autoStart |
true |
Auto-start on VS Code startup |
- Start Copilot Bridge Server - Start the API server
- Stop Copilot Bridge Server - Stop the API server
- Restart Copilot Bridge Server - Restart the API server
- Status Bar: Shows current server status and port
- Output Channel: View detailed request logs in "Copilot Bridge" channel
- Web Interface: Visit
http://localhost:11435for status and documentation
- Set Ollama URL:
http://localhost:11435 - Select model:
copilot:latest
For Obsidian plugins that expect OpenAI API endpoints:
- Set API URL:
http://localhost:11435/v1/chat/completions - Use any dummy API key (the bridge doesn't require authentication)
- Select model:
copilot:latestortest
Any tool that supports Ollama can use this bridge as a drop-in replacement.
Any application that uses the OpenAI API format can connect to:
- Base URL:
http://localhost:11435/v1 - API Key: Not required (use any dummy value)
- Supported models:
copilot:latest,copilot:gpt-4o,copilot:gpt-4, etc.
- Ensure GitHub Copilot extension is installed
- Sign in to GitHub Copilot in VS Code
- Verify your Copilot subscription is active
- Run command:
GitHub Copilot: Sign In
- Check if Ollama is running:
ps aux | grep ollama - Stop Ollama:
killall ollama - Or change port in extension settings
- Check "Copilot Bridge" output channel for detailed logs
- Verify Copilot quota hasn't been exceeded
- Try refreshing GitHub authentication
If you're getting CORS errors from web applications (like Obsidian):
- Ensure the extension is running (check status bar)
- Verify the correct port is being used (default: 11435)
- Check that the Authorization header is properly formatted
- Try restarting the Copilot Bridge Server
- Verify you're using the correct endpoint:
/v1/chat/completions - Ensure the request includes proper Content-Type header
- Check that the extension server is running (not regular Ollama)
- Review request format matches OpenAI API specification
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ ┌──────────────┐
│ Ollama Clients │───▶│ │───▶│ │───▶│ │
│ (Cline, etc.) │ │ │ │ VS Code │ │ GitHub │
├─────────────────┤ │ Copilot-Ollama │ │ Language │ │ Copilot │
│ OpenAI Clients │───▶│ Bridge │───▶│ Model API │───▶│ Service │
│ (Obsidian, etc.)│ │ │ │ │ │ │
└─────────────────┘ └──────────────────┘ └─────────────────┘ └──────────────┘
│
▼
┌──────────────────┐
│ Unified Response│
│ (Ollama/OpenAI) │
└──────────────────┘
The extension acts as a universal bridge, translating both Ollama and OpenAI API requests to VS Code's Language Model API calls and formatting responses back to the appropriate format.
Supported API Formats:
- 🦙 Ollama API:
/api/tags,/api/generate,/api/chat - 🤖 OpenAI API:
/v1/chat/completionswith streaming support
| Aspect | Manual Token Extraction | VS Code Extension |
|---|---|---|
| Authentication | ❌ Brittle, OS-dependent | ✅ Official API |
| User Consent | ❌ Bypassed | ✅ Proper dialogs |
| Quota Limits | ❌ Ignored | ✅ Respected |
| Reliability | ❌ Token hunting | ✅ Stable API |
| Maintenance | ❌ High | ✅ Low |
MIT License