# Lightweight version of ChatGPT
Uses API by [Pawan](https://github.com/PawanOsman/)
## Disclaimer
This is not open source. [PawanOsman](https://github.com/PawanOsman/) can see all your requests and your session token.
# Install
`pip3 install ChatGPT-lite`
# Setup:
## Getting session token
Check https://github.com/acheong08/ChatGPT/wiki/Setup
# Usage
## Command line
```
usage: ChatGPT-lite [-h] [--session_token SESSION_TOKEN] [--bypass_node BYPASS_NODE (optional)] [--async_mode]
```
## Example development:
```python
import argparse
import sys
import asyncio
from ChatGPT_lite.ChatGPT import Chatbot
async def async_main(args):
if args.session_token is None:
print("Please provide a session token")
sys.exit(1)
chat = Chatbot(args.session_token, args.bypass_node)
await asyncio.gather(chat.wait_for_ready())
while True:
try:
prompt = input("You: ")
if prompt == "!exit":
break
response = await chat.ask(prompt)
print(f"\nBot: {response['answer']}\n")
except KeyboardInterrupt:
break
# Close sockets
chat.close()
# exit
sys.exit(0)
def sync_main(args):
chat = Chatbot(args.session_token, args.bypass_node)
# Create loop
loop = asyncio.new_event_loop()
# Set
asyncio.set_event_loop(loop)
# Run
loop.run_until_complete(chat.wait_for_ready())
while True:
try:
prompt = input("You: ")
if prompt == "!exit":
break
response = loop.run_until_complete(chat.ask(prompt))
print(f"\nBot: {response['answer']}\n")
except KeyboardInterrupt:
break
# Close sockets
chat.close()
# stop asyncio event loop
loop.stop()
# exit
sys.exit(0)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--session_token', type=str, default=None)
parser.add_argument('--bypass_node', type=str,
default="https://gpt.pawan.krd")
parser.add_argument('--async_mode', action='store_true')
args = parser.parse_args()
if args.session_token is None:
print("Please provide a session token")
sys.exit(1)
print("Starting. Please wait...")
if args.async_mode:
asyncio.run(async_main(args))
else:
sync_main(args)
if __name__ == "__main__":
main()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/acheong08/ChatGPT-lite",
"name": "ChatGPT-lite",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Antonio Cheong",
"author_email": "acheong@student.dalat.org",
"download_url": "https://files.pythonhosted.org/packages/33/86/e97dafede302b3397a6108e95c518b8988a656bcc0a1c92d660867b12d6e/ChatGPT_lite-0.0.5.tar.gz",
"platform": null,
"description": "# Lightweight version of ChatGPT\nUses API by [Pawan](https://github.com/PawanOsman/)\n\n## Disclaimer\nThis is not open source. [PawanOsman](https://github.com/PawanOsman/) can see all your requests and your session token.\n\n# Install\n`pip3 install ChatGPT-lite`\n\n# Setup:\n\n## Getting session token\nCheck https://github.com/acheong08/ChatGPT/wiki/Setup\n\n# Usage\n\n## Command line\n\n```\nusage: ChatGPT-lite [-h] [--session_token SESSION_TOKEN] [--bypass_node BYPASS_NODE (optional)] [--async_mode]\n```\n\n## Example development:\n```python\nimport argparse\nimport sys\nimport asyncio\nfrom ChatGPT_lite.ChatGPT import Chatbot\n\n\nasync def async_main(args):\n if args.session_token is None:\n print(\"Please provide a session token\")\n sys.exit(1)\n\n chat = Chatbot(args.session_token, args.bypass_node)\n await asyncio.gather(chat.wait_for_ready())\n\n while True:\n try:\n prompt = input(\"You: \")\n if prompt == \"!exit\":\n break\n response = await chat.ask(prompt)\n print(f\"\\nBot: {response['answer']}\\n\")\n except KeyboardInterrupt:\n break\n # Close sockets\n chat.close()\n # exit\n sys.exit(0)\n\n\ndef sync_main(args):\n chat = Chatbot(args.session_token, args.bypass_node)\n # Create loop\n loop = asyncio.new_event_loop()\n # Set\n asyncio.set_event_loop(loop)\n # Run\n loop.run_until_complete(chat.wait_for_ready())\n while True:\n try:\n prompt = input(\"You: \")\n if prompt == \"!exit\":\n break\n response = loop.run_until_complete(chat.ask(prompt))\n print(f\"\\nBot: {response['answer']}\\n\")\n except KeyboardInterrupt:\n break\n # Close sockets\n chat.close()\n # stop asyncio event loop\n loop.stop()\n # exit\n sys.exit(0)\n\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument('--session_token', type=str, default=None)\n parser.add_argument('--bypass_node', type=str,\n default=\"https://gpt.pawan.krd\")\n parser.add_argument('--async_mode', action='store_true')\n args = parser.parse_args()\n\n if args.session_token is None:\n print(\"Please provide a session token\")\n sys.exit(1)\n\n print(\"Starting. Please wait...\")\n if args.async_mode:\n asyncio.run(async_main(args))\n else:\n sync_main(args)\n\n\nif __name__ == \"__main__\":\n main()\n```\n",
"bugtrack_url": null,
"license": "GNU General Public License v2.0",
"summary": "ChatGPT is a reverse engineering of OpenAI's ChatGPT API",
"version": "0.0.5",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "93d7e3448c785fecfb82ead7d9ecb380ba7751cb46afbac50b05b3db02bcb9e9",
"md5": "d16fcf76f9168858e666f60b734be6e1",
"sha256": "f1941929bfd8b7bf051f48d6247c89513a0e88749d8af344231b0191c77e432a"
},
"downloads": -1,
"filename": "ChatGPT_lite-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d16fcf76f9168858e666f60b734be6e1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5752,
"upload_time": "2023-01-08T11:49:02",
"upload_time_iso_8601": "2023-01-08T11:49:02.080990Z",
"url": "https://files.pythonhosted.org/packages/93/d7/e3448c785fecfb82ead7d9ecb380ba7751cb46afbac50b05b3db02bcb9e9/ChatGPT_lite-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3386e97dafede302b3397a6108e95c518b8988a656bcc0a1c92d660867b12d6e",
"md5": "c696758d281019697b7a8e461105ece4",
"sha256": "9ca1701107cc1ef196a280e20d3e1852c02c79055ebae48143690b8084759e84"
},
"downloads": -1,
"filename": "ChatGPT_lite-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "c696758d281019697b7a8e461105ece4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4680,
"upload_time": "2023-01-08T11:49:03",
"upload_time_iso_8601": "2023-01-08T11:49:03.655600Z",
"url": "https://files.pythonhosted.org/packages/33/86/e97dafede302b3397a6108e95c518b8988a656bcc0a1c92d660867b12d6e/ChatGPT_lite-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-08 11:49:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "acheong08",
"github_project": "ChatGPT-lite",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "chatgpt-lite"
}