Documentation
Welcome to the GitHub Copilot API Gateway documentation. This guide will help you install, configure, and secure the extension.
Installation
Prerequisites
- Visual Studio Code version 1.95 or higher
- GitHub Copilot extension installed and authenticated
- GitHub Copilot Chat extension installed
- An active GitHub Copilot subscription (Individual, Business, or Enterprise)
Install from VS Code Marketplace
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X/Cmd+Shift+X) - Search for "GitHub Copilot API Gateway"
- Click Install
Or install directly via command line:
code --install-extension suhaibbinyounis.github-copilot-api-vscode
Quick Start
Step 1: Start the Server
After installation, start the API server using one of these methods:
- Click the "Start Server" button in the sidebar
- Open Command Palette (
Ctrl+Shift+P) → "GitHub Copilot: Start API Server"
Step 2: Connect Your App
Point any OpenAI-compatible client to http://127.0.0.1:3030:
from openai import OpenAI client = OpenAI( base_url="http://127.0.0.1:3030/v1", api_key="copilot" # Any string works ) response = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "Hello!"}] ) print(response.choices[0].message.content)
Step 3: Verify It Works
Open your browser and visit:
http://127.0.0.1:3030/v1/models— List available modelshttp://127.0.0.1:3030/docs— Interactive Swagger UI
Server Settings
Configure the extension via VS Code Settings (Ctrl+,) → search for
githubCopilotApi:
| Setting | Default | Description |
|---|---|---|
server.port |
3030 | Port the API server listens on |
server.host |
127.0.0.1 | Host to bind (use 0.0.0.0 for LAN access) |
server.apiKey |
none | Optional Bearer token for authentication |
server.ipAllowlist |
[] | Array of allowed IPs/CIDR ranges |
server.rateLimit |
60 | Max requests per minute per IP |
server.maxConcurrent |
10 | Max concurrent connections per IP |
Example settings.json
{
"githubCopilotApi.server.port": 3030,
"githubCopilotApi.server.host": "127.0.0.1",
"githubCopilotApi.server.apiKey": "my-secret-token",
"githubCopilotApi.server.ipAllowlist": ["127.0.0.1", "192.168.1.0/24"]
}
Network Configuration
Local-only Access (Default)
By default, the server binds to 127.0.0.1, making it accessible only from your local
machine. This is the most secure configuration.
LAN Access
To share the API with other devices on your network:
- Change
server.hostto0.0.0.0 - Configure your firewall to allow port 3030
- Use the IP Allowlist to restrict access to trusted devices
Your API will be accessible at http://YOUR-LAN-IP:3030
Environment Variables
You can also configure the extension using environment variables, which is useful for CI/CD pipelines or Docker deployments:
| Variable | Equivalent Setting | Example |
|---|---|---|
COPILOT_API_PORT |
server.port | 3030 |
COPILOT_API_HOST |
server.host | 0.0.0.0 |
COPILOT_API_KEY |
server.apiKey | my-secret |
Environment variables take precedence over VS Code settings when both are defined.
Access Control
The gateway provides multiple layers of security to protect your Copilot access.
IP Allowlisting
Restrict access to specific IP addresses or CIDR ranges:
{
"githubCopilotApi.server.ipAllowlist": [
"127.0.0.1", // localhost
"192.168.1.0/24", // local subnet
"10.0.0.50" // specific device
]
}
API Key Authentication
Require a Bearer token for all requests:
{
"githubCopilotApi.server.apiKey": "your-secret-token-here"
}
Clients must include the header:
Authorization: Bearer your-secret-token-here
Audit Logging
All requests are logged with:
- Timestamp
- Client IP address
- Request method and path
- Response status code
- Latency
- Token usage (if applicable)
Logs are stored in VS Code's extension storage and accessible via the Dashboard.
HTTPS/SSL
Enable HTTPS for encrypted connections:
{
"githubCopilotApi.server.https.enabled": true,
"githubCopilotApi.server.https.certPath": "/path/to/cert.pem",
"githubCopilotApi.server.https.keyPath": "/path/to/key.pem"
}
For local development, you can generate self-signed certificates using mkcert.
Rate Limiting
Prevent abuse by limiting requests per client:
{
"githubCopilotApi.server.rateLimit": 60, // requests per minute
"githubCopilotApi.server.maxConcurrent": 10 // concurrent connections
}
When rate limits are exceeded, the server returns 429 Too Many Requests.
Dashboard
Monitor your API usage in real-time through the built-in dashboard:
- Live traffic: See requests as they happen
- Token usage: Track input/output token consumption
- Error rates: Monitor failed requests
- Latency metrics: View response times
- Top clients: See which IPs are making requests
Access the dashboard by clicking the "Dashboard" button in the VS Code sidebar.
Need more help?
Check out the API Reference for endpoint details or browse the Wiki for integration guides.