Skip to main content

ChatGPT-PyBot

En|Cn

Usage

ChatGPT_PyBot is a command-line robot developed in Python.

To use ChatGPT_PyBot, you need to have an openai account and use it on a machine that can log into the ChatGPT web version.

Install

ChatGPT_PyBot has been uploaded to Pypi, you can execute the following code in the terminal to install

pip install ChatGPT_PyBot --upgrade

Or you can install it via GitHub

pip install git+https://github.com/liuhuanshuo/ChatGPT_PyBot

Configuration (very important❗️)

After the installation is complete, you need to configure the login file. ChatGPT_PyBot provides two ways to verify login.

Use account password

Create a config.json file in the current directory with the following contents:

{
    "email":"<EMAIL>",
    "password": "<PASSWORD>"
}

Just fill in your account password.

Note: If you use an account password in an area not supported by openai, you need to configure the terminal to go through proxy traffic, otherwise it will not be verified.

You can use the following code to check your terminal ip address to ensure that the terminal ip address belongs to the available region

curl cip.cc

Use Cookie

If the above configuration scheme does not work, then you can use the second method, don't worry, it is not difficult at all.

First you need to log in to ChatGPT and press F12 or right-click - Check

click Application

Copy the Cookie Value as instructed below

Similarly, create a config.json file in the current directory with the following contents:

{
    "session_token":"Your Cookie Value"
}

CLI Usage

Open the terminal (command line), ensure that the current directory has the configured config.json file, execute chatgpt to enter the interactive dialog box

$ chatgpt

If you only need a single question, you can add your question directly after chatgpt

$ chatgpt your question

Python Usage

If you need to call ChatGPT in Python, you can do something like this

>>> from ChatGPT_PyBot import ChatBot
>>> config = {
    "session_token":"Your token"
    				or
    "email": "<YOUR_EMAIL>",
    "password": "<YOUR_PASSWORD>"
}
>>> chatbot = ChatBot(config, conversation_id=None)
>>> chatbot.get_chat_response('hello world')["message"]


'''
"Hello there! It's nice to meet you. Is there anything I can help you with today? I'm here to answer any questions you might have."
'''

TO DO

  • Better way to log in (Now this is a little cumbersome, but it's a little difficult to implement a new approach)
  • Refresh the session and reset the session

Acknowledgments

This project is inspired by ChatGPT - A reverse engineering of OpenAI

Disclaimer:

ChatGPT-PyBot is in no way associated with, endorsed by, or otherwise affiliated with OpenAI.

Release files for ChatGPT-PyBot 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ChatGPT-PyBot 0.4
File Size Uploaded
ChatGPT_PyBot-0.4.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ChatGPT-PyBot 0.4
File Interpreter ABI Platform
ChatGPT_PyBot-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 28.4 kB

Release files / ChatGPT_PyBot-0.4.tar.gz

Download URL ChatGPT_PyBot-0.4.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8eb2d3d845343ed9fce216dcfdd4d8380bd0e8b1078c07d5d4e0ff46773de98a
BLAKE2b-256 checksum
How to use checksums
e6ef805aebbffb6704bea3b75c9a4dd4cb4773feab5fac0be858f67b383c305b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Release files / ChatGPT_PyBot-0.4-py3-none-any.whl

Download URL ChatGPT_PyBot-0.4-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2f6c7f2a8d82c8d09842629e6fdf783fb0e619c32b3ba81fa4ff76d5bd790c3
BLAKE2b-256 checksum
How to use checksums
007e7e2409254f424fff71327f69bba97b5b747fad77bc0fe9215838890dd9e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.3

2 release files

0.2.1

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page