A VS Code extension that provides HTTP API access to GitHub Copilot via the VS Code Language Model API. This allows you to make programmatic calls to Copilot from any language or tool without using the Copilot UI directly.
- VS Code installed with GitHub Copilot extension
- GitHub Copilot subscription (active and signed in)
- Node.js installed (for development)
- Open this folder in VS Code
- Press
F5(orfn + F5on Mac) to launch the Extension Development Host - Look for notification: "Copilot Bridge API running on http://localhost:3000"
- Accept permissions: First API call will prompt for Copilot model access - click "Allow"
- Start making API calls to
http://localhost:3000
curl -X POST http://localhost:3000/copilot \
-H "Content-Type: application/json" \
-d '{"prompt": "Write a hello world function in JavaScript"}'curl -X POST http://localhost:3000/copilot \
-H "Content-Type: application/json" \
-d '{
"prompt": "Create a REST API endpoint for user authentication",
"systemPrompt": "You are a Node.js security expert. Include input validation and error handling."
}'{
"response": "function helloWorld() {\n console.log('Hello, World!');\n}"
}curl http://localhost:3000/health
# Returns: {"status": "ok", "timestamp": "2024-01-01T12:00:00.000Z"}import requests
response = requests.post('http://localhost:3000/copilot', json={
'prompt': 'Write a Python class for a simple calculator',
'systemPrompt': 'Focus on clean, testable code with docstrings'
})
print(response.json()['response'])const response = await fetch('http://localhost:3000/copilot', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
prompt: 'Explain async/await in JavaScript',
systemPrompt: 'Provide practical examples with error handling'
})
});
const data = await response.json();
console.log(data.response);For testing within VS Code:
- Open Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) - Run: "Copilot Bridge: Ask"
- Enter your prompt
- Response opens in a new editor tab
-
POST /copilot- Send prompt to Copilot- Body:
{ "prompt": string, "systemPrompt"?: string } - Response:
{ "response": string }or{ "error": string }
- Body:
-
GET /health- Health check- Response:
{ "status": "ok", "timestamp": string }
- Response:
- API calls do NOT appear in VS Code's chat history - they operate independently
- All interactions are private and don't affect your VS Code Copilot chat sessions
- Perfect for programmatic/automated use cases without UI clutter
- First API call will trigger VS Code's permission dialog for Copilot model access
- You must click "Allow" to enable the API functionality
- This is a one-time setup per VS Code session
- 🚀 HTTP REST API - Call from any programming language or tool
- 🔒 Private operations - Won't appear in VS Code chat history
- ⚙️ Custom system prompts - Fine-tune Copilot's behavior per request
- 🎯 Direct model access - Uses your existing GitHub Copilot subscription
- 📝 Manual testing - Built-in VS Code command for development
- ⚡ Real-time responses - Streams full responses efficiently
npm run compile # Compile TypeScript to JavaScript
npm run watch # Watch for changes and auto-compile| Issue | Solution |
|---|---|
| "No Copilot models available" | Ensure GitHub Copilot extension is installed and you're signed in to GitHub |
| Permission errors | Accept the consent dialog when first making API calls |
| Extension won't start | Check compilation with npm run compile, restart with F5 |
| API not responding | Verify the notification shows "API running on http://localhost:3000" |
| Port 3000 in use | Close other applications using port 3000, or modify the PORT in src/extension.ts |
- Requires VS Code to be running with extension active
- Uses your GitHub Copilot subscription quota
- API is only accessible while Extension Development Host is running
- No built-in conversation memory - manage context in your application