ChatGPT is a reverse engineering of OpenAI's ChatGPT API
Project description
ChatGPT
Reverse Engineered ChatGPT by OpenAI. Extensible for chatbots etc.
Announcement:
If you were using this prior to version 0.0.24, please update immediately. pip3 install revChatGPT --upgrade
. Fixes has been done to avoid bot blocking.
Disclaimer
This is not an official OpenAI product. This is a personal project and is not affiliated with OpenAI in any way. Don't sue me
This is a library and not intended for direct CLI use
The CLI functionality is for demo and testing only. Captcha is not supported (For unclean IP addresses)
CLI use
@rawandahmad698 has a much better CLI tool at
PyChatGPT supports captcha!
Urgent help needed
- Writing tests
- More verbose error handling
- Decrecate bs4 in favor of pure requests
Wiki is now open to all contributors
Features
- No moderation
- Programmable
Setup
Install
pip3 install revChatGPT --upgrade
Email and password authentication
{
"email": "<YOUR_EMAIL>",
"password": "<YOUR_PASSWORD>"
}
Save this in config.json
in current working directory
Token Authentication
Functional but deprecated. Use only if email/password not available
Go to https://chat.openai.com/chat and log in or sign up
- Open console with
F12
- Open
Application
tab > Cookies - Copy the value for
__Secure-next-auth.session-token
and paste it intoconfig.json.example
undersession_token
. You do not need to fill outAuthorization
- Save the modified file to
config.json
(In the current working directory)
Running
$ python3 -m revChatGPT
ChatGPT - A command-line interface to OpenAI's ChatGPT (https://chat.openai.com/chat)
Repo: github.com/acheong08/ChatGPT
Use --text if error with streaming
Type '!help' to show commands
Press enter twice to submit your question.
Logging in...
You:
!help
!help - Show this message
!reset - Forget the current conversation
!refresh - Refresh the session authentication
!rollback - Rollback the conversation by 1 message
!config - Show the current configuration
!exit - Exit the program
Refresh every so often in case the token expires.
Development:
pip3 install revChatGPT --upgrade
from revChatGPT.revChatGPT import Chatbot
import json
# Get your config in JSON
config = {
"email": "<YOUR_EMAIL>",
"password": "<YOUR_PASSWORD>"
}
chatbot = Chatbot(config, conversation_id=None)
chatbot.reset_chat() # Forgets conversation
chatbot.refresh_session() # Uses the session_token to get a new bearer token
resp = chatbot.get_chat_response(prompt, output="text") # Sends a request to the API and returns the response by OpenAI
resp['message'] # The message sent by the response
resp['conversation_id'] # The current conversation id
resp['parent_id'] # The ID of the response
# This returns a stream of text (live update)
resp = chatbot.get_chat_response(prompt, output="stream")
for line in resp: # You have to loop through the response stream
print(line['message']) # Same format as text return type
........
This can be imported to projects for bots and much more. You can have multiple independent conversations by keeping track of the conversation_id.
Awesome ChatGPT
If you have a cool project you want added to the list, open an issue.
Star History
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for revChatGPT-0.0.26.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c62c3427df5a8e2401d96a23cfe04f40a0f958afdbed13648499020b1181650f |
|
MD5 | c1fdf1e52985154baef3433d78134033 |
|
BLAKE2b-256 | 2e610086bd794503d1b37eaa87e8f4107433e18e6f4f2be2edb5c3353dc5c2c6 |