Use Claude Code for free by routing it through your existing GitHub Copilot subscription.
This project runs a lightweight local proxy that translates between Anthropic's Messages API (which Claude Code speaks) and OpenAI's Chat Completions API (which GitHub Copilot speaks). No Anthropic API key needed — just your Copilot subscription.
- Full API Translation — Anthropic Messages API ↔ OpenAI Chat Completions, including streaming
- Web Search — Emulates Anthropic's
web_search_20250305tool using DuckDuckGo Lite (free) or Brave Search API - Docker Support — Run the proxy as an always-on container that survives reboots
- Zero Dependencies — Pure Node.js, no npm install needed
- GitHub account with an active Copilot subscription (Individual, Business, or Enterprise)
- Node.js 18+ (or Docker)
- Claude Code installed (
npm install -g @anthropic-ai/claude-code)
git clone https://github.com/samarth777/claude-code-copilot.git
cd claude-code-copilot
node scripts/auth.mjsThe auth script opens a GitHub device code flow in your browser. Your token is saved to ~/.claude-copilot-auth.json.
One-command launcher (recommended):
./scripts/launch.shThis auto-starts the proxy (via Docker if available, otherwise as a background process) and launches Claude Code.
Or use Docker directly:
docker compose up -d
ANTHROPIC_BASE_URL=http://localhost:18080 ANTHROPIC_API_KEY=copilot-proxy claudeThe proxy runs with restart: always — it stays running across reboots.
Inside Claude Code, use /model to switch between available models (Claude Opus, Sonnet, etc.).
The proxy emulates Anthropic's web search tool so Claude Code's WebSearch works automatically.
Search providers:
- Brave Search API — Best results. Set
BRAVE_API_KEYenv var (free tier: 2000 queries/month at api.search.brave.com) - DuckDuckGo Lite — Free, no API key needed (default)
Claude Code sends requests in Anthropic format → proxy translates to OpenAI format → forwarded to GitHub Copilot → responses translated back. No data is stored or logged.
"401 Unauthorized" from Copilot
rm ~/.claude-copilot-auth.json
node scripts/auth.mjs"EADDRINUSE: address already in use"
lsof -ti:18080 | xargs kill -9Proxy running but Claude Code shows errors
Make sure both environment variables are set:
ANTHROPIC_BASE_URL=http://localhost:18080 ANTHROPIC_API_KEY=copilot-proxy claude| Variable | Default | Description |
|---|---|---|
COPILOT_PROXY_PORT |
18080 |
Port for the local proxy |
COPILOT_AUTH_FILE |
~/.claude-copilot-auth.json |
Path to saved OAuth token |
BRAVE_API_KEY |
(none) | Brave Search API key for web search |
WEB_SEARCH_MAX_RESULTS |
5 |
Max search results per query |
MIT

