DEV Community

Allen Tuh
Allen Tuh

Posted on

Using Claude Code with GitHub Copilot Subscription

Do you have a Github Copilot subscription sitting around doing nothing? Why not pair it with the Claude Code (claimed by many developers as the best AI coding agent thus far).

A. Using LiteLLM

  1. Install Python on your local machine
  2. Setup LiteLLM
  3. Create a folder for LiteLLM e.g.: litellm
  4. Create a config.yaml file with the below content in the litellm folder
model_list:
  - model_name: anthropic/*
    litellm_params:
      model: github_copilot/gpt-5-mini
      extra_headers: {"editor-version": "vscode/1.85.1", "Copilot-Integration-Id": "vscode-chat"}
  - model_name: anthropic/*
    litellm_params:
      model: github_copilot/claude-sonnet-4.5
      extra_headers: {"editor-version": "vscode/1.85.1", "Copilot-Integration-Id": "vscode-chat"}
Enter fullscreen mode Exit fullscreen mode
  1. Start the litellm proxy server
litellm --config config.yaml
Enter fullscreen mode Exit fullscreen mode

B. Using Copilot API

  1. First you need to setup GitHub Copilot API proxy
  2. Run npm install -g copilot-api to install the API proxy
  3. Run copilot-api start to start the proxy server

Setup Claude Code

  1. Now install Claude Code in your local machine
  2. Run npm install -g @anthropic-ai/claude-code
  3. Edit the config file .claude/settings.json for Claude Code to use the LiteLLM or Copilot API proxy server instead of the default Claude subscription which is more expensive
  4. Add this settings into the config file

LiteLLM

{
  "env": {
    "ANTHROPIC_BASE_URL": "http://0.0.0.0:4000",
    "ANTHROPIC_AUTH_TOKEN": "sk-litellm-static-key",
    "ANTHROPIC_MODEL": "github_copilot/claude-sonnet-4.5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "github_copilot/gpt-5-mini",
    "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
Enter fullscreen mode Exit fullscreen mode

Copilot API

{
  "env": {
    "ANTHROPIC_BASE_URL": "http://localhost:4141",
    "ANTHROPIC_AUTH_TOKEN": "sk-dummy",
    "ANTHROPIC_MODEL": "claude-sonnet-4.5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5-mini",
    "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
Enter fullscreen mode Exit fullscreen mode

Start your Claude Code and enjoy coding!

Top comments (1)

Collapse
 
alejandrobmslalom profile image
alejandrobm-slalom • • Edited

Thanks for sharing this guide — it helped me get most of the way there. One important update for anyone following it now: some of the values in the original post appear to be outdated for current copilot-api and current Claude Code builds.

What changed since the tutorial was published:

The old ANTHROPIC_MODEL=claude-sonnet-4.5 setup did not work reliably for me with the current copilot-api flow.
The current working setup on my machine uses the local proxy exactly as described, but Claude Code works when the model values are mapped to gpt-4.1 instead.
Old shell exports like CLAUDE_API_KEY or ANTHROPIC_API_KEY can interfere with the local proxy setup if they are still present in .zshrc, .bashrc, or your current terminal session.
You should validate with a real Claude request, not only by checking that the proxy starts.
These are the exact steps that work for me right now:

Install the proxy:
npm install -g copilot-api

Start the local proxy:
copilot-api start

Create or update ~/.claude/settings.json with this:

{
"env": {
"ANTHROPIC_BASE_URL": "localhost:4141",
"ANTHROPIC_AUTH_TOKEN": "dummy",
"ANTHROPIC_MODEL": "gpt-4.1",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-4.1",
"ANTHROPIC_SMALL_FAST_MODEL": "gpt-4.1",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-4.1",
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT": "1"
}
}

Remove or unset any conflicting API key exports from your shell, especially anything like:
export CLAUDE_API_KEY=...
export ANTHROPIC_API_KEY=...

Confirm the proxy is alive:
curl localhost:4141/usage

Run a real Claude Code test:
claude -p 'Reply only with OK'

Expected result:
OK

One more note: Claude Code may still print an unrecognized_model warning for gpt-4.1, but in my case the request still works correctly and returns a valid response.