{"id":16317034,"url":"https://github.com/simatwa/webchatgpt","last_synced_at":"2025-04-09T20:09:27.133Z","repository":{"id":212827404,"uuid":"731070766","full_name":"Simatwa/WebChatGPT","owner":"Simatwa","description":"  Python SDK/API for ChatGPT Web-Version","archived":false,"fork":false,"pushed_at":"2024-04-18T12:22:02.000Z","size":3566,"stargazers_count":104,"open_issues_count":5,"forks_count":23,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T20:09:21.456Z","etag":null,"topics":["chatgpt","chatgpt-api","chatgpt-api-sdk","chatgpt-sdk","webchatgpt"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Simatwa.png","metadata":{"files":{"readme":"docs/README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-13T09:45:44.000Z","updated_at":"2025-03-31T06:55:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a707dff-3b76-49cb-9a60-cd359999633e","html_url":"https://github.com/Simatwa/WebChatGPT","commit_stats":{"total_commits":124,"total_committers":2,"mean_commits":62.0,"dds":"0.016129032258064502","last_synced_commit":"62aafcf4a22ce55564b02865ef08a8ddb9e1cf40"},"previous_names":["simatwa/webchatgpt"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simatwa%2FWebChatGPT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simatwa%2FWebChatGPT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simatwa%2FWebChatGPT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simatwa%2FWebChatGPT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Simatwa","download_url":"https://codeload.github.com/Simatwa/WebChatGPT/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103871,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","chatgpt-api","chatgpt-api-sdk","chatgpt-sdk","webchatgpt"],"created_at":"2024-10-10T22:06:24.968Z","updated_at":"2025-04-09T20:09:27.109Z","avatar_url":"https://github.com/Simatwa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e WebChatGPT \u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/Simatwa/WebChatGPT/actions/workflows/python-test.yml\"\u003e\u003cimg src=\"https://github.com/Simatwa/WebChatGPT/actions/workflows/python-test.yml/badge.svg\" alt=\"Python Test\"/\u003e\u003c/a\u003e\n\u003ca href=\"LICENSE\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/static/v1?logo=GPL\u0026color=Blue\u0026message=GNUv3\u0026label=License\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/webchatgpt\"\u003e\u003cimg alt=\"PyPi\" src=\"https://img.shields.io/pypi/v/webchatgpt?color=green\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/psf/black\"\u003e\u003cimg alt=\"Black\" src=\"https://img.shields.io/static/v1?logo=Black\u0026label=Code-style\u0026message=Black\"/\u003e\u003c/a\u003e\n\u003ca href=\"#\"\u003e\u003cimg alt=\"Passing\" src=\"https://img.shields.io/static/v1?logo=Docs\u0026label=Docs\u0026message=Passing\u0026color=green\"/\u003e\u003c/a\u003e\n\u003ca href=\"#\"\u003e\u003cimg alt=\"coverage\" src=\"https://img.shields.io/static/v1?logo=Coverage\u0026label=Coverage\u0026message=90%\u0026color=yellowgreen\"/\u003e\u003c/a\u003e\n\u003ca href=\"#\" alt=\"progress\"\u003e\u003cimg alt=\"Progress\" src=\"https://img.shields.io/static/v1?logo=Progress\u0026label=Progress\u0026message=95%\u0026color=green\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://pepy.tech/project/webchatgpt\"\u003e\u003cimg src=\"https://static.pepy.tech/personalized-badge/webchatgpt?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=green\u0026left_text=Downloads\" alt=\"Downloads\"\u003e\u003c/a\u003e\n\u003c!--\u003ca href=\"https://github.com/Simatwa/WebChatGPT/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/downloads/Simatwa/WebChatGPT/total?label=Downloads\u0026color=success\" alt=\"Downloads\"\u003e\u003c/img\u003e\u003c/a\u003e --\u003e\n\u003ca href=\"https://github.com/Simatwa/WebChatGPT/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/Simatwa/WebChatGPT?color=success\u0026label=Release\u0026logo=github\" alt=\"Latest release\"\u003e\u003c/img\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/Simatwa/WebChatGPT/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/release-date/Simatwa/WebChatGPT?label=Release date\u0026logo=github\" alt=\"release date\"\u003e\u003c/img\u003e\u003c/a\u003e\n\u003ca href=\"https://hits.seeyoufarm.com\"\u003e\u003cimg src=\"https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com/Simatwa/WebChatGPT\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://wakatime.com/badge/github/Simatwa/WebChatGPT\"\u003e\u003cimg src=\"https://wakatime.com/badge/github/Simatwa/WebChatGPT.svg\" alt=\"wakatime\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"600\" height=\"auto\" src=\"https://github.com/Simatwa/WebChatGPT/blob/main/assets/demo.gif?raw=true\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://en.wikipedia.org/wiki/Reverse_engineering\"\u003eReverse Engineering\u003c/a\u003e of ChatGPT in Python.\n\u003c/p\u003e \n\nUnlike the [official Openai library](https://github.com/openai/openai-python), this library makes REST-API calls to [ChatGPT](https://chat.openai.com) via the **browser** endpoints. *No API-KEY required*\n\n```python\nfrom WebChatGPT import ChatGPT\nbot = ChatGPT(\n    \"\u003cpath-to-openai-cookies.json\u003e\"\n)\nresponse = bot.chat('\u003cYour prompt\u003e')\n\nprint(response)\n#Ouput : What can I do for you today?\n```\n\n## Prerequisites\n\n- [x] Python\u003e=3.10 Installed\n- [x] Chrome or Firefox browser\n- [x] [export-cookie-for-puppeteer](https://github.com/ktty1220/export-cookie-for-puppeteer) extension installed.\n\n## Installation \u0026 usage\n\n### Installation\n\nEither of the following ways will get you ready :\n\n1. From pypi:\n  \n  ```\n  pip install --upgrade webchatgpt\n  ```\n\n2. From source\n\n```\npip install git+https://github.com/Simatwa/WebChatGPT.git\n```\n\n## Usage\n\nThe script utilizes [HTTP Cookies](https://en.wikipedia.org/wiki/HTTP_cookie) and [OAuth](https://en.wikipedia.org/wiki/OAuth) to justify the REST-API requests at [Openai](https://openai.com). \n\nIn order to do that, we will use the [export-cookie-for-puppeteer](https://github.com/ktty1220/export-cookie-for-puppeteer) extension to extract the cookies which will later on used to retrieve the OAuth.\n\n### Procedure\n\n1. Login to https://chat.openai.com\n2. Upon successfull login, use **Export cookie JSON File Puppeteer** to export cookies. If you haven't installed the extension, here are  the quick installation links for you. \n - [Google Chrome](https://chrome.google.com/webstore/detail/nmckokihipjgplolmcmjakknndddifde)\n- [Firefox](https://addons.mozilla.org/ja/firefox/addon/%E3%82%AF%E3%83%83%E3%82%AD%E3%83%BCjson%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%87%BA%E5%8A%9B-for-puppeteer/)\n\nBy doing that you are good to go.\n\n\n- Converse Interactively:\n\n```\n$ webchatgpt interactive -C \u003cpath-to-openai-cookie-file.json\u003e \"\u003cyour startup prompt though not a must\u003e\"\n```\n\n- Have a quick response\n\n```\n$ webchatgpt generate -C \u003cpath-to-openai-cookie-file.json\u003e \"\u003cyour prompt here\u003e\"\n```\n\n- Since `generate` is the default option so something like this will this workout. `$ webchatgpt -C \u003cpath-to-openai-cookie-file.json\u003e \"\u003cyour prompt\u003e\"`\n\nAlternatives to `-C \u003cpath-to-openai-cookie-file.json\u003e` :\n\nOn the current directory of your **terminal**,create a [`.env`](https://github.com/Simatwa/WebChatGPT/blob/main/env) file and save path to the cookie-file in the format :\n\n```\nopenai_cookie_file=\u003cpath-to-cookie-file\u003e\n```\n\nOr simply make path to the cookie file an environment variable identified by `openai_cookie_file`. By that you'll just have to use less commands to get your work done e.g `webchatgpt \"Nmap command for scanning SMB vulnerabilty on 192.168.0.1\" -q | grep '$' \u003e scan_smb.sh`\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\n\nFor more info; append `--help` to the command\n\n\u003c/summary\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\n\n`$ webchatgpt --help`\n\n\u003c/summary\u003e\n\n\n```\nUsage: webchatgpt [OPTIONS] COMMAND [ARGS]...\n\n  Reverse Engineered ChatGPT Web-version\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  generate     Generate a quick response with ChatGPT\n  interactive  Chat with ChatGPT interactively\n```\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\n\n` $ webchatgpt generate --help`\n\n\u003c/summary\u003e\n\n\n```\nUsage: webchatgpt generate [OPTIONS]\n\n  Generate a quick response with ChatGPT\n\nOptions:\n  -C, --cookie-path PATH  Path to .json file containing cookies for\n                          `chat.openai.com`\n  -M, --model TEXT        ChatGPT's model to be used\n  -I, --index INTEGER     Conversation index to resume from\n  -P, --prompt TEXT       Start conversation with this messsage\n  --help                  Show this message and exit.\n```\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\n\n` $ webchatgpt interactive --help`\n\n\u003c/summary\u003e\n\n```\nUsage: webchatgpt interactive [OPTIONS]\n\n  Chat with ChatGPT interactively\n\nOptions:\n  -C, --cookie-path PATH          Path to .json file containing cookies for\n                                  `chat.openai.com`\n  -M, --model TEXT                ChatGPT's model to be used\n  -I, --index INTEGER             Conversation index to resume from\n  -P, --prompt TEXT               Start conversation with this messsage\n  -B, --busy-bar-index INTEGER RANGE\n                                  Busy bar index [0:/, 1:■█■■■]  [0\u003c=x\u003c=1]\n  --help                          Show this message and exit.\n```\n\n\u003c/details\u003e\n\nRunning `h` while in interactive prompt:\n\n```\n╒════╤════════════════════════╤═══════════════════════════════════════╕\n│    │ Command                │ Action                                │\n╞════╪════════════════════════╪═══════════════════════════════════════╡\n│  0 │ h                      │ Show this help info                   │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│  1 │ history                │ Show conversation history             │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│  2 │ share                  │ Share conversation by link            │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│  3 │ stop_share             │ Revoke shared conversation link       │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│  4 │ rename                 │ Rename conversation title             │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│  5 │ archive                │ Archive or unarchive a conversation   │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│  6 │ shared_conversations   │ Show shared conversations             │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│  7 │ previous_conversations │ Show previous conversations           │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│  8 │ delete_conversation    │ Delete a particular conversation      │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│  9 │ prompts                │ Generate random prompts               │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 10 │ account_info           │ ChatGPT account info/setings          │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 11 │ ask                    │ Show raw response from ChatGPT        │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 12 │ auth                   │ Show current user auth info           │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 13 │ migrate                │ Shift to another conversation         │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 14 │ set_theme              │ Set theme for displaying codes        │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 15 │ copy_this              │ Copy last response                    │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 16 │ with_copied            │ Attach last copied text to the prompt │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 17 │ clear                  │ Clear console                         │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 18 │ ./\u003ccommand\u003e            │ Run system command                    │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 19 │ \u003cany other\u003e            │ Interact with ChatGPT                 │\n├────┼────────────────────────┼───────────────────────────────────────┤\n│ 20 │ exit                   │ Quit Program                          │\n╘════╧════════════════════════╧═══════════════════════════════════════╛\n```\n\n\u003c/details\u003e\n\nIf `$ webchatgpt` doesn't look cool on you, there's this workaround `python -m WebChatGPT`\n\nStarting from [v0.2.4](https://github.com/Simatwa/WebChatGPT/releases) onwards, shortcut to `$ webchatgpt` is `$ wbc`.\n\n## [Developer Documentation](https://github.com/Simatwa/WebChatGPT/blob/main/docs/DEVELOPER.md)\n\n## ToDo\n\n- [x] Stream Response\n- [ ] Create new conversation\n- [ ] Implement Your idea\n- [ ] Fix my bad code.\n\n## Contributions\n\nAnyone is free to [fork](https://github.com/Simatwa/WebChatGPT/fork), submit [pull request](https://github.com/Simatwa/WebChatGPT/pulls/new) as well as submitting [issues](https://github.com/Simatwa/WebChatGPT/issues/new).\n\nConsider taking a look at the [flow of events info](https://github.com/Simatwa/WebChatGPT/blob/main/docs/operations_flow.md) for the case of a [pull request](https://github.com/Simatwa/WebChatGPT/pulls).\n\n## Acknowledgements\n\n1. [x] [Http-Tracker](https://github.com/venukbh/http-tracker).\n2. [x] [export-cookie-for-puppeteer](https://github.com/ktty1220/export-cookie-for-puppeteer)\n\n## Special Thanks\n\n- [x] You\n\nIf you don't want to follow all those steps; there this script that works out of the box. No API key needed at all, not even the cookies. Just installation and you're good to go. Check out [tgpt2](https://github.com/Simatwa/tgpt2/).\n\nTo those wishing to use the Official Openai API endpoints + GoogleBard at console environment; purpose to check out [GPT-CLI](https://github.com/Simatwa/GPT-CLI)\n\n## Disclaimer\n\nThis project is a reverse-engineered implementation of the ChatGPT web version and is intended for educational and research purposes only. It is not affiliated with or endorsed by OpenAI. The code in this repository is based on reverse engineering efforts and may not perfectly replicate the functionalities or behavior of the original ChatGPT web version. Usage of this code is at your own risk, and the maintainers of this repository are not responsible for any misuse or unintended use of the generated content. Please refer to OpenAI's policies and terms of service regarding the use of their services and models. By using this repository, you agree to comply with all relevant laws and OpenAI's terms of service.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimatwa%2Fwebchatgpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimatwa%2Fwebchatgpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimatwa%2Fwebchatgpt/lists"}