No description
- Go 95.4%
- Dockerfile 4.6%
Copilot Proxy
A local proxy server for GitHub Copilot that provides API compatibility with OpenAI's API format.
Installation
macOS/Linux (curl)
curl -sSL instl.vercel.app/copilot-proxy | bash
Windows
powershell -c "irm https://instl.vercel.app/copilot-proxy?platform=windows|iex"
You can also use docker image see compose file in repo.
Features
- OpenAI API-compatible endpoints for chat completions, embeddings, and models
- GitHub Copilot authentication via device flow
- CORS support for web applications
- In-memory token caching
- Streaming support for chat completions
- Vision API support
Quick Start
- Authenticate with GitHub Copilot:
copilot-proxy auth
This will provide you with an authentication token.
- Start the proxy server:
copilot-proxy server
By default, the server runs on port 8080.
Configuration
Machine ID
The proxy requires a VSCode Machine ID to function. This ID is automatically stored in:
- Windows:
C:\Users\<username>\AppData\Roaming\Code\User\globalStorage\storage.json - macOS:
~/Library/Application Support/Code/User/globalStorage/storage.json - Linux:
~/.config/Code/User/globalStorage/storage.json
To use your existing VSCode Machine ID:
- Locate the storage.json file for your platform
- Find the
telemetry.machineIdvalue in the file - Set it as the
VSCODE_MACHINE_IDenvironment variable
Environment variables:
PORT: Server port (default: 8080)COPILOT_VERSION: Copilot version (default: 1.277.0)COPILOT_API_VERSION: API version (default: 2025年01月21日)COPILOT_EDITOR_VERSION: Editor version (default: JetBrains-IC/243.25659.59)COPILOT_EDITOR_PLUGIN_VERSION: Plugin version (default: copilot-intellij/1.5.38-243)COPILOT_INTEGRATION_ID: Integration ID (default: jetbrains-chat)COPILOT_CLIENT_ID: Client ID for GitHub OAuth (default: Iv23ctfURkiMfJ4xr5mv)
Mimic Vscode environment
To mimic the VSCode environment, set the following environment variables:
COPILOT_EDITOR_VERSION: vscode/1.99.2COPILOT_EDITOR_PLUGIN_VERSION: copilot-chat/0.27.2025041102COPILOT_INTEGRATION_ID: vscode-chatCOPILOT_CLIENT_ID: Iv1.b507a08c87ecfe98COPILOT_VERSION: 0.27.2025041102
API Usage
Authentication
Include the token from copilot auth in your requests:
curl -H "Authorization: Bearer your-token" http://localhost:8080/v1/models
Available Endpoints
POST /v1/chat/completions
Compatible with OpenAI's chat completions API. Supports:
- Regular chat completions
- Streaming responses
- Vision API (include images in messages)
GET /v1/models
Lists available models.
POST /v1/embeddings
Generate embeddings for text.
Examples
Chat Completion
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer your-token" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Vision API
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer your-token" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{
"role": "user",
"content": [
{
"type": "text",
"text": "What's in this image?"
},
{
"type": "image_url",
"image_url": "https://example.com/image.jpg"
}
]
}]
}'
Building from Source
git clone https://codeberg.org/elevatedai/copilot-proxy.git
cd copilot-proxy
go build ./cmd/copilot-proxy
License
MIT License