# Claude Code via GitHub Copilot How to route [[Claude Code]] through your GitHub Copilot subscription using a local [[LiteLLM]] proxy. This lets you use Claude Code without a direct Anthropic subscription, authenticated via GitHub OAuth. ## How it works [[LiteLLM]] acts as a local proxy that translates Claude Code's Anthropic API calls into GitHub Copilot API calls. Claude Code is configured to point at `localhost:4000` instead of Anthropic's servers. LiteLLM handles OAuth authentication with GitHub and stores the resulting token locally. ## Prerequisites - `claude.exe` available at `%USERPROFILE%/.local/bin` - **Git 2.46 specifically** — newer versions break the setup - Git Bash ## Setup ### 1. Clone and configure the proxy Clone [https://github.com/NationalBankBelgium/litellm-claude-code-proxy](https://github.com/NationalBankBelgium/litellm-claude-code-proxy), then: - Copy `.env.example` to `.env` - Set `LITELLM_MASTER_KEY` to a value of your choice (acts as your local API key) - Update `litellm_config.yaml` with the model list below ### 2. LiteLLM configuration ```yaml litellm_settings: master_key: "os.environ/LITELLM_MASTER_KEY" ssl_verify: false additional_drop_params: ["response_format"] model_list: - model_name: claude-opus-4-7* litellm_params: model: github_copilot/claude-opus-4.7 extra_headers: {"Editor-Version": "vscode/1.85.1", "Copilot-Integration-Id": "vscode-chat"} - model_name: claude-opus-4-6* litellm_params: model: github_copilot/claude-opus-4.6 extra_headers: {"Editor-Version": "vscode/1.85.1", "Copilot-Integration-Id": "vscode-chat"} - model_name: claude-sonnet-4-6* litellm_params: model: github_copilot/claude-sonnet-4.6 extra_headers: {"Editor-Version": "vscode/1.85.1", "Copilot-Integration-Id": "vscode-chat"} - model_name: claude-haiku-4-5* litellm_params: model: github_copilot/claude-haiku-4.5 extra_headers: {"Editor-Version": "vscode/1.85.1", "Copilot-Integration-Id": "vscode-chat"} - model_name: gpt-4 litellm_params: model: github_copilot/gpt-4 extra_headers: {"Editor-Version": "vscode/1.85.1", "Copilot-Integration-Id": "vscode-chat"} ``` ### 3. Authenticate with GitHub Run `./start_proxy.sh` from the project folder. LiteLLM will print a GitHub URL. Approve the connection in your browser; then paste the single-use code back into the terminal. LiteLLM stores the resulting token at `%USERPROFILE%/.config/litellm/github_copilot`. ### 4. Configure Claude Code Edit `%USERPROFILE%/.claude/settings.json`: ```json { "env": { "ANTHROPIC_BASE_URL": "http://localhost:4000", "ANTHROPIC_API_KEY": "<your LITELLM_MASTER_KEY value>" } } ``` ### 5. Run Claude Code Run `claude` (no `--model` flags needed for the default model). Test with a prompt. ## Critical constraints - **Disable Extended Thinking** (`Alt+T`) — the GitHub Copilot provider does not support it; leaving it on causes API errors - **The LiteLLM proxy must be running** every time you use Claude Code in this mode — there is no fallback ## References - https://docs.litellm.ai/docs/providers/github_copilot - https://blog.f12.no/wp/2025/09/22/using-claude-code-with-github-copilot-a-guide - https://kazuhira--r-hatenablog-com.translate.goog/entry/2026/03/12/114041 - https://github.com/NationalBankBelgium/litellm-claude-code-proxy ## Related - [[Claude Code]] - [[GitHub Copilot]] - [[LiteLLM]] - [[LiteLLM Proxy Configuration]] - [[LiteLLM Claude Code Proxy]] - [[Claude Code Installation]]