1
2
Fork
You've already forked copilot-proxy
1
No description
  • Go 95.4%
  • Dockerfile 4.6%
2025年04月12日 03:23:14 +00:00
.github/workflows refactor: rename project to copilot and update codebase architecture 2025年03月18日 10:03:05 +01:00
cmd/copilot-proxy refactor: rename project to copilot and update codebase architecture 2025年03月18日 10:03:05 +01:00
config refactor: remove user agent string from config and generate from version 2025年03月18日 12:27:40 +01:00
pkg refactor: remove user agent string from config and generate from version 2025年03月18日 12:27:40 +01:00
.editorconfig Initial commit 2025年03月12日 20:15:16 +01:00
.gitignore refactor: rename project to copilot and update codebase architecture 2025年03月18日 10:03:05 +01:00
.goreleaser.yml refactor: rename project to copilot and update codebase architecture 2025年03月18日 10:03:05 +01:00
docker-compose.yml feat: remove data volume mount from vscode container 2025年03月18日 11:57:59 +01:00
Dockerfile refactor: rename project to copilot and update codebase architecture 2025年03月18日 10:03:05 +01:00
go.mod refactor: rename project to copilot and update codebase architecture 2025年03月18日 10:03:05 +01:00
go.sum refactor: rename project to copilot and update codebase architecture 2025年03月18日 10:03:05 +01:00
goreleaser.dockerfile refactor: rename project to copilot and update codebase architecture 2025年03月18日 10:03:05 +01:00
README.md Update README.md 2025年04月12日 03:23:14 +00:00

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

  1. Authenticate with GitHub Copilot:
copilot-proxy auth

This will provide you with an authentication token.

  1. 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:

  1. Locate the storage.json file for your platform
  2. Find the telemetry.machineId value in the file
  3. Set it as the VSCODE_MACHINE_ID environment 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.2
  • COPILOT_EDITOR_PLUGIN_VERSION: copilot-chat/0.27.2025041102
  • COPILOT_INTEGRATION_ID: vscode-chat
  • COPILOT_CLIENT_ID: Iv1.b507a08c87ecfe98
  • COPILOT_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