Note: This article was translated with the assistance of AI. I wrote the original in Chinese. If you can read Chinese, you are welcome to read the original Chinese version for the most authentic and unfiltered expression.

Summary: Use GitHub Copilot to access the GPT-4 model for free

Note: Multiple GitHub Copilot accounts have already been banned for using this method, so it’s no longer recommended.

Prerequisites

What you’ll need:

GitHub Copilot

If you’re a college student, you can take advantage of GitHub’s education benefits — after verification, you’ll get access to GitHub Copilot. If you’re not a student and don’t want to pay the full price, you can search online for ways to get it for free or at a discounted rate.

Server (Optional)

aaamoon/copilot-gpt4-service: Convert Github Copilot to ChatGPT, free to use the GPT-4 model
This project leverages Copilot to call GPT models, enabling free access to GPT-4.

The repo author has deployed a public service, but since so many people use it, your Copilot could get banned by GitHub due to IP-related issues. Self-hosting the service is a safer option.

Getting Your Copilot Token

aaamoon/copilot-gpt4-service: Convert Github Copilot to ChatGPT, free to use the GPT-4 model

The project documentation covers several ways to obtain a Copilot token. If you want to skip the hassle, you can grab one directly from the site below — just keep in mind that since it’s not self-hosted, there’s some risk involved.
Get Copilot Token (cocopilot.org)

If you don’t want to self-host copilot-gpt4-service and ChatGPT-Next-Web, you can use the repo author’s NextChat (gpt4copilot.tech) directly. Just fill in the target URL with:

1
https://gpt4copilot.tech/

For the API key, directly use the Copilot Token you obtained earlier.
It seems this is no longer working — self-hosting is the only option now.

Setting Up copilot-gpt4-service

Build it with Docker:

1
2
3
4
5
docker run -d \
--name copilot-gpt4-service \
--restart always \
-p 8080:8080 \
aaamoon/copilot-gpt4-service:latest

If you need to specify a port, just change the 8080 before the colon to whatever you want — no other changes needed.
Once this step is done, you can already use HTTP-compatible clients to make calls, like Chatbox - Your AI assistant for work and study, free official download (chatboxai.app)

Setting Up ChatGPT-Next-Web

Pull the image:

1
docker pull yidadaa/chatgpt-next-web

If copilot-gpt4-service is deployed on the same server, you can set the BASE_URL parameter to http://copilot-gpt4-service:8080/

1
2
3
4
5
docker run -d -p 3000:3000 \
-e CODE=<your_password> \
-e BASE_URL=http://copilot-gpt4-service:8080/ \
-e OPENAI_API_KEY=<your_copilot_token> \
yidadaa/chatgpt-next-web

Check the container info:

1
docker ps

Then add both containers to the same network:

1
2
3
4
5
# Create a new network
docker network create my_network
# Add containers to this network
docker network connect my_network copilot-gpt4-service
docker network connect my_network <nextchat_container_id>

Usage

Visit <ip>:3000 to start using it. On first login, you’ll need to enter the password to access the configured API key, then switch the model to GPT-4 in the model selector.

Reference

ChatGPTNextWeb/ChatGPT-Next-Web: A cross-platform ChatGPT/Gemini UI (Web / PWA / Linux / Win / MacOS). Have your own cross-platform ChatGPT/Gemini app with one click. (github.com)
aaamoon/copilot-gpt4-service: Convert Github Copilot to ChatGPT, free to use the GPT-4 model