Use Claude Code powered by your GitHub Copilot subscription — no Anthropic API key needed.
This project sets up a local LiteLLM proxy that translates Claude Code's requests and forwards them to GitHub Copilot's Claude models.
Claude Code → LiteLLM Proxy (localhost:4000) → GitHub Copilot API → Claude model
- Claude Code sends requests to the local proxy (thinking it's talking to Anthropic)
- LiteLLM translates and forwards them to GitHub Copilot's API
- GitHub Copilot routes to the Claude model and returns the response
- LiteLLM translates the response back to Claude Code's expected format
- Python 3.10+ —
python3 --version - GitHub Copilot subscription — Individual, Business, or Enterprise
- Claude Code CLI —
npm install -g @anthropic-ai/claude-code
git clone https://github.com/chonchiog/litellm-copilot-proxy.git
cd litellm-copilot-proxy
chmod +x setup.sh start-proxy.sh test-proxy.sh run-claude.sh
./setup.shThis creates a Python virtual environment, installs LiteLLM, and generates a random master key in .env.
./start-proxy.shLeave this terminal open — the proxy runs on http://localhost:4000.
In a new terminal, run:
./test-proxy.shThe first time you do this, the proxy terminal will display:
Please visit https://github.com/login/device and enter code XXXX-XXXX to authenticate
- Open the URL in your browser
- Enter the code shown
- Authorize the app
Credentials are cached locally at ~/.config/litellm/github_copilot/ — you won't need to log in again.
./run-claude.shThat's it! Claude Code is now running through your GitHub Copilot subscription.
The default model is copilot-opus-1m (Claude Opus 4.6 with 1M context). You can switch models by passing the alias as an argument:
./run-claude.sh copilot-opus # Claude Opus 4.6 (200K context)
./run-claude.sh copilot-sonnet # Claude Sonnet 4.6 (faster, lighter)| Alias | Copilot Model | Context Window |
|---|---|---|
copilot-opus-1m |
claude-opus-4.6-1m |
1M tokens |
copilot-opus |
claude-opus-4.6 |
200K tokens |
copilot-sonnet |
claude-sonnet-4.6 |
200K tokens |
Edit config.yaml and add entries under model_list. For example, to add Haiku:
- model_name: copilot-haiku
litellm_params:
model: github_copilot/claude-haiku-4.5Then restart the proxy and use ./run-claude.sh copilot-haiku.
| Model ID | Name |
|---|---|
claude-opus-4.6-1m |
Claude Opus 4.6 (1M context) |
claude-opus-4.6 |
Claude Opus 4.6 |
claude-sonnet-4.6 |
Claude Sonnet 4.6 |
claude-sonnet-4.5 |
Claude Sonnet 4.5 |
claude-opus-4.5 |
Claude Opus 4.5 |
claude-sonnet-4 |
Claude Sonnet 4 |
claude-haiku-4.5 |
Claude Haiku 4.5 |
Note: Model availability depends on your Copilot plan. Some models (like
claude-opus-4.6-1m) may require specific plan tiers.
export GITHUB_COPILOT_TOKEN_DIR=~/.my-custom-dir
./start-proxy.shIf you prefer not to use the helper scripts:
# Set up environment
python3 -m venv .venv
source .venv/bin/activate
pip install 'litellm[proxy]'
# Generate a master key
export LITELLM_MASTER_KEY="sk-$(openssl rand -hex 32)"
# Start the proxy
litellm --config ./config.yaml
# In another terminal, point Claude Code at the proxy
export ANTHROPIC_BASE_URL="http://localhost:4000"
export ANTHROPIC_AUTH_TOKEN="$LITELLM_MASTER_KEY"
claude --model copilot-opus-1m| Problem | Fix |
|---|---|
Connection refused on port 4000 |
Make sure ./start-proxy.sh is running in another terminal |
Model not found |
Verify the alias in config.yaml matches what you pass to --model |
UnsupportedParamsError |
Ensure drop_params: true is set in litellm_settings in config.yaml |
| Auth errors | Re-run ./test-proxy.sh — it will trigger a new device-flow login |
| Model not available on your plan | Try a different model: ./run-claude.sh copilot-opus or copilot-sonnet |
litellm-copilot-proxy/
├── config.yaml # LiteLLM model routing configuration
├── setup.sh # One-time bootstrap (venv, install, key generation)
├── start-proxy.sh # Start the LiteLLM proxy server
├── test-proxy.sh # Test the proxy with a simple curl request
├── run-claude.sh # Launch Claude Code through the proxy
├── .env # Master key (auto-generated, git-ignored)
├── .env.example # Template showing required env vars
├── .gitignore # Keeps secrets and venv out of git
└── .venv/ # Python virtual environment (created by setup.sh)
- LiteLLM — the proxy and GitHub Copilot provider
- GitHub Copilot — the model backend
- Claude Code — the CLI client