/UnlimitedGPT-API

An API that wrap around ChatGPT website, compatible with OpenAI API endpoint

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

UnlimitedGPT API

License Twitter Follow

This is a fun project, aim to provides a chat API that is compatible with OpenAI API endpoint, based on UnlimitedGPT

Requirements

  • Python, pip installed
  • Chrome browser

Installation

1. Download the repository

git clone https://github.com/hieunc229/UnlimitedGPT-API

2. Install dependencies with the following command

# Windows
pip install UnlimitedGPT -U python-dotenv

# Linux/macOS
pip3 install UnlimitedGPT -U python-dotenv

3. Setup configurations

There are 4 options available

Note that your server will be available as http://host:port (or http://localhost:8080 if you leave it as default)

4. Start the server

Run the following command to start the server

# Windows
python main.py

# Linux/macOS
python3 main.py

It'll take sometimes to start and connect with ChatGPT website. Wait until you see Server started at http://host:port

Get your session_token

  1. Go to https://chat.openai.com/chat and open the developer tools by F12.
  2. Find the __Secure-next-auth.session-token cookie in Application > Storage > Cookies > https://chat.openai.com.
  3. Copy the value in the Cookie Value field.

image

Get your conversation_id

  1. Go to https://chat.openai.com/chat
  2. Click on any conversation, then take the part of the URL that comes after https://chat.openai.com/c/

Example: The conversation ID in the URL https://chat.openai.com/c/aa4f2349-8090-42a8-b8dc-0d116ce6b712 is aa4f2349-8090-42a8-b8dc-0d116ce6b712

Usage

When the server has started, a POST method is available.

Example request

curl http://localhost:8080 \
    -X POST
    -d '{ "messages": [{ "content": "Hello!" }] }'

Note that it'll only take the content from the last item of messages

with GasbyAI:

In case you want to try it on GasbyAI.com, complete setting up the server step above. Then:

  1. Choose Custom Service from Provider option
  2. Enter your server endpoint (http://localhost:8080 by default), leave API Key empty
  3. Click test to see if it's good

Disclaimer

This project is not affiliated with OpenAI in any way. Use at your own risk. I am not responsible for any damage caused by this project. Please read the OpenAI Terms of Service before using this project.

License

This project is licensed under the GPLv3 License - see the LICENSE file for details.

Gum Pixels