LyubomirT / Free-GPT4-WEB-API-fixing

FreeGPT4-WEB-API is a python server that allows you to have a self-hosted GPT-4 Unlimited and Free WEB API, via the latest Bing's AI (and much more).

Home Page:https://api.freegpt4.ddns.net/?text=Your Request Here

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker Image CI GPT4-API-PyApp

Free-GPT4-WEB-API

FreeGPT4-WEB-API is a python server that allows you to have a self-hosted GPT-4 Unlimited and Free WEB API, via the latest Bing's AI.

Requirements

  • Python 3
  • Flask
  • g4f (from here).
  • aiohttp
  • auth
  • Werkzeug

Manual Installation

To install the required libraries, you can use the following command:

pip3 install -r requirements.txt

Usage

To run the server, use the following command:

python3 FreeGPT4_Server.py [-h] 
[--remove-sources] [--enable-gui] 
[--cookie-file COOKIE_FILE] [--file-input] 
[--port PORT] [--model MODEL][--provider PROVIDER] 
[--keyword KEYWORD]

Options:

-h, --help show this help message and exit

--remove-sources needed if you want to remove the sources from the response

--enable-gui needed if you want to use a graphical interface for settings. If you're going to enable it, a password set is needed in order to protect the settings web page.

--cookie-file COOKIE_FILE needed if you want to use a cookie file

--file-input needed if you want to add the file as input support

--port PORT needed if you want to change the port (default: 5500)

--model MODEL needed if you want to change the model (default: gpt_4)

--provider PROVIDER needed if you want to change the provider (default: Bing)

--keyword KEYWORD needed if you want to add the keyword support

If you want to use it with curl (credits to @ayoubelmhamdi):

fileTMP="$1"
curl -s -F file=@"${fileTMP}" http://127.0.0.1:5500/

GUI Preview:

Docker Installation

It's possible to install the docker image of this API by running this command:

docker container run -v /path/to/your/cookies.json:/cookies.json:ro -p YOUR_PORT:5500 d0ckmg/free-gpt4-web-api

just omit -v /path/to/your/cookies.json:/cookies.json:ro for using it without cookies

or alternatively, you can use a docker-compose file:

docker-compose.yml

version: "3.9"
services:
  api:
    image: "d0ckmg/free-gpt4-web-api:latest"
    ports:
      - "YOUR_PORT:5500"
    #volumes:
    #  - /path/to/your/cookies.json:/cookies.json:ro

This will start the server and allow you to access the GPT-4 WEB API.

Once the server is running, you can access the API by sending HTTP requests to the server's address. The data for the requests should be sent via hotlinking and the response will be returned as plain text.

For example, to generate text using the API, you can send a GET request with the text parameter set to the text you want to use as a prompt and the (optional) style parameter set to the style you want to use. The default style is "balanced" and is recommended since it is faster. The generated text will be returned in the response as plain text.

To stop the server, you can press CTRL+C in the terminal where the server is running. (credits to @git-malik)

Siri Integration

You can implement the power of GPT4 in Siri by using the GPTMode Apple Shortcut. Then you can use it just by saying "GPT Mode" to Siri and then ask your question when prompted to do so.

Configuration

The server can be configured by editing the FreeGPT4_Server.py file. You can change the server's port, host, and other settings.

Main Libraries

FreeGPT4-WEB-API uses the Flask and GPT4Free libraries. Flask is a micro web framework for Python that allows you to easily create web applications. GPT4Free is a library that provides an interface to the Bing's GPT-4, credits to @xtekky's GPT4Free.

Notes

  • The demo server may be overloaded and not always work as expected. (at the moment it should be fine)
  • Any kind of contribution to the repository is welcome.

Todo ✔️

  • Update Demo Server
  • Fix Repository
  • Update Docker Image
  • Add A.I. provider choice
  • Add GUI

About

FreeGPT4-WEB-API is a python server that allows you to have a self-hosted GPT-4 Unlimited and Free WEB API, via the latest Bing's AI (and much more).

https://api.freegpt4.ddns.net/?text=Your Request Here

License:GNU General Public License v3.0


Languages

Language:Python 45.8%Language:HTML 44.7%Language:JavaScript 4.7%Language:CSS 3.4%Language:Dockerfile 1.5%