A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools.
First, authenticate with GitHub Copilot:
npx copilot-api@latest auth
docker run -d \
--name copilot-api \
-p 4141:4141 \
-e GH_TOKEN=your_github_token_here \
nghyane/copilot-api:latest
curl http://localhost:4141/v1/models
| Variable | Description | Required |
|---|---|---|
GH_TOKEN | GitHub token with Copilot access | ✅ Yes |
version: '3.8'
services:
copilot-api:
image: nghyane/copilot-api:latest
ports:
- "4141:4141"
environment:
- GH_TOKEN=your_github_token_here
restart: unless-stopped
# List models
curl http://localhost:4141/v1/models
# Chat completion
curl -X POST http://localhost:4141/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'
# Streaming
curl -X POST http://localhost:4141/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": true
}'
curl -X POST http://localhost:4141/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "What is the weather?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather information",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"}
}
}
}
}]
}'
linux/amd64 (Intel/AMD x64)linux/arm64 (ARM64 - Apple Silicon, ARM servers)latest - Latest stable version0.3.1 - Specific version0.3.0, 0.2.x - Previous versionscurl http://localhost:4141/health
Run with additional options:
docker run -d \
--name copilot-api \
-p 4141:4141 \
-e GH_TOKEN=your_token \
nghyane/copilot-api:latest \
start --port 4141 --verbose
docker logs copilot-apinpx copilot-api@latest auth--rate-limit option to set custom limits--rate-limit-wait to queue requestsMIT License - see repository for details.
Content type
Image
Digest
sha256:beb8820dc…
Size
57.1 MB
Last updated
over 1 year ago
docker pull nghyane/copilot-api