This is a maintained, modified and improved package of the original pyChatGPT package. The original package is in slow development and has many issues. This package is actively maintained and updated.
An unofficial Python wrapper for OpenAI's ChatGPT API
- Cloudflare's anti-bot protection bypass using
undetected_chromedriver
- Headless machines support
- Google Colab support
- Proxy support (only without basic auth)
This library is using only the
undetected_chromedriver
package to bypass Cloudflare's anti-bot protection.requests
module is not used due to the complexity of the protection. Please make sure you have Google Chrome / Chromium before using this wrapper.
pip install -U UnlimitedGPT
- Go to https://chat.openai.com/chat and open the developer tools by
F12
. - Find the
__Secure-next-auth.session-token
cookie inApplication
>Storage
>Cookies
>https://chat.openai.com
. - Copy the value in the
Cookie Value
field.
Currently, interactive mode is not supported in this package. But it will be added in the future.
from UnlimitedGPT import ChatGPT
session_token = 'abc123' # `__Secure-next-auth.session-token` cookie from https://chat.openai.com/chat
api = ChatGPT(session_token) # auth with session token
api = ChatGPT(session_token, conversation_id='some-random-uuid') # specify conversation id
api = ChatGPT(session_token, proxy='https://proxy.example.com:8080') # specify proxy
api = ChatGPT(session_token, chrome_args=['--window-size=1920,768']) # specify chrome args
api = ChatGPT(session_token, disable_moderation=True) # disable moderation
api = ChatGPT(session_token, verbose=True) # verbose mode (print debug messages)
message = api.send_message('Hello, world!')
print(message.response, message.conversation_id)
api.reset_conversation() # reset the conversation
# install chromium & X virtual framebuffer
sudo apt install chromium-browser xvfb
# start your script
python3 your_script.py
It is normal for the seession to be crashed when installing dependencies. Just ignore the error and run your script.
# install dependencies
!apt install chromium-browser xvfb
!pip install -U selenium_profiles UnlimitedGPT
# install chromedriver
from selenium_profiles.utils.installer import install_chromedriver
install_chromedriver()
# start your script as normal
!python3 -m UnlimitedGPT
This project is inspired by
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.
This project is licensed under the GPLv3 License - see the LICENSE file for details.