Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Cost-Effective GPT-4 Access Using GitHub Copilot CLI Tokens

Tech 1

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 logout followed by gh auth login

Token Generation (Alternative)

To create a fine-grained Personal Access Token (PAT):

  1. Go to GitHub Settings → Developer settings → Personal access tokens → Fine-grained tokens
  2. Click "Generate new token" and follow the prompts
  3. Re-run the token retrieval script after generating the PAT
  4. Complete device authorization at github.com/login/device using the 8-digit code provided

Step 4: Install and Configure ChatGPT-Next-Web

  1. Clone and instal ChatGPT-Next-Web from github.com/ChatGPTNextWeb/ChatGPT-Next-Web
  2. 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)

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.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.