FakeGPT with History: A ChatGPT Chatbot with Proxy API and Summarization Features

POST ADS1

FakeGPT with History: A ChatGPT Chatbot with Proxy API and Summarization Features

FakeGPT is a ChatGPT chatbot that uses a proxy API, providing chat summarization features without the need for VPNs or consuming credits. This project is powered by zhile-io's Pandora project, enabling free ChatGPT API calls without any cost.

FakeGPT

Key Features

  • Zero-cost ChatGPT API calls
  • GPT-4 model integration
  • Advanced error handling for GPT-3.5 and GPT-4
  • Automatic switch to OpenAI's official API if Pandora is unavailable

Installation

To get started, install the required dependencies:

pip install openai
pip install jieba

How to Get the FakeGPT API

You can obtain the FakeGPT API in the following ways:

For light use, you can use my API key:

fk-dUTawMfIzwsfkEn_H3YBi1oQGXmlbIxkDwSktK0IykU

Gentlemen's agreement, please don't use it too much.

Pandora Service Check

Since Pandora's service can sometimes be unstable, a feature has been added to check its status. If the service fails, the system will automatically switch to OpenAI's official API.

Code Implementation

Here's a snippet from the code where Pandora's API is checked and switched:

if config.model == "gpt-4":
    try:
        print("Attempting to send test text to Pandora...")
        fake_api("hi", 2500, True, 1, config.if_pandora, config.model)
    except:
        print("GPT-4 connection failed!")
        config.model = "gpt-3.5-turbo"
        try:
            print("Attempting to send test text to Pandora...")
            fake_api("hi", 2500, True, 1, config.if_pandora, config.model)
        except:
            print("Pandora connection failed!")
        config.if_pandora = False
            

Project Structure

Here is the structure of the FakeGPT project:

  1. Define an AI calling function in fake_api.py
  2. Define a token-counting function in token_count.py
  3. Allow the user to input text and add it to a history list in main.py
  4. Call the AI to generate answers and append the response to the history list
  5. Use token_count.py to calculate the token usage of the history list
  6. If token count exceeds 2500, call the AI to summarize the conversation
  7. Repeat steps 3-6 until the conversation ends

Update: Token Count No Longer Needed

Thanks to the updates from zhile-io's API, it now supports larger token limits. You no longer need to worry about token usage. For most applications, you can safely remove token counting. However, it's recommended to keep it for calls to OpenAI's official API.

Configuration File

The configuration file looks something like this:

if_pandora = True  # Whether to attempt using Pandora proxy
long_text = True  # Enable summarization
max_token = 500  # Token limit for summarization
smaller_text = 50  # Target word count for summary
openai_api = "YOUR_OPENAI_REAL_KEY"  # OpenAI API key
pandora_api = "YOUR_PANDORA_FAKE_KEY"  # Pandora fake key
base_url = "https://ai.fakeopen.com/v1/"  # Pandora proxy URL
            

All these configurations can be modified in the configuration file.

Looking for a UI Developer

We are looking for a UI expert to improve the user interface of the project. If you're interested, feel free to reach out.

Project Status

The project is steadily progressing with an encouraging outlook. Stay tuned for further updates!

Star History Chart

Project Star History Chart

POST ADS 2

Previous Post Next Post