Cost-Effective GPT-4 Access Using GitHub Copilot CLI Tokens
Cost Disclaimer
This method leverages your existing GitHub Copilot subscription (required monthly expense) to access GPT-4 without paying the additional $20/month GPT-4 subscription fee. Its not zero-cost but eliminates extra monthly charges for GPT-4.
Step 1: Clone the Service Repository
The core tool used here is available at github.com/aaamoon/copilot-gpt4-service. Clone this repository to your local machine:
git clone https://github.com/aaamoon/copilot-gpt4-service.git
cd copilot-gpt4-service
Step 2: Install Go Runtime
Download and install the Go programming language from go.dev/dl (required to run the service).
Step 3: Retrieve Copilot CLI Token
Two methods are available to obtain your Copilot Plugin Token. The GitHub CLI method is recommended:
Method 1: GitHub CLI Authorization (Recommended)
# Install GitHub CLI if not already installed
brew install gh
# Authenticate your GitHub account
gh auth login
# Run the token retrieval script
bash -c "$(curl -fsSL https://raw.githubusercontent.com/aaamoon/copilot-gpt4-service/master/shells/get_copilot_token.sh)"
Troubleshooting: Authorization Failures
- Ensure you use an account with an active Copilot subscription
- Verify GitHub CLI authentication status:
gh auth status - If needed, re-authenticate with
gh auth logoutfollowed bygh auth login
Token Generation (Alternative)
To create a fine-grained Personal Access Token (PAT):
- Go to GitHub Settings → Developer settings → Personal access tokens → Fine-grained tokens
- Click "Generate new token" and follow the prompts
- Re-run the token retrieval script after generating the PAT
- Complete device authorization at
github.com/login/deviceusing the 8-digit code provided
Step 4: Install and Configure ChatGPT-Next-Web
- Clone and instal ChatGPT-Next-Web from
github.com/ChatGPTNextWeb/ChatGPT-Next-Web - Configure the following parameters:
- API Endpoint:
http://127.0.0.1:8080(default for the running service) - API Key: Use the Copilot CLI token retrieved in Step 3
- Model: Select
gpt-4(default is GPT-3.5)
- API Endpoint:
Step 5: Launch copilot-gpt4-service
Start the proxy service from the repository directory:
go run .
This step is the only recurring one—once the initial setup is complete, you only need to run this command to use the service.
Tokens expire approximately every 90 days. Re-authorize using the GitHub CLI method to obtain a new token when needed.
Step 6: Verify the Setup
Test the connection by asking complex questions that GPT-4 is more likely to answer correctly than GPT-3.5.
AI Learning Path
Here’s a structured learning roadmap for mastering large language models (LLMs):
Phase 1 (10 Days): Fundamentals
- Understand LLM capabilities and core concepts
- Learn prompt engineering basics (including思维链/思维树 techniques)
- Explore LLM application architectures (business and technical)
- Implement simple LLM integrations with code
Phase 2 (30 Days): Advanced Applications
- Build Retrieval-Augmented Generation (RAG) systems (e.g., ChatPDF)
- Learn about vector databases and embeddings
- Implement RAG-Fusion and hybrid retrieval
- Deploy local vector models
- Build an agent-based chatbot
Phase 3 (30 Days): Model Training
- Understand neural networks and training fundamentals
- Learn about pre-training, fine-tuning, and lightweight tuning
- Implement a simple neural network from scratch
- Train and fine-tune custom LLMs
Phase 4 (20 Days): Deployment and Business
- Explore hardware and cloud deployment options
- Compare performance and costs of global LLMs
- Deploy open-source LLMs locally and on cloud platforms (e.g., vLLM)
- Understand compliance (content safety, algorithm备案)
- Identify LLM project or startup opportunities
Completing 60-70% of this curriculum will equip you with foundational LLM skills. For more comprehensive resources, including思维导图、books, video courses, and实战projects, you can scan the CSDN QR code in the original article for free downloads.