How samarth777/claude-code-copilot works
This repository runs a local compatibility proxy so Claude Code can use GitHub Copilot without an Anthropic API key. The main workflow is GitHub device-code authentication, then Claude Code sends Anthropic Messages API requests to the proxy, which translates them for Copilot and converts responses back. The proxy also supports streaming, token-count requests, and emulated web search; a launcher and Docker deployment are documented. Some proxy internals are excerpted only partially, so edges between internal stages follow the README’s workflow description where noted.
Main entry points: proxy.mjs Request Routing · auth.mjs Device Auth · launch.sh One-command Launcher · docker-compose.yml Docker Runtime
Components 17
Authentication
- Device Auth
scripts/auth.mjs - Saved Token
API Proxy
- HTTP Server
scripts/proxy.mjs - Request Routing
scripts/proxy.mjs - Request Translation
scripts/proxy.mjs - Response Translation
scripts/proxy.mjs - Streaming SSE
scripts/proxy.mjs - Token Counting
scripts/proxy.mjs
Web Search
- Search Loop
scripts/proxy.mjs - Brave Search
- DuckDuckGo Lite
Runtime
- One-command Launcher
scripts/launch.sh - Docker Runtime
docker-compose.yml
Other components
- User
- Claude Code
- GitHub OAuth
- Copilot API
Connections 20
- User → Device Auth: starts authentication
README.md - Device Auth → GitHub OAuth: requests device code
scripts/auth.mjs - GitHub OAuth → Device Auth: returns token
scripts/auth.mjs - Device Auth → Saved Token: saves token
scripts/auth.mjs - Device Auth → Copilot API: checks access
scripts/auth.mjs - User → One-command Launcher: starts
README.md - One-command Launcher → HTTP Server: starts proxy
README.md - User → Docker Runtime: starts container
README.md - Claude Code → HTTP Server: sends messages
README.md - HTTP Server → Request Routing: dispatches requests
scripts/proxy.mjs - Request Routing → Saved Token: loads token
scripts/proxy.mjs - Request Routing → Token Counting: handles token counts
scripts/proxy.mjs - Request Routing → Request Translation: translates messages
README.md - Request Translation → Copilot API: forwards completion
README.md - Copilot API → Response Translation: returns response
README.md - Response Translation → Claude Code: returns Anthropic format
README.md - Request Routing → Streaming SSE: emits SSE
scripts/proxy.mjs - Request Routing → Search Loop: handles web search
scripts/proxy.mjs - Search Loop → Brave Search: searches optionally
scripts/proxy.mjs - Search Loop → DuckDuckGo Lite: searches fallback
scripts/proxy.mjs