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