CopilotAPI BridgeA VS Code extension that bridges GitHub Copilot models to provide universal API access via a local REST server with OpenAI-compatible endpoints. ✨ Features
🚀 Quick StartPrerequisites
Setup CopilotAPI Bridge
📡 API EndpointsPublic Endpoints (No Authentication)
Authenticated Endpoints (Requires
|
| Endpoint | Method | Description |
|---|---|---|
/api |
GET | API information & endpoint list |
/api/test |
GET | Test API connection & authentication |
/api/chat |
POST | Enhanced chat with custom response format |
/api/explain |
POST | Code explanation |
/api/review |
POST | Code review |
💻 Usage Examples
OpenAI-Compatible Format
# List all available models
curl http://localhost:4000/v1/models
# Chat completion (no API key required for /v1 endpoints)
curl -X POST http://localhost:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
PowerShell Example
# Get your API key from VS Code command palette first
# Test with GPT-4o
$body = @{
model = "gpt-4o"
messages = @(
@{ role = "user"; content = "What is 2+2?" }
)
} | ConvertTo-Json -Depth 10
Invoke-RestMethod -Uri "http://localhost:4000/v1/chat/completions" `
-Method Post `
-Headers @{"Content-Type"="application/json"} `
-Body $body
Enhanced API Format (Requires Authentication)
# Get API info
curl http://localhost:4000/api \
-H "X-API-Key: your_api_key_here"
# Enhanced chat
curl -X POST http://localhost:4000/api/chat \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Explain async/await"}
]
}'
# Code explanation
curl -X POST http://localhost:4000/api/explain \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"code": "function add(a, b) { return a + b; }",
"language": "javascript"
}'
🤖 Available Models
Model availability depends on your GitHub Copilot subscription:
GitHub Copilot Free/Pro
- Basic models like GPT-3.5-turbo, GPT-4o-mini
- Standard Claude models
GitHub Copilot Enterprise/Premium
Access to advanced models including:
- GPT Family: gpt-4.1, gpt-5-mini, gpt-5, gpt-3.5-turbo, gpt-4o-mini, gpt-4, gpt-4-turbo, gpt-4o, gpt-5-codex
- Claude Family: claude-3.5-sonnet, claude-sonnet-4, claude-sonnet-4.5, claude-haiku-4.5
- Google: gemini-2.5-pro
- Others: o3-mini, grok-code
Note: The extension automatically detects available models based on your active Copilot subscription. Use
GET /v1/modelsto see your available models.
💬 Chat Participant
Use @bridge in VS Code chat:
@bridge /help- Get help@bridge /explain- Explain selected code@bridge /review- Review code@bridge /api- Show API endpoints
🔐 Security Features
- ✅ API Key Authentication (64-character keys with
cb_prefix) - ✅ Rate Limiting (200 requests per 15 minutes)
- ✅ CORS Enabled for local development
- ✅ Secure key storage in VS Code global state
📚 Commands
Access via Command Palette (Ctrl+Shift+P):
- Start CopilotAPI Bridge API Server - Start the local API server
- Stop CopilotAPI Bridge API Server - Stop the server
- Show API Key - Display your API key
- Regenerate API Key - Generate a new API key
- Test AI Model Connection - Test connection to Copilot models
- Show API Documentation - Open API docs in webview
- Show Security Status - View security and rate limit status
🧪 Testing
See TESTING.md for comprehensive testing guide.
Quick test:
# Health check
curl http://localhost:4000/health
# List models
curl http://localhost:4000/v1/models
# Test chat
curl -X POST http://localhost:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'
📦 Installation
From VSIX
code --install-extension copilotapi-bridge-1.0.3.vsix
From Marketplace
Coming soon! Search for "CopilotAPI Bridge" in VS Code Extensions.
🛠️ Development
# Install dependencies
npm install
# Build
npm run compile
# Package
npm run package
📖 Documentation
TESTING.md- Testing guideCHAT_TESTING.md- Chat participant testingQUICK_REFERENCE.md- Quick reference cardPUBLISHING.md- Publishing to marketplace
⚠️ Requirements
- VS Code: Version 1.105.0 or higher
- GitHub Copilot Extension: Must be installed and activated
- GitHub Copilot Subscription: Active subscription (Free, Pro, or Enterprise)
- Free/Pro: Access to basic models
- Enterprise/Premium: Access to advanced models (GPT-5, Claude 4, Gemini, etc.)
Important: This extension acts as a bridge to GitHub Copilot. It requires an active GitHub Copilot extension and subscription. The available AI models depend on your specific Copilot plan.
🤝 Contributing
See CONTRIBUTING.md for contribution guidelines.
🔒 Security
Report security issues to: mahesh.ai.enthusiast@gmail.com
See SECURITY.md for security policy.
📝 License
ISC License - See LICENSE file for details
🙏 Acknowledgments
Built on top of VS Code Language Model API and GitHub Copilot.
Made with ❤️ by Mahesh