Skip to main content
This integration lets Claude Code route all its requests through Copilot API, so your existing GitHub Copilot subscription powers Claude Code without a separate Anthropic API key. This page covers two setup methods: an interactive one-command setup and a persistent manual configuration using settings.json.
Set your model to claude-opus-4-6 or claude-opus-4.6 — without the [1m] suffix. Requesting a context window that exceeds GitHub Copilot’s limit may trigger account restrictions.

Method 1: Interactive setup with --claude-code

The quickest way to get started is the --claude-code flag. It starts the proxy, prompts you to pick models, and copies a ready-to-run Claude Code launch command to your clipboard.
1

Start the proxy with the flag

Run the following command in your terminal:
npx @nick3/copilot-api@latest start --claude-code
2

Select your models

The CLI prompts you to choose a primary model and a small, fast model for background tasks. Select the models you want to use.
3

Launch Claude Code

After you select models, the proxy copies a launch command to your clipboard. Paste and run it in a new terminal window to start Claude Code with the proxy already configured.
If you have API key authentication enabled (auth.apiKeys in config.json), set ANTHROPIC_AUTH_TOKEN to one of your configured keys so Claude Code can authenticate with the proxy.

Method 2: Manual configuration with settings.json

For a persistent setup that survives reboots without re-running the interactive flow, create a .claude/settings.json file at the root of your project.
1

Start the proxy

In one terminal, start the Copilot API proxy:
npx @nick3/copilot-api@latest start
2

Create the settings file

Create .claude/settings.json in your project root with the following content:
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://localhost:4141",
    "ANTHROPIC_AUTH_TOKEN": "dummy",
    "ANTHROPIC_MODEL": "gpt-5.4",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-5.4",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5-mini",
    "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
    "CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION": "false",
    "CLAUDE_CODE_DISABLE_TERMINAL_TITLE": "true",
    "CLAUDE_PLUGIN_ENABLE_QUESTION_RULES": "true"
  },
  "permissions": {
    "deny": [
      "WebSearch",
      "mcp__ide__executeCode"
    ]
  }
}
3

Launch Claude Code

Start Claude Code in the same project directory. It will automatically pick up the settings file and route requests through the proxy.

Key environment variables

VariableValuePurpose
ANTHROPIC_BASE_URLhttp://localhost:4141Points Claude Code at the local proxy
ANTHROPIC_AUTH_TOKENdummy (or a real key)Required by Claude Code; use a real key if auth.apiKeys is configured
ANTHROPIC_MODELe.g. gpt-5.4Primary model for most tasks
ANTHROPIC_DEFAULT_SONNET_MODELe.g. gpt-5.4Model used for Sonnet-tier requests
ANTHROPIC_DEFAULT_HAIKU_MODELe.g. gpt-5-miniFast model for background and lightweight tasks
DISABLE_NON_ESSENTIAL_MODEL_CALLS1Prevents warmup calls from consuming premium quota
CLAUDE_CODE_ATTRIBUTION_HEADER0Stops Claude Code from injecting billing and version info into system prompts, which would invalidate the prompt cache
Set ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_DEFAULT_HAIKU_MODEL to consistent values. Keeping them aligned ensures Claude Code behaves like a native GitHub Copilot Claude agent.
Do not enable ENABLE_TOOL_SEARCH. Claude Code uses client-side tool search mode, which requires an extra request per deferred tool load and reduces cache hit rates. The proxy has known compatibility issues with client tool search mode that can cause errors.
Add the following reminders to your CLAUDE.md file. They instruct the model to use the question tool for user interactions instead of outputting free-form questions, which helps maintain clean tool semantics:
- Prohibited from directly asking questions to users, MUST use question tool.
- Once you can confirm that the task is complete, MUST use question tool to make user confirm. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again, after try again, MUST use question tool to make user confirm again.
If you set CLAUDE_PLUGIN_ENABLE_QUESTION_RULES=1 in your settings, the Claude Code plugin injects these reminders automatically at session start — you do not need to add them to CLAUDE.md manually.

Install the Claude Code plugin

After configuring the proxy, install the Claude Code plugin to enable subagent marker injection and session tracking. The plugin helps the proxy correctly classify subagent-originated traffic and preserve session context. See the Plugin Integrations guide for installation instructions.