Total Pageviews

Wednesday, 24 January 2024

GPT4free ,免费的GPT4



 项目地址: https://github.com/xtekky/gpt4free

据外媒 TechCrunch 介绍,GPT4free 的项目作者 xtekky 是一位计算机科学专业的学生:“逆向工程是我一直非常喜欢的一个领域,这对我来说就像一个挑战。”

最初,xtekky 创建 GPT4free 的初衷只是为了“好玩”,不料项目意外爆火,他也因此将“格局”打开:“刚开始创建它是为了好玩,但现在是为了给没有办法使用 GPT-4/3.5 的人提供一个替代方案。”

    “你是否曾经遇到过一些惊人的项目,却因为没有 OpenAI 的 API 密钥而无法使用?
    我们已经帮你解决了!这个资源库提供了逆向工程的第三方 API,这些 API 来自各个网站。你可以简单地下载这个资源库,并使用可用的模块,这些模块的设计就像 OpenAI 的官方包一样。现在就为你的项目释放ChatGPT 的潜力吧!”

从这段介绍就可以看出,实质上 GPT4free 所谓的逆向工程,并不是为了绕过 OpenAI 的付费墙,而是“欺骗” OpenAI API——使其认为它正在接收来自拥有付费 OpenAI 账户的网站请求。

所以某种程度上来说,被 xtekky 逆向工程的这些网站就像个“冤大头”:GPT4free 声称可“免费使用 GPT4/3.5” ,收获许多开发者的喜爱,背后成本则由这些网站来承担。

据 GPT4free 项目介绍,目前 xtekky 已逆向工程的网站名单如下,其中还包括微软 Bing 和谷歌 Bard.

--------------------------

The official gpt4free repository | various collection of powerful language models

discord.gg/XfybzPXPH5

Please provide feedback so this project can be improved, it would be much appreciated
form: https://forms.gle/FeWV9RLEedfdkmFN6

248433934-7886223b-c1d1-4260-82aa-da5741f303bb Written by @xtekky & maintained by @hlohaus

By using this repository or any code related to it, you agree to the legal notice. The author is not responsible for any copies, forks, re-uploads made by other users, or anything else related to GPT4Free. This is the author's only account and repository. To prevent impersonation or irresponsible actions, please comply with the GNU GPL license this Repository uses.

Note

Lastet version: PyPI version Docker version
Stats: Downloads Downloads

pip install -U g4f
docker pull hlohaus789/g4f

To do

As per the survey, here is a list of improvements to come

  • Improve Documentation (on g4f.mintlify.app) & Do video tutorials
  • Improve the provider status list & updates
  • Tutorials on how to reverse sites to write your own wrapper (PoC only ofc)
  • Improve the Bing wrapper. (might write a new wrapper in golang as it is very fast)
  • Write a standard provider performance test to improve the stability
  • update the repository to include the new openai library syntax (ex: Openai() class)
  • Potential support and development of local models
  • improve compatibility and error handling

🆕 What's New

📚 Table of Contents

🛠️ Getting Started

Docker container

Quick start:
  1. Download and install Docker
  2. Pull latest image and run the container:
docker pull hlohaus789/g4f
docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" hlohaus789/g4f:latest
  1. Open the included client on: http://localhost:8080/chat/ or set the api base in your client to: http://localhost:1337/v1
  2. (Optional) If you need to log in to a provider, you can view the desktop from the container here: http://localhost:7900/?autoconnect=1&resize=scale&password=secret.

Use python package

Prerequisites:
  1. Download and install Python (Version 3.10+ is recommended).
  2. Install Google Chrome for providers with webdriver
Install using pypi:
pip install -U g4f
or:
  1. Clone the GitHub repository:
git clone https://github.com/xtekky/gpt4free.git
  1. Navigate to the project directory:
cd gpt4free
  1. (Recommended) Create a Python virtual environment: You can follow the Python official documentation for virtual environments.
python3 -m venv venv
  • Activate the virtual environment:
    • On Windows:
    .\venv\Scripts\activate
    
    • On macOS and Linux:
    source venv/bin/activate
    
    1. Install the required Python packages from requirements.txt:
    pip install -r requirements.txt
    
    1. Create a test.py file in the root folder and start using the repo, further Instructions are below
    import g4f
    ...

    Docker for Developers

    If you have Docker installed, you can easily set up and run the project without manually installing dependencies.

    1. First, ensure you have both Docker and Docker Compose installed.

    2. Clone the GitHub repo:

    git clone https://github.com/xtekky/gpt4free.git
    1. Navigate to the project directory:
    cd gpt4free
    1. Build the Docker image:
    docker pull selenium/node-chrome
    docker-compose build
    1. Start the service using Docker Compose:
    docker-compose up

    Your server will now be running at http://localhost:1337. You can interact with the API or run your tests as you would normally.

    To stop the Docker containers, simply run:

    docker-compose down

    Note

    When using Docker, any changes you make to your local files will be reflected in the Docker container thanks to the volume mapping in the docker-compose.yml file. If you add or remove dependencies, however, you'll need to rebuild the Docker image using docker-compose build.

    from https://github.com/xtekky/gpt4free

     

     

    No comments:

    Post a Comment