DEV Community

Cover image for How to Use Copilot Claude Sonnet & Opus models for Free Inside Claude Code (After VS Code Copilot Removed Them)
Lokesh
Lokesh

Posted on

How to Use Copilot Claude Sonnet & Opus models for Free Inside Claude Code (After VS Code Copilot Removed Them)

GitHub quietly removed Claude Sonnet 4.5 and Opus 4.5 from the VS Code
Copilot extension. But here's what nobody is talking about — they're
still fully accessible through the Copilot API.

In this guide I'll show you exactly how to get Claude Sonnet 4.5 running
inside Claude Code CLI completely free using an open-source proxy.

Students pay $0. Everyone else pays $10/month for Copilot — still way
cheaper than Anthropic's API.


Why This Works

GitHub removed the models from the VS Code UI — not from their API.
The claude-sonnet-4.5 and claude-opus-4.5 models still respond
normally when called directly via api.githubcopilot.com.

We exploit this using three tools:

  • OpenCode CLI — authenticates with GitHub and stores your Copilot token
  • claude-code-proxy — translates Anthropic API → OpenAI API format
  • Claude Code CLI — Anthropic's agentic coding tool

The Architecture

Claude Code CLI
      │  Anthropic format
      ▼
claude-code-proxy (localhost:8082)
      │  OpenAI format  
      ▼
api.githubcopilot.com
      │
      ▼
claude-sonnet-4.5 ✅
Enter fullscreen mode Exit fullscreen mode

Step 1 — Get GitHub Copilot Free (Students)

Visit education.github.com/pack and
verify with your .edu email or student ID. Approval takes 1–3 days.
GitHub Copilot is then permanently free on your account.

Not a student? Copilot is $10/month at github.com/features/copilot.


Step 2 — Install & Authenticate OpenCode

curl -fsSL https://opencode.ai/install | bash
source ~/.bashrc
opencode auth login github
Enter fullscreen mode Exit fullscreen mode

A device code appears in your terminal. Go to github.com/login/device,
enter it, and authorize. Your token is now stored at
~/.local/share/opencode/auth.json.


Step 3 — Setup claude-code-proxy

git clone https://github.com/fuergaosi233/claude-code-proxy
cd claude-code-proxy
pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Create a .env file inside the folder:

OPENAI_API_KEY=your_token_from_auth.json
OPENAI_BASE_URL=https://api.githubcopilot.com
BIG_MODEL=claude-sonnet-4.5
MIDDLE_MODEL=claude-sonnet-4.5
SMALL_MODEL=claude-haiku-4.5
MAX_TOKENS_LIMIT=8096
REQUEST_TIMEOUT=300
PORT=8082
Enter fullscreen mode Exit fullscreen mode

⚠️ The URL must be https://api.githubcopilot.com — NOT with /v1
at the end. That causes a 404.


Step 4 — Launch Claude Code

Install Claude Code:

npm install -g @anthropic-ai/claude-code
Enter fullscreen mode Exit fullscreen mode

Terminal 1 — start the proxy:

cd claude-code-proxy && python3 start_proxy.py
Enter fullscreen mode Exit fullscreen mode

Terminal 2 — launch Claude Code:

export ANTHROPIC_BASE_URL="http://localhost:8082"
export ANTHROPIC_AUTH_TOKEN="anything"
claude --model claude-sonnet-4-5
Enter fullscreen mode Exit fullscreen mode

That's it. Type hi to test. 🎉


Available Models

All free with GitHub Copilot:

Model Notes
claude-sonnet-4.5 ★ Removed from VS Code
claude-opus-4.5 ★ Removed from VS Code
claude-haiku-4.5 Fastest Claude
gpt-4.1 Best speed/quality balance
gpt-4o Fast general purpose
gpt-5 Most powerful GPT
gemini-2.5-pro Long context

Switch models by changing BIG_MODEL in your .env and restarting
the proxy.


Common Issues

Token expired → Run opencode auth login github again and update
OPENAI_API_KEY in .env

404 error → Remove /v1 from OPENAI_BASE_URL

ECONNREFUSED → Proxy isn't running. Start it in Terminal 1 first.

Slow responses → Switch to gpt-4.1 for 3–5s responses instead
of 30s with Sonnet.


Resources

Drop any questions in the comments — happy to help! 👇

Top comments (0)