Run Claude Code Free with Copilot
Route Claude Code through your free GitHub Copilot Student subscription.
Introduction
30 Second Summary
AI-powered coding assistants can write, edit, and run code for you. The best ones cost $20 or more per month, which is a lot when you're a student.
In this project, you will set up a free local gateway that connects Claude Code's powerful agentic coding workflow to the AI models included in your GitHub Copilot Student subscription.
What You'll Build
A fully configured local gateway (CCPG) that routes Claude Code's API requests through your free GitHub Copilot Student models, giving you agentic coding features at zero cost.
By the end of this project, you'll have:
- CCPG desktop app installed and authenticated with your GitHub Copilot Student subscription via OAuth Device Flow.
- Claude Code running through the local gateway, powered by Copilot models at zero cost.
- A working Python CLI tool built using Claude Code's agentic features (file creation, command execution, iterative debugging) through the gateway.
- Secret Mission: Create a Model Chain that falls back between multiple free providers for maximum reliability.
Are there any prerequisites?
Yes. You need a verified GitHub Student account with Copilot access already set up, Claude Code CLI installed, and Node.js and Git installed on your Mac.
GitHub has temporarily paused new student plan sign-ups as of April 20, 2026. If you do not already have a verified student account with Copilot access, this project will not work for you until sign-ups reopen.
Before We Start
Before We Start...
Install CCPG Desktop App
Claude Code is a powerful agentic coding tool that can edit files, run commands, and understand entire projects. It normally requires a paid Anthropic subscription to use.
CCPG (Claude Code Provider Gateway) is a free, open-source desktop app that acts as a local proxy. It intercepts Claude Code's API requests and reroutes them through other AI providers, including the models you already get for free with your GitHub Copilot Student plan. In this step, you'll download and install CCPG on your Mac so it's ready to connect to Copilot.
In this step, get ready to:
- Download the CCPG desktop app from GitHub Releases.
- Install and launch CCPG on your Mac.
- Set up the Terminal Integration CLI.
Download the CCPG desktop app
CCPG is distributed as a macOS .dmg file from its GitHub Releases page. Since you're on an M1 Mac, you need the Apple Silicon build.
- Open the CCPG GitHub Releases page in your browser.
- Find the latest release, labeled CC Provider Gateway v0.2.6.
- Expand the Assets section by clicking on it.
- Download the .dmg file that includes aarch64 and Mac.Silicon in the filename. This is the Apple Silicon build for your M1 Mac.
Why aarch64?
Your M1 Mac uses an ARM-based chip (Apple Silicon). The aarch64 label means the app is compiled natively for this architecture. Downloading the Intel (x64) version would still work through Rosetta translation, but the native build runs faster.
Install and launch CCPG
Now that you have the .dmg downloaded, you'll install it like any other Mac app. CCPG is not from the App Store, so macOS will ask you to approve it manually.
- Double-click the downloaded .dmg file to mount it.
- Drag the CCPG app icon into the Applications folder shortcut shown in the window.
- Press Cmd+Space to open Spotlight search.
- Type CCPG and press Enter to launch the app.
Seeing a security warning?
macOS blocks apps that are not from the App Store on first launch. If you see a message saying the app cannot be opened, do not try to force-open it from the dialog.
Instead, close the warning and follow these steps:
- Open System Settings (click the Apple menu in the top-left corner, then System Settings).
- Click Privacy & Security in the sidebar.
- Scroll down to the Security section. You'll see a message about CCPG being blocked.
- Click Open Anyway.
- Confirm by clicking Open in the follow-up dialog.
Once approved, the CCPG desktop app opens and its background daemon starts automatically. You should see the CCPG dashboard window.
App still won't open?
If the Open Anyway button does not appear in Privacy & Security, try launching the app one more time first. The button only appears after macOS has blocked the app at least once.
Ask for help: Why won't my CCPG app open on macOS after I approved it in Privacy & Security?
Set up Terminal Integration
CCPG includes a CLI command called ccpg that you'll use to launch Claude Code through the gateway. You need to install it from inside the desktop app.
- In the CCPG desktop app, click Dashboard in the sidebar.
- Click Terminal Integration.
- Follow the setup wizard to install the ccpg shell command. It will configure your shell (zsh by default on macOS) so that the command is available in any terminal window.
What does Terminal Integration do?
Terminal Integration adds a ccpg shell function to your PATH. When you run ccpg --Copilot later, this function sets the right environment variables and launches Claude Code pointing at the local CCPG proxy on 127.0.0.1:49250.
Your terminal needs to reload its configuration to pick up the new command.
- Close your current terminal window completely.
- Open a new terminal window by pressing Cmd+Space, typing Terminal, and pressing Enter.
- Verify the CLI is working by running this command:
ccpg --help
✔️ I see help output
The ccpg CLI is installed and ready. You should see a list of available flags and options. You're all set for the next step.
ⓧ Command not found
Your shell has not picked up the new command yet. Try these fixes:
- Make sure you fully closed the old terminal and opened a fresh one (not just a new tab in the same window).
- Go back to CCPG's Dashboard > Terminal Integration and re-run the install step. It may prompt you to select your shell (zsh, bash, or fish).
- If you use a non-default shell, make sure the integration wizard detected the correct one.
After re-running, close and reopen your terminal again, then retry ccpg --help.
Ask for help: ccpg command not found after installing Terminal Integration
Your gateway is installed and the CLI is ready. Next up, you'll connect CCPG to your GitHub Copilot Student subscription so it can route requests through Copilot's AI models for free.
Connect GitHub Copilot
CCPG is installed and your CLI is ready. Now you need to connect it to the AI models that will actually power your coding sessions.
Your free GitHub Copilot Student subscription includes access to a selection of AI models. CCPG connects to those models using OAuth Device Flow, which means you authorize in a browser instead of copying and pasting API keys.
In this step, get ready to:
- Enable the GitHub Copilot provider in CCPG.
- Authorize the connection via OAuth Device Flow in your browser.
- Test the connection and confirm available models are populated.
Enable the GitHub Copilot provider
CCPG supports multiple AI providers. You need to enable and authenticate the one you want to use before routing any requests through it.
- In the CCPG desktop app, click on the Providers section in the sidebar.
- Find the GitHub Copilot provider card.
- Click the card to enable it.
- Click Connect to start the OAuth Device Flow.
CCPG will display a device code and open a browser window to the GitHub authorization page.
What is OAuth Device Flow?
OAuth Device Flow is a way for desktop apps and CLI tools to authenticate without you pasting secrets. Instead, the app shows you a short code (8 characters with a hyphen) and sends you to a browser page where you type it in.
GitHub verifies the code, you click authorize, and the app receives an access token behind the scenes. The code expires after 15 minutes, so enter it promptly.
Authorize the connection in your browser
The browser should have opened to https://github.com/login/device. If it did not open automatically, navigate there manually.
- Look at the device code displayed in the CCPG app. It is an 8-character code with a hyphen in the middle.
- In the browser, paste or type the device code into the input field.
- Click Continue.
- GitHub will show an authorization prompt. Click Authorize to grant CCPG access to your Copilot subscription.
- Return to the CCPG desktop app.
The GitHub Copilot provider card should now show a green connected status.
Code expired before you entered it?
The device code expires after 15 minutes. If you see an expiration error, click Connect again in CCPG to generate a fresh code.
Test your Copilot connection
A green status means CCPG stored your OAuth token. Now confirm it can actually reach the Copilot models endpoint.
- On the GitHub Copilot provider card, click Test.
- CCPG will query the Copilot models endpoint and confirm access.
- You should see available models populate in the provider's model list.
Why can't I choose a specific model?
GitHub Copilot Student uses auto model selection. The models available depend on what GitHub exposes via the Copilot API for the student tier, and the selection may change over time.
CCPG discovers whichever models are available to your account. You do not need to configure a specific model name manually.
Test failing or no models showing?
Make sure your GitHub Student account has Copilot access activated. You can check this at github.com in Settings > Copilot.
If the test times out, try disconnecting and reconnecting the provider. Click Connect again to redo the Device Flow.
Help me troubleshoot my CCPG GitHub Copilot connection. The test is failing or no models are appearing in the provider list.
Your Copilot connection is live and CCPG can see the available models. Next up, you will launch Claude Code through this gateway and start using it for real coding tasks.
Launch Claude Code Through the Gateway
Your GitHub Copilot provider is connected and ready to serve requests. Now it is time to route Claude Code through the CCPG gateway so every prompt goes through your free Copilot models.
Before launching, there is one potential conflict to resolve. Claude Code stores its own settings in JSON files that can include environment variables pointing to Anthropic's API directly. If those exist, they override the gateway and your requests bypass CCPG entirely.
In this step, get ready to:
- Clean any conflicting settings from your Claude Code configuration files.
- Create a test project directory and launch Claude Code through the CCPG gateway.
- Use the model picker and generate code through your Copilot subscription.
Check your Claude Code settings for conflicts
Claude Code's ~/.claude/settings.json file can contain an env block with environment variables. If ANTHROPIC_AUTH_TOKEN or ANTHROPIC_BASE_URL are set there, Claude Code will talk directly to Anthropic's servers and skip CCPG completely.
- View your user settings file by running this command:
cat ~/.claude/settings.json
- Next, check the local settings file by running:
cat ~/.claude/settings.local.json
What am I looking for?
You are looking for an env block that contains ANTHROPIC_AUTH_TOKEN or ANTHROPIC_BASE_URL. A problematic file would look something like this:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-ant-...",
"ANTHROPIC_BASE_URL": "https://api.anthropic.com"
}
}
If either file does not exist, you will see a "No such file or directory" message. That is perfectly fine and means there is nothing to clean up.
✔️ I don't see ANTHROPIC_AUTH_TOKEN or ANTHROPIC_BASE_URL
Your settings are clean. No changes needed. Move on to the next substep.
ⓧ I see one or both of these entries
You need to remove those entries from the env block. Open the file that contains them in a text editor.
- Open the file by running:
open ~/.claude/settings.json
- Delete the ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL lines from the env block.
- If those were the only entries in the env block, you can remove the entire env key.
- Save and close the file.
- Repeat for ~/.claude/settings.local.json if it also contained conflicting entries.
Not sure how to edit the file?
You can also use nano in the terminal: run nano ~/.claude/settings.json, make your edits, then press Ctrl+O to save and Ctrl+X to exit.
Help me remove ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL from my Claude Code settings files.
Create a test project and launch Claude Code through CCPG
With your settings clean, you can now launch Claude Code through the CCPG gateway. CCPG intercepts Claude Code's API calls and routes them to your Copilot models instead.
- Create a test project directory, initialize it as a Git repository, and move into it by running these commands:
mkdir ~/ccpg-test && cd ~/ccpg-test && git init
Why do I need a git repo?
Claude Code expects to run inside a Git repository. Initializing one with git init satisfies this requirement and enables features like file tracking and project context awareness.
- Launch Claude Code through the Copilot provider by running:
ccpg --Copilot
What does this command do?
The ccpg --Copilot command starts a local proxy on 127.0.0.1:49250 and launches Claude Code with its API endpoint pointing at that proxy. Every request Claude Code makes is intercepted, translated, and forwarded to the GitHub Copilot API using your authenticated token.
- Confirm Claude Code starts and you see its interactive prompt in your terminal.
- Switch to the CCPG desktop app and click the History tab. You should see initial requests appearing as Claude Code connects through the gateway.
Claude Code not starting?
Make sure the CCPG desktop app is still running. The gateway process depends on it.
If you see an error about authentication or API keys, double-check that you removed any ANTHROPIC_AUTH_TOKEN or ANTHROPIC_BASE_URL entries from your settings files in the previous substep.
Help me troubleshoot why Claude Code is not launching through ccpg --Copilot.
Browse available models and test a prompt
Claude Code is now running through your Copilot subscription. You can use the /model command to see which models are available and select one to work with.
- Inside your Claude Code session, type /model and press Enter.
- A model picker appears showing the models available through your Copilot subscription.
- Select a model from the list by using the arrow keys and pressing Enter.
Which models will I see?
GitHub Copilot Student uses auto model selection. The exact models available depend on what GitHub exposes through the Copilot API for the student tier. You may see different model names than a paid Copilot Pro subscriber would see.
- Test the connection by typing this prompt into Claude Code:
Create a Python script that prints the Fibonacci sequence up to n terms.
- Watch Claude Code generate the Python script, create a file, and potentially offer to run it.
- If Claude Code asks for permission to create files or run commands, approve the requests.
- Switch to the CCPG desktop app and check the History tab. You should see the request logged with details like the model used, token count, and latency.
What just happened?
Your prompt traveled from Claude Code to the CCPG local proxy, which translated it into a Copilot-compatible API call. GitHub's servers processed it using the model available on your student plan and sent the response back through the proxy. Claude Code received the response as if it came from its native API.
The result is full agentic capability (file creation, code generation, command execution) at zero cost through your student subscription.
You have Claude Code running through your free Copilot subscription. Next up, you will put the agentic workflow to the test by building a real project from a single prompt.
Build Something with Agentic Claude Code
You have a working gateway that connects Claude Code to your free Copilot models. Now it is time to put it to real use.
In this step, you will give Claude Code a multi-step coding task and watch it work through the entire process autonomously. It will create files, write code, install dependencies, and run commands. This is the agentic workflow in action, powered entirely by your student subscription.
In this step, get ready to:
- Launch a new Claude Code session in a fresh project directory.
- Give Claude Code a multi-step coding task and watch it create files autonomously.
- Test the generated code and iterate with Claude Code if needed.
Start a new Claude Code session in a fresh project directory
Every coding project deserves its own clean directory. You will create a new folder, initialize it as a Git repository, and launch Claude Code through the CCPG gateway in one go.
- Create the project directory, initialize Git, and launch Claude Code through CCPG by running these commands:
mkdir ~/weather-cli && cd ~/weather-cli && git init && ccpg --Copilot
What do these commands do?
- mkdir ~/weather-cli creates a new folder called weather-cli in your home directory.
- cd ~/weather-cli moves your terminal into that folder.
- git init initializes an empty Git repository. Claude Code requires a Git repo to track the files it creates.
- ccpg --Copilot launches Claude Code and routes all requests through your GitHub Copilot provider.
- You should see Claude Code start up in your terminal with its interactive prompt ready for input.
Claude Code not starting?
- Make sure the CCPG desktop app is still running. If you closed it, reopen it from your Applications folder.
- Check that your GitHub Copilot provider still shows a green connected status in the CCPG app.
- If you see a connection error, your Copilot OAuth token may have expired. Go to the Providers section in CCPG and click Connect again to re-authenticate.
Why isn't Claude Code launching through CCPG?
Now give Claude Code a multi-step task that will demonstrate its agentic capabilities. You will ask it to build a complete Python CLI tool.
- In the Claude Code prompt, type the following task and press Enter:
Create a Python CLI tool that fetches weather data from wttr.in for a given city and displays it formatted in the terminal. Include a requirements.txt and a README.md.
Why wttr.in?
wttr.in is a free, public weather service designed for terminal usage. It requires no API key and responds to simple HTTP requests. This makes it a perfect target for a quick CLI project that Claude Code can build end-to-end without needing you to set up external credentials.
Watch Claude Code work and review the History tab
This is where the agentic magic happens. Claude Code will plan the implementation, create files, write the Python code, generate a requirements.txt, and write a README.md. All without you typing another line of code.
- Watch the Claude Code session in your terminal. It will ask for permission to create files and run commands.
- When Claude Code asks to create a file or run a command, approve it by pressing y or Enter.
- Let it work through the full task. It may create multiple files in sequence.
What should I see?
Claude Code will show you each file it creates and each command it runs. You will see it write Python code for the weather fetcher, list dependencies in requirements.txt, and generate documentation in README.md. The exact implementation will vary since the AI generates it fresh each time.
The entire conversation involves multiple back-and-forth exchanges with the Copilot model behind the scenes. Each exchange is a separate API call routed through CCPG.
- Once Claude Code finishes, switch to the CCPG desktop app.
- Click the History tab.
- Review the list of requests. You will see each API call with the model used, token counts, and latency for each interaction.
What does the History tab show?
The History tab is your window into what CCPG is doing behind the scenes. Each row represents one API call from Claude Code to the Copilot model. You can see which model served the request, how many tokens were used (input and output), and how long each call took.
This is useful for understanding how much of your Copilot allowance a task uses and for diagnosing slow responses.
Test the result and iterate if needed
Claude Code created a Python script that fetches weather data. Now you will run it to confirm everything works.
- If Claude Code listed any dependencies in requirements.txt, install them first by running:
pip install -r requirements.txt
- Test the weather CLI tool by running:
python weather.py London
- You should see formatted weather data for London displayed in your terminal.
What should I see?
The output will show weather information for London fetched from wttr.in. The exact format depends on how Claude Code implemented the script. You might see temperature, conditions, wind speed, or a full forecast depending on its design choices.
Script not working?
If the script throws an error, you do not need to fix it manually. This is the power of the agentic workflow.
- Go back to the Claude Code session (it should still be running in the same terminal).
- Tell it what happened. For example, type: "I ran python weather.py London and got this error: [paste the error]". Claude Code will analyze the issue and fix it.
- Approve any file changes it proposes, then test again.
Help me fix the error from my weather CLI script running through CCPG.
- Once the script runs successfully, confirm the files exist by running:
ls
- You should see weather.py, requirements.txt, and README.md in the output.
You just built a working CLI tool without writing a single line of code yourself. Claude Code handled the entire implementation through your free Copilot models. Next up, the Secret Mission challenges you to add a fallback chain for even more reliability.
Secret mission
Set Up a Model Chain for Reliability
What happens when GitHub Copilot rate-limits you mid-session? In this bonus challenge, you'll configure a Model Chain in CCPG that automatically falls back to a free OpenRouter model when Copilot is unavailable. The result is a resilient, zero-cost coding setup that keeps working even when one provider goes down.
Clean Up Your Resources
Clean Up Your Resources
Decide whether to keep your resources running, pause them to come back later, or delete them entirely.
This project runs entirely locally and uses free provider subscriptions. There are no ongoing costs.
Resources you used:
- CCPG desktop app (installed at /Applications/CCPG.app).
- CCPG configuration and secrets (stored at ~/.config/claude-code-provider-gateway/).
- Test project directories (~/ccpg-test/ and ~/weather-cli/).
Keep everything running
No action needed. Choose this if you plan to keep using Claude Code with your free student models.
- Leave CCPG installed and use ccpg --Copilot or ccpg --free-coding-chain whenever you want Claude Code backed by your free providers.
- Your GitHub Copilot OAuth token and OpenRouter API key remain encrypted in secrets.enc.json and persist between sessions.
- The ~/ccpg-test/ and ~/weather-cli/ directories stay on your Desktop for future experimentation.
- Your free OpenRouter account remains active at openrouter.ai for use with free models.
Pause - I'll come back to this later
Shut down the CCPG process to free up memory. Your configuration persists for next time.
- Quit the CCPG desktop app by right-clicking its icon in the Dock and selecting Quit.
- The daemon stops and no background processes remain running.
- To resume later, open CCPG from your Applications folder and run ccpg --Copilot in your terminal.
Delete - I don't want to use this again
Remove all project resources and start fresh. This deletes CCPG, its configuration, stored tokens, and all test project files.
- Quit CCPG if it is still running.
- Drag CCPG from your Applications folder to the Trash.
- Remove the CCPG configuration directory (includes your encrypted tokens and all settings) by running:
rm -rf ~/.config/claude-code-provider-gateway/
- Remove the test project directories by running:
rm -rf ~/ccpg-test/ ~/weather-cli/
- Empty the Trash to finalize the deletion.
Nice Work!
Nice Work!
You just unlocked Claude Code's full agentic coding experience for free. Your local gateway is routing requests through your GitHub Copilot Student subscription, giving you file editing, terminal commands, and project-wide context without spending a cent.
You've learned how to:
- Install the CCPG desktop app and configure its Terminal Integration CLI to launch Claude Code through a local proxy.
- Authenticate your free GitHub Copilot Student subscription via OAuth Device Flow and route Claude Code's requests through Copilot models at zero cost.
- Build a working Python CLI tool using Claude Code's agentic features (file creation, command execution, iterative debugging) powered entirely by your student plan.
- (Secret Mission) Create a Model Chain with automatic fallback between Copilot and free OpenRouter models for maximum reliability.
Ready to quiz yourself?