Skip to main content

ChatGPT is a reverse engineering of OpenAI's ChatGPT API

Project description

ChatGPT

Reverse Engineered ChatGPT by OpenAI. Extensible for chatbots etc.

Note: This is a proof of concept. The goal here is to be able to write bots using the API.

Features

  • Scientific knowledge
  • Has memory. It remembers the chat history and context
  • No moderation
  • Programmable

Setup

Install

pip3 install revChatGPT

Get your session token

Go to https://chat.openai.com/chat and log in or sign up

  1. Open console with F12
  2. Open Application tab > Cookies image
  3. Copy the value for __Secure-next-auth.session-token and paste it into config.json.example under session_token. You do not need to fill out Authorization image
  4. 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
    
Type '!help' to show commands
Press enter twice to submit your question.

You: !help


                !help - Show this message
                !reset - Forget the current conversation
                !refresh - Refresh the session authentication
                !exit - Exit the program

Make sure you run !refresh if you are only using the session_token.

Refresh every so often in case the token expires.

Arguments

You can pass the output through a processor using command line arguments.

Example:

Use python3 -m revChatGPT say to make a Mac speak the output

Development:

pip3 install revChatGPT

from revChatGPT.revChatGPT import Chatbot
import json

# Get your config in JSON
config = {
        "Authorization": "<Your Bearer Token Here>", # This is optional
        "session_token": "<Your Session Token here>" # This is used to refresh the authentication
}

chatbot = Chatbot(config, conversation_id=None)
chatbot.reset_chat() # Forgets conversation
refresh_session() # Uses the session_token to get a new bearer token
resp = get_chat_response(prompt) # 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 can be imported to projects for bots and much more. You can have multiple independent conversations by keeping track of the conversation_id.

Star History

Star History Chart

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

revChatGPT-0.0.13.tar.gz (11.0 kB view hashes)

Uploaded Source

Built Distribution

revChatGPT-0.0.13-py3-none-any.whl (11.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page