β οΈ Disclaimer: This project is for educational purposes only. It is intended to demonstrate API proxy patterns and OAuth device flow authentication. Use at your own risk and ensure compliance with GitHub Copilot's Terms of Service.
A proxy server that enables Claude Code and Cursor IDE to use GitHub Copilot's AI models instead of direct API access. Use your GitHub Copilot subscription to access Claude models (Opus 4.5, Sonnet 4.5, Haiku 4.5) in Claude Code, or GPT models in Cursor IDE.
- Anthropic API Compatibility: Implements the Anthropic Messages API for Claude Code
- OpenAI API Compatibility: Implements the OpenAI API format for Cursor IDE
- Claude Model Support: Access Claude Opus 4.5, Sonnet 4.5, and Haiku 4.5 via Copilot
- GitHub Copilot Integration: Connects to GitHub Copilot's backend services
- Seamless Authentication: Handles GitHub OAuth device flow authentication
- Token Management: Automatically refreshes Copilot tokens
- Streaming Support: Supports both streaming and non-streaming completions
- Easy Configuration: Simple setup with Claude Code or Cursor IDE
- Node.js 18.0 or higher
- GitHub Copilot subscription (with access to Claude models)
- Claude Code or Cursor IDE
npm install -g claudecode-copilot-proxy
claudecode-copilot-proxyThat's it! The server will start at http://localhost:3000
-
Clone the repository:
git clone https://github.com/shyamsridhar123/ClaudeCode-Copilot-Proxy.git cd ClaudeCode-Copilot-Proxy -
Install dependencies:
npm install
-
Build the project:
npm run build
-
Start the proxy server:
npm start
-
Start the proxy server:
npm start
You should see the authentication portal at http://localhost:3000
-
Complete GitHub authentication by pasting your auth code in the browser
-
Configure Claude Code to use the proxy by adding environment variables to your settings file:
Option A: Project-specific configuration (recommended)
Add to
.claude/settings.local.jsonin your project:{ "env": { "ANTHROPIC_BASE_URL": "http://localhost:3000", "ANTHROPIC_AUTH_TOKEN": "sk-dummy", "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1" } }Option B: Global configuration
Add to
~/.claude/settings.json:{ "env": { "ANTHROPIC_BASE_URL": "http://localhost:3000", "ANTHROPIC_AUTH_TOKEN": "sk-dummy", "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1" } } -
Enter
claudein your terminal to start Claude Code with the proxy
β
Server logs show 200 responses: Look for POST /v1/messages - 200 in the server output
β
Token usage is tracked: You'll see Tracked request for session ... +XX tokens
β
Model being used: Shows "model": "claude-opus-4.5" or "claude-sonnet-4.5"
β Claude Code gets responses: Your commands should complete without errors
β Usage stats: Check http://localhost:3000/usage.html in your browser to see how many tokens you've used
| Model | Description |
|---|---|
claude-opus-4.5 |
Claude Opus 4.5 (Default) |
claude-sonnet-4.5 |
Claude Sonnet 4.5 |
claude-haiku-4.5 |
Claude Haiku 4.5 |
The proxy also supports GPT and Gemini models available in GitHub Copilot. To use them, add ANTHROPIC_MODEL to your settings:
{
"env": {
"ANTHROPIC_BASE_URL": "http://localhost:3000",
"ANTHROPIC_AUTH_TOKEN": "sk-dummy",
"ANTHROPIC_MODEL": "gpt-5.2",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3-pro-preview",
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}| Model | Description |
|---|---|
gpt-5.2 |
GPT 5.2 |
gemini-3-pro-preview |
Gemini 3 Pro Preview |
- Open Cursor IDE
- Go to Settings > API Keys
- In the "Override OpenAI Base URL" section, enter:
http://localhost:3000 - Go to http://localhost:3000 in your browser
- Follow the authentication steps to connect to GitHub
Once configured, you can use Cursor IDE as normal. All AI-powered features will now use your GitHub Copilot subscription instead of Cursor's API.
To switch back to Cursor's API:
- Go to Settings > API Keys
- Remove the Override OpenAI Base URL
βββββββββββββββββββ ββββββββββββββββββββββββββββ βββββββββββββββββββββββ
β Claude Code ββββββΆβ Copilot Proxy Server ββββββΆβ GitHub Copilot API β
β (Anthropic API β β β β (Anthropic Models) β
β format) β β - Auth (OAuth device) β β - claude-opus-4.5 β
βββββββββββββββββββ β - Request translation β β - claude-sonnet-4.5 β
β - Response translation β β - claude-haiku-4.5 β
β - Streaming support β βββββββββββββββββββββββ
ββββββββββββββββββββββββββββ
- The proxy authenticates with GitHub using the OAuth device flow
- GitHub provides a token that the proxy uses to obtain a Copilot token
- Claude Code sends requests to the proxy in Anthropic format (
/v1/messages) - The proxy forwards requests to GitHub Copilot's Anthropic model endpoints
- Responses are returned in Anthropic format with streaming support
- The proxy authenticates with GitHub using the OAuth device flow
- GitHub provides a token that the proxy uses to obtain a Copilot token
- Cursor sends requests to the proxy in OpenAI format
- The proxy converts these requests to GitHub Copilot's format
- The proxy forwards responses back to Cursor in OpenAI format
npm run devnpm testnpm run lintMIT License
Copyright (c) 2025
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes using conventional commits (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request