
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
copilot-gateway
Advanced tools
Turn GitHub Copilot into an OpenAI/Anthropic compatible gateway. Usable with Claude Code!
[!WARNING] This is a reverse-engineered proxy of GitHub Copilot API. It is not supported by GitHub, and may break unexpectedly. Use at your own risk.
[!WARNING] GitHub Security Notice: Use this proxy responsibly to avoid account restrictions. Excessive automated or scripted use of Copilot (including rapid or bulk requests, such as via automated tools) may trigger GitHub's abuse-detection systems. You may receive a warning from GitHub Security, and further anomalous activity could result in temporary suspension of your Copilot access. Please review:
Note: If you are using opencode, you do not need this project. Opencode supports GitHub Copilot provider out of the box.
A reverse-engineered proxy for the GitHub Copilot API that exposes it as an OpenAI and Anthropic compatible service. This allows you to use GitHub Copilot with any tool that supports the OpenAI Chat Completions API or the Anthropic Messages API, including to power Claude Code.
/v1/chat/completions, /v1/responses, /v1/models, /v1/embeddings) and Anthropic (/v1/messages) compatible endpoints--claude-code--rate-limit, --wait) and manual request approval (--manual)Prerequisites: A GitHub account with Copilot subscription.
1. Start the server (will prompt for GitHub auth on first run):
npx copilot-gateway@latest start
2. Use with Claude Code — run with --claude-code to get a ready-to-paste launch command:
npx copilot-gateway@latest start --claude-code
Or manually configure Claude Code by creating .claude/settings.json in your project:
{
"env": {
"ANTHROPIC_BASE_URL": "http://localhost:4141",
"ANTHROPIC_AUTH_TOKEN": "sk-dummy",
"ANTHROPIC_MODEL": "claude-opus-4.6",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-sonnet-4.5",
"ENABLE_TOOL_SEARCH": "true",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}
More options: Claude Code settings · IDE integration
Pre-built images are published to ghcr.io/feiskyer/copilot-gateway on every release.
docker run -p 4141:4141 ghcr.io/feiskyer/copilot-gateway:latest
Pass a GitHub token via environment variable:
docker run -p 4141:4141 -e GH_TOKEN=your_github_token_here ghcr.io/feiskyer/copilot-gateway:latest
Persist auth across restarts with a bind mount:
mkdir -p ./copilot-data
docker run -p 4141:4141 \
-v $(pwd)/copilot-data:/root/.local/share/copilot-gateway \
ghcr.io/feiskyer/copilot-gateway:latest
Docker Compose:
services:
copilot-gateway:
image: ghcr.io/feiskyer/copilot-gateway:latest
ports:
- "4141:4141"
environment:
- GH_TOKEN=your_github_token_here
restart: unless-stopped
To build from source instead, use docker build -t copilot-gateway .
Subcommands: start, auth, check-usage, debug. Run npx copilot-gateway@latest <command> --help for details.
start: Start the server (handles auth if needed).auth: Run GitHub auth flow without starting the server.check-usage: Show Copilot usage/quota in the terminal (no server required).debug: Display diagnostic info for troubleshooting.| Option | Description | Default | Alias |
|---|---|---|---|
| --port | Port to listen on | 4141 | -p |
| --verbose | Enable verbose logging | false | -v |
| --account-type | Account type to use (individual, business, enterprise) | individual | -a |
| --manual | Enable manual request approval | false | none |
| --rate-limit | Rate limit in seconds between requests | none | -r |
| --wait | Wait instead of error when rate limit is hit | false | -w |
| --github-token | Provide GitHub token directly (must be generated using the auth subcommand) | none | -g |
| --claude-code | Generate a command to launch Claude Code with Copilot Gateway config | false | -c |
| --show-token | Show GitHub and Copilot tokens on fetch and refresh | false | none |
| --proxy-env | Initialize proxy from environment variables (Node.js runtime only) | false | none |
| --enterprise-url | GitHub Enterprise host to use (eg. https://ghe.example.com) | none | none |
| --api-key | API keys for authentication. Can be specified multiple times | none | none |
| Option | Description | Default | Alias |
|---|---|---|---|
| --verbose | Enable verbose logging | false | -v |
| --show-token | Show GitHub token on auth | false | none |
| --enterprise-url | GitHub Enterprise host (eg. https://ghe.example.com) | none | none |
| Option | Description | Default | Alias |
|---|---|---|---|
| --json | Output debug info as JSON | false | none |
Stored at ~/.local/share/copilot-gateway/config.json. Edit to customize prompts, models, and reasoning efforts.
Related files in the same directory: github_token, enterprise_url, and logs/.
Default shape:
{
"extraPrompts": {
"gpt-5-mini": "<built-in exploration prompt>",
"gpt-5.1-codex-max": "<built-in exploration prompt>"
},
"smallModel": "gpt-5-mini",
"modelReasoningEfforts": {
"gpt-5-mini": "low"
}
}
extraPrompts: Map of model -> prompt appended to the first system prompt when translating Anthropic-style requests to Copilot. Missing default entries are auto-added without overwriting your custom prompts.
smallModel: Fallback model used for tool-less warmup messages (e.g., Claude Code probe requests) to avoid spending premium requests; defaults to gpt-5-mini.
modelReasoningEfforts: Per-model reasoning.effort sent to the Copilot Responses API. Allowed values are none, minimal, low, medium, high, and xhigh. If a model isn't listed, high is used by default.
Restart the server after changes so the cached config is refreshed.
OpenAI and Anthropic compatible API endpoints, plus usage monitoring.
| Endpoint | Method | Description |
|---|---|---|
POST /v1/responses | POST | Advanced OpenAI response interface for generating model responses. |
POST /v1/chat/completions | POST | Creates a model response for the given chat conversation. |
GET /v1/models | GET | Lists the currently available models. |
POST /v1/embeddings | POST | Creates an embedding vector representing the input text. |
Aliases without /v1 prefix: /responses, /chat/completions, /models, /embeddings.
| Endpoint | Method | Description |
|---|---|---|
POST /v1/messages | POST | Creates a model response for a given conversation. |
POST /v1/messages/count_tokens | POST | Calculates the number of tokens for a given set of messages. |
POST /api/event_logging/batch | POST | Anthropic telemetry log (returns 200). |
| Endpoint | Method | Description |
|---|---|---|
GET /usage | GET | Get detailed Copilot usage statistics and quota information. |
GET /token | GET | Get the current Copilot token being used by the API. |
Restrict access with API keys via --api-key. Supports both Authorization: Bearer and x-api-key headers.
Authorization: Bearer your_api_key_herex-api-key: your_api_key_here# Single API key
npx copilot-gateway@latest start --api-key your_secret_key
# Multiple API keys
npx copilot-gateway@latest start --api-key key1 --api-key key2 --api-key key3
When API keys are configured:
/ remains accessible without authenticationCommon usage patterns for different account types, rate limiting, and enterprise setups.
# Basic usage with start command
npx copilot-gateway@latest start
# Run on custom port with verbose logging
npx copilot-gateway@latest start --port 4141 --verbose
# Use with a business plan GitHub account
npx copilot-gateway@latest start --account-type business
# Use with an enterprise plan GitHub account
npx copilot-gateway@latest start --account-type enterprise
# Enable manual approval for each request
npx copilot-gateway@latest start --manual
# Set rate limit to 30 seconds between requests
npx copilot-gateway@latest start --rate-limit 30
# Wait instead of error when rate limit is hit
npx copilot-gateway@latest start --rate-limit 30 --wait
# Provide GitHub token directly
npx copilot-gateway@latest start --github-token ghp_YOUR_TOKEN_HERE
# Enable API key authentication with a single key
npx copilot-gateway@latest start --api-key your_secret_key_here
# Enable API key authentication with multiple keys
npx copilot-gateway@latest start --api-key key1 --api-key key2 --api-key key3
# Run only the auth flow
npx copilot-gateway@latest auth
# Show your Copilot usage/quota in the terminal (no server needed)
npx copilot-gateway@latest check-usage
# Display debug information for troubleshooting
npx copilot-gateway@latest debug
# Use GitHub Enterprise / GitHub Enterprise Server
npx copilot-gateway@latest start --account-type enterprise --enterprise-url https://ghe.example.com
# Authenticate with GitHub Enterprise using CLI flag (for scripting)
npx copilot-gateway@latest auth --enterprise-url ghe.example.com
A web-based dashboard for monitoring your Copilot API usage and quotas.
After starting the server, a URL to the dashboard will be displayed in your console:
https://feiskyer.github.io/copilot-gateway?endpoint=http://localhost:4141/usage
The dashboard shows usage quotas with progress bars, detailed JSON statistics, and supports custom API endpoint URLs via query parameter.
Build and run from source using Bun.
bun install # Install dependencies
bun run dev # Development mode with watch
bun run start # Production mode
bun run lint # ESLint
bun run typecheck # TypeScript strict checking
bun test # Run all tests
Best practices for rate limiting, account types, and enterprise configuration.
--rate-limit <seconds> with --wait to throttle requests instead of getting errors.--manual for full control over when each request is sent.--account-type business or --account-type enterprise. See the official documentation for more details.--enterprise-url to specify your enterprise host.Fork of ericc-ch/copilot-api. Thanks to @ericc-ch and all contributors.
This project is licensed under the MIT License.
FAQs
Turn GitHub Copilot into an OpenAI/Anthropic compatible gateway. Usable with Claude Code!
The npm package copilot-gateway receives a total of 8 weekly downloads. As such, copilot-gateway popularity was classified as not popular.
We found that copilot-gateway demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.