copilot-api-node20
v0.9.1
Published
Turn GitHub Copilot into OpenAI/Anthropic API compatible server. Usable with Claude Code! (Node v20+ fork)
Maintainers
Readme
🚀 Copilot API Proxy (Node 20+ Compatible)
Transform GitHub Copilot into OpenAI/Anthropic API • Claude Code Ready • One Command Setup
Turn your existing GitHub Copilot subscription into a powerful OpenAI/Anthropic-compatible API server. Perfect for powering Claude Code, custom tools, and any application expecting OpenAI or Anthropic APIs.
✨ Why This Proxy?
- 🎯 One Command Launch: Get Claude Code running with Copilot in seconds
- 💰 Use What You Pay For: Leverage your existing Copilot subscription
- 🔄 Dual API Support: Both OpenAI (
/v1/chat/completions) and Anthropic (/v1/messages) endpoints - 📊 Usage Dashboard: Beautiful web interface to monitor your API usage
- ⚡ Node 20+ Ready: Optimized fork with modern Node.js compatibility
- 🛡️ Rate Limiting: Built-in controls to respect GitHub's limits
🎮 Quick Start with Claude Code
The fastest way to get Claude Code working with your Copilot subscription:
# 1. Launch the proxy with Claude Code integration
npx copilot-api-node20@latest start --claude-code
# 2. Follow the interactive setup (select your models)
# 3. Copy the generated command and run it in a new terminal
# 4. Start coding with Claude Code powered by your Copilot subscription! 🎉That's it! Claude Code will now use your GitHub Copilot subscription instead of requiring separate API keys.
📋 Prerequisites
- Node.js 20+ (this fork is optimized for modern Node versions)
- GitHub account with active Copilot subscription (Individual, Business, or Enterprise)
- No additional API keys needed! Uses your existing Copilot access
🚀 Installation & Usage
Option 1: NPX (Recommended)
# Quick start - launches server and opens usage dashboard
npx copilot-api-node20@latest start
# With Claude Code integration
npx copilot-api-node20@latest start --claude-code
# Custom port and verbose logging
npx copilot-api-node20@latest start --port 8080 --verboseOption 2: Global Install
npm install -g copilot-api-node20
copilot-api start --claude-codeOption 3: Docker
# Build and run
docker build -t copilot-api .
docker run -p 4141:4141 -v $(pwd)/copilot-data:/root/.local/share/copilot-api copilot-api
# With environment variables
docker run -p 4141:4141 -e GH_TOKEN=your_token copilot-api🎯 Core Features
🤖 Claude Code Integration
- One-command setup with
--claude-codeflag - Interactive model selection or specify models directly
- Automatic configuration - no manual JSON editing needed
- Works out of the box with all Claude Code features
🔄 Dual API Compatibility
| OpenAI Format | Anthropic Format | Description |
|---------------|------------------|-------------|
| POST /v1/chat/completions | POST /v1/messages | Chat completions |
| GET /v1/models | - | Available models |
| POST /v1/embeddings | - | Text embeddings |
| - | POST /v1/messages/count_tokens | Token counting |
📊 Usage Monitoring
- Web Dashboard: Beautiful interface at
/usageendpoint - Real-time Stats: Monitor quotas, requests, and usage patterns
- Terminal Usage: Quick check with
copilot-api check-usage
🛡️ Smart Rate Limiting
# Manual approval for each request
copilot-api start --manual
# 30-second minimum between requests
copilot-api start --rate-limit 30
# Wait instead of erroring on rate limits
copilot-api start --rate-limit 30 --wait💡 Advanced Usage Examples
Claude Code with Specific Models
# Skip interactive setup - specify models directly
npx copilot-api-node20@latest start \
--claude-code \
--model "claude-sonnet-4" \
--small-model "claude-sonnet-4"Enterprise/Business Accounts
# For GitHub Business/Enterprise Copilot
npx copilot-api-node20@latest start --account-type business
npx copilot-api-node20@latest start --account-type enterpriseProduction Deployment
# With comprehensive settings
npx copilot-api-node20@latest start \
--port 8080 \
--rate-limit 10 \
--wait \
--timeout 180000 \
--account-type businessCI/CD Integration
# Authenticate separately for token reuse
npx copilot-api-node20@latest auth --show-token
# Use token in production
npx copilot-api-node20@latest start --github-token $GITHUB_TOKEN🔧 Command Reference
Main Commands
| Command | Description |
|---------|-------------|
| start | Launch the API proxy server |
| auth | Run GitHub authentication only |
| check-usage | Show usage stats in terminal |
| debug | Display diagnostic information |
Key Options
| Flag | Description | Example |
|------|-------------|---------|
| --claude-code | Generate Claude Code launch command | start --claude-code |
| --model | Primary model for Claude Code | --model "claude-sonnet-4" |
| --small-model | Fast model for background tasks | --small-model "claude-sonnet-4" |
| --rate-limit | Seconds between requests | --rate-limit 30 |
| --manual | Manual request approval | --manual |
| --account-type | GitHub plan type | --account-type business |
🌐 API Endpoints
Once running (default: http://localhost:4141):
OpenAI Compatible
curl -X POST http://localhost:4141/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4",
"messages": [{"role": "user", "content": "Hello!"}]
}'Anthropic Compatible
curl -X POST http://localhost:4141/v1/messages \
-H "Content-Type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello!"}]
}'Usage Dashboard
Open http://localhost:4141/usage in your browser for a beautiful usage monitoring interface.
⚠️ Important Notices
Reverse-Engineered Proxy: This tool reverse-engineers GitHub Copilot's API. It's not officially supported by GitHub and may break unexpectedly.
Rate Limiting: Excessive automated use may trigger GitHub's abuse detection. Use responsibly with appropriate rate limiting.
Terms of Service: Review GitHub's Acceptable Use Policies and Copilot Terms before use.
🙏 Attribution & License
This is a Node 20+ compatible fork of the original project by Erick Christian.
Original Repository: https://github.com/ericc-ch/copilot-api
Original Package: copilot-api on npm
Full credit goes to Erick Christian for creating this amazing project. This fork exists solely to maintain Node 20+ compatibility and will be discontinued once the original package supports modern Node versions.
License
MIT License - see LICENSE file for details.
Support the Original Author
If this project helps you, consider supporting the original creator:
🐛 Troubleshooting
Common Issues
- Authentication Failed: Run
copilot-api auth --verboseto debug - Rate Limited: Use
--rate-limitand--waitflags - Node Version: Ensure Node.js 20+ is installed
- Port Conflicts: Change port with
--port 8080
Debug Information
# Get detailed diagnostic info
npx copilot-api-node20@latest debug --jsonNeed Help?
- Check the original repository for issues and discussions
- Review Claude Code documentation for integration help
Made with ❤️ by the community • Original work by Erick Christian
