From f95ace38705df52c0c8a7351fe81283bf51e1365 Mon Sep 17 00:00:00 2001 From: ezerinz Date: Fri, 28 Apr 2023 16:36:53 +0800 Subject: add openaihosted testing --- testing/openaihosted_test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 testing/openaihosted_test.py diff --git a/testing/openaihosted_test.py b/testing/openaihosted_test.py new file mode 100644 index 00000000..d5a79e52 --- /dev/null +++ b/testing/openaihosted_test.py @@ -0,0 +1,14 @@ +import openaihosted + +messages = [{"role": "system", "content": "You are a helpful assistant."}] +while True: + question = input("Question: ") + if question == "!stop": + break + + messages.append({"role": "user", "content": question}) + request = openaihosted.Completion.create(messages=messages) + + response = request["responses"] + messages.append({"role": "assistant", "content": response}) + print(f"Answer: {response}") -- cgit v1.2.3 From 5b38bcf8e63431102467ed5477b6dfc052a7fa05 Mon Sep 17 00:00:00 2001 From: ezerinz Date: Fri, 28 Apr 2023 16:37:28 +0800 Subject: update readme/usage example --- openaihosted/readme.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/openaihosted/readme.md b/openaihosted/readme.md index acd60bab..7b8ced56 100644 --- a/openaihosted/readme.md +++ b/openaihosted/readme.md @@ -1,10 +1,18 @@ -### Example: `openaihosted`) - +### Example: `openaihosted` (use like openai pypi package) ```python -# import library import openaihosted -res = openaihosted.Completion.create(systemprompt="U are ChatGPT", text="What is 4+4", assistantprompt="U are a helpful assistant.")['response'] -print(res) ## Responds with the answer +messages = [{"role": "system", "content": "You are a helpful assistant."}] +while True: + question = input("Question: ") + if question == "!stop": + break + + messages.append({"role": "user", "content": question}) + request = openaihosted.Completion.create(messages=messages) + + response = request["responses"] + messages.append({"role": "assistant", "content": response}) + print(f"Answer: {response}") ``` -- cgit v1.2.3 From be04fcd7f326a02ace84ea66d614298bee15f9e0 Mon Sep 17 00:00:00 2001 From: ezerinz Date: Fri, 28 Apr 2023 16:38:05 +0800 Subject: update code, handle escape sequence and others --- openaihosted/__init__.py | 96 ++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/openaihosted/__init__.py b/openaihosted/__init__.py index c773b3f9..4f25a2be 100644 --- a/openaihosted/__init__.py +++ b/openaihosted/__init__.py @@ -1,60 +1,62 @@ import json import re -from fake_useragent import UserAgent - import requests + class Completion: @staticmethod - def create( - systemprompt:str, - text:str, - assistantprompt:str - ): - - data = [ - {"role": "system", "content": systemprompt}, - {"role": "user", "content": "hi"}, - {"role": "assistant", "content": assistantprompt}, - {"role": "user", "content": text}, - ] - url = f'https://openai.a2hosted.com/chat?q={Completion.__get_query_param(data)}' - - try: - response = requests.get(url, headers=Completion.__get_headers(), stream=True) - except: + def create(messages): + headers = { + "authority": "openai.a2hosted.com", + "accept": "text/event-stream", + "accept-language": "en-US,en;q=0.9,id;q=0.8,ja;q=0.7", + "cache-control": "no-cache", + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "cross-site", + "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0", + } + + query_param = Completion.__create_query_param(messages) + url = f"https://openai.a2hosted.com/chat?q={query_param}" + request = requests.get(url, headers=headers, stream=True) + if request.status_code != 200: return Completion.__get_failure_response() - sentence = "" + content = request.content + response = Completion.__join_response(content) + + return {"responses": response} - for message in response.iter_content(chunk_size=1024): - message = message.decode('utf-8') - msg_match, num_match = re.search(r'"msg":"([^"]+)"', message), re.search(r'\[DONE\] (\d+)', message) - if msg_match: - # Put the captured group into a sentence - sentence += msg_match.group(1) - return { - 'response': sentence - } - - @classmethod - def __get_headers(cls) -> dict: - return { - 'authority': 'openai.a2hosted.com', - 'accept': 'text/event-stream', - 'accept-language': 'en-US,en;q=0.9,id;q=0.8,ja;q=0.7', - 'cache-control': 'no-cache', - 'sec-fetch-dest': 'empty', - 'sec-fetch-mode': 'cors', - 'sec-fetch-site': 'cross-site', - 'user-agent': UserAgent().random - } - @classmethod def __get_failure_response(cls) -> dict: - return dict(response='Unable to fetch the response, Please try again.', links=[], extra={}) - + return dict( + response="Unable to fetch the response, Please try again.", + links=[], + extra={}, + ) + + @classmethod + def __multiple_replace(cls, string, reps) -> str: + for original, replacement in reps.items(): + string = string.replace(original, replacement) + return string + @classmethod - def __get_query_param(cls, conversation) -> str: + def __create_query_param(cls, conversation) -> str: encoded_conversation = json.dumps(conversation) - return encoded_conversation.replace(" ", "%20").replace('"', '%22').replace("'", "%27") \ No newline at end of file + replacement = {" ": "%20", '"': "%22", "'": "%27"} + return Completion.__multiple_replace(encoded_conversation, replacement) + + @classmethod + def __convert_escape_codes(cls, text) -> str: + replacement = {'\\\\"': '"', '\\"': '"', "\\n": "\n", "\\'": "'"} + return Completion.__multiple_replace(text, replacement) + + @classmethod + def __join_response(cls, data) -> str: + data = data.decode("utf-8") + find_ans = re.findall(r'(?<={"msg":)[^}]*', str(data)) + ans = [Completion.__convert_escape_codes(x[1:-1]) for x in find_ans] + response = "".join(ans) + return response -- cgit v1.2.3 From 7ef85f46716bb39f1e19f77949d02b7881399cc4 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 10:42:06 +0100 Subject: Update README.md --- README.md | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 14bf0d93..760b36d1 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,6 @@ -# GPT4free - use ChatGPT, for free!! - ##### You may join our discord server for updates and support ; ) - [Discord Link](https://discord.gg/gpt4free) -image - -Have you ever come across some amazing projects that you couldn't use **just because you didn't have an OpenAI API key?** - -**We've got you covered!** This repository offers **reverse-engineered** third-party APIs for `GPT-4/3.5`, sourced from various websites. You can simply **download** this repository, and use the available modules, which are designed to be used **just like OpenAI's official package**. **Unleash ChatGPT's potential for your projects, now!** You are welcome ; ). - -By the way, thank you so much for [![Stars](https://img.shields.io/github/stars/xtekky/gpt4free?style=social)](https://github.com/xtekky/gpt4free/stargazers) and all the support!! - ## Legal Notice This repository uses third-party APIs and AI models and is *not* associated with or endorsed by the API providers or the original developers of the models. This project is intended **for educational purposes only**. @@ -23,7 +13,6 @@ Please note the following: 3. **Educational Purposes Only**: This repository and its content are provided strictly for educational purposes. By using the information and code provided, users acknowledge that they are using the APIs and models at their own risk and agree to comply with any applicable laws and regulations. - ## Table of Contents | Section | Description | Link | Status | | ------- | ----------- | ---- | ------ | @@ -50,7 +39,7 @@ Please note the following: ## Todo - [ ] Add a GUI for the repo -- [ ] Make a general package named `openai_rev`, instead of different folders +- [ ] Make a general package named `gpt4free`, instead of different folders - [ ] Live api status to know which are down and which can be used - [ ] Integrate more API's in `./unfinished` as well as other ones in the lists - [ ] Make an API to use as proxy for other projects @@ -66,7 +55,6 @@ Please note the following: | [t3nsor.com](https://t3nsor.com) | GPT-3.5 | | [you.com](https://you.com) | GPT-3.5 / Internet / good search| | [sqlchat.ai](https://sqlchat.ai) | GPT-3.5 | -| [chat.openai.com/chat](https://chat.openai.com/chat) | GPT-3.5 | | [bard.google.com](https://bard.google.com) | custom / search | | [bing.com/chat](https://bing.com/chat) | GPT-4/3.5 | | [chat.forefront.ai/](https://chat.forefront.ai/) | GPT-4/3.5 | @@ -114,7 +102,7 @@ Most code, with the exception of `quora/api.py` (by [ading2210](https://github.c ### Copyright Notice: ``` -xtekky/openai-gpt4: multiple reverse engineered language-model api's to decentralise the ai industry. +xtekky/gpt4free: multiple reverse engineered language-model api's to decentralise the ai industry. Copyright (C) 2023 xtekky This program is free software: you can redistribute it and/or modify -- cgit v1.2.3 From b136f556e72c89635d75768b24f5c723b418f684 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 11:31:29 +0100 Subject: Update README.md --- README.md | 142 ++++++++++++++------------------------------------------------ 1 file changed, 32 insertions(+), 110 deletions(-) diff --git a/README.md b/README.md index 760b36d1..63d9bf29 100644 --- a/README.md +++ b/README.md @@ -1,123 +1,45 @@ -##### You may join our discord server for updates and support ; ) -- [Discord Link](https://discord.gg/gpt4free) +we got a takedown... -## Legal Notice -This repository uses third-party APIs and AI models and is *not* associated with or endorsed by the API providers or the original developers of the models. This project is intended **for educational purposes only**. +here is a lil poem to in the meantime: -Please note the following: +```Once upon a time, in a land of code, +A little boy sat, in his humble abode. +He tinkered and toyed with devtools galore, +And found himself curious, eager for more. -1. **Disclaimer**: The APIs, services, and trademarks mentioned in this repository belong to their respective owners. This project is *not* claiming any right over them. +He copy-pasted requests, with glee and delight, +A personal project, to last him the night. +For educational purposes, and fun it was too, +This little boy's journey had just begun anew. -2. **Responsibility**: The author of this repository is *not* responsible for any consequences arising from the use or misuse of this repository or the content provided by the third-party APIs and any damage or losses caused by users' actions. +Now far away, in a tower so grand, +A big company stood, ruling the land. +Their software was mighty, their power supreme, +But they never expected this boy and his dream. -3. **Educational Purposes Only**: This repository and its content are provided strictly for educational purposes. By using the information and code provided, users acknowledge that they are using the APIs and models at their own risk and agree to comply with any applicable laws and regulations. +As he played with their code, they started to fret, +"What if he breaks it? What if we're upset?" +They panicked and worried, their faces turned red, +As visions of chaos danced in their head. -## Table of Contents -| Section | Description | Link | Status | -| ------- | ----------- | ---- | ------ | -| **To do list** | List of tasks to be done | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#todo) | - | -| **Current Sites** | Current websites or platforms that can be used as APIs | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#current-sites) | - | -| **Best Sites for gpt4** | Recommended websites or platforms for gpt4 | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#best-sites) | - | -| **Streamlit GPT4Free GUI** | Web-based graphical user interface for interacting with gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#streamlit-gpt4free-gui) | - | -| **Docker** | Instructions on how to run gpt4free in a Docker container | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#docker-instructions) | - | -| **ChatGPT clone** | A ChatGPT clone with new features and scalability | [![Link to Website](https://img.shields.io/badge/Link-Visit%20Site-blue)](https://chat.chatbot.sex/chat) | - | -| **How to install** | Instructions on how to install gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#install) | - | -| **Legal Notice** | Legal notice or disclaimer | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#legal-notice) | - | -| **Copyright** | Copyright information | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#copyright) | - | -| **Star History** | Star History | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#star-history) | - | -| **Usage Examples** | | | | -| `theb` | Example usage for theb (gpt-3.5) | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./theb/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | -| `forefront` | Example usage for forefront (gpt-4) | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./forefront/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | || -| `quora (poe)` | Example usage for quora | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./quora/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | -| `you` | Example usage for you | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./you/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | -| **Try it Out** | | | | -| Google Colab Jupyter Notebook | Example usage for gpt4free | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DanielShemesh/gpt4free-colab/blob/main/gpt4free.ipynb) | - | -| replit Example (feel free to fork this repl) | Example usage for gpt4free | [![](https://img.shields.io/badge/Open%20in-Replit-1A1E27?logo=replit)](https://replit.com/@gpt4free/gpt4free-webui) | - | +The CEO paced in his office so wide, +His minions all scurrying to hide. +"Who is this child?" he cried out in fear, +"Who dares to disrupt our digital sphere?" +The developers gathered, their keyboards ablaze, +To analyze the boy's mischievous ways. +They studied his project, they pored through his code, +And soon they discovered his humble abode. -## Todo +"We must stop him!" they cried with a shiver, +"This little boy's making our company quiver!" +So they plotted and schemed to halt his advance, +To put an end to his digital dance. -- [ ] Add a GUI for the repo -- [ ] Make a general package named `gpt4free`, instead of different folders -- [ ] Live api status to know which are down and which can be used -- [ ] Integrate more API's in `./unfinished` as well as other ones in the lists -- [ ] Make an API to use as proxy for other projects -- [ ] Make a pypi package - -## Current Sites - -| Website s | Model(s) | -| ---------------------------------------------------- | ------------------------------- | -| [forefront.ai](https://chat.forefront.ai) | GPT-4/3.5 | -| [poe.com](https://poe.com) | GPT-4/3.5 | -| [writesonic.com](https://writesonic.com) | GPT-3.5 / Internet | -| [t3nsor.com](https://t3nsor.com) | GPT-3.5 | -| [you.com](https://you.com) | GPT-3.5 / Internet / good search| -| [sqlchat.ai](https://sqlchat.ai) | GPT-3.5 | -| [bard.google.com](https://bard.google.com) | custom / search | -| [bing.com/chat](https://bing.com/chat) | GPT-4/3.5 | -| [chat.forefront.ai/](https://chat.forefront.ai/) | GPT-4/3.5 | - -## Best sites - -#### gpt-4 -- [`/forefront`](./forefront/README.md) - -#### gpt-3.5 -- [`/you`](./you/README.md) - -## Install -Download or clone this GitHub repo -install requirements with: -```sh -pip3 install -r requirements.txt -``` - -## To start gpt4free GUI -Move `streamlit_app.py` from `./gui` to the base folder -then run: -`streamlit run streamlit_app.py` or `python3 -m streamlit run streamlit_app.py` - -## Docker -Build -``` -docker build -t gpt4free:latest -f Docker/Dockerfile . ``` -Run -``` -docker run -p 8501:8501 gpt4free:latest -``` - -## ChatGPT clone -> currently implementing new features and trying to scale it, please be patient it may be unstable -> https://chat.chatbot.sex/chat -> This site was developed by me and includes **gpt-4/3.5**, **internet access** and **gpt-jailbreak's** like DAN -> run locally here: https://github.com/xtekky/chatgpt-clone - -## Copyright: -This program is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt) - -Most code, with the exception of `quora/api.py` (by [ading2210](https://github.com/ading2210)), has been written by me, [xtekky](https://github.com/xtekky). +( I did not write it ) -### Copyright Notice: -``` -xtekky/gpt4free: multiple reverse engineered language-model api's to decentralise the ai industry. -Copyright (C) 2023 xtekky - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -``` -## Star History -[![Star History Chart](https://api.star-history.com/svg?repos=xtekky/gpt4free&type=Date)](https://star-history.com/#xtekky/gpt4free) +discord: https://discord.com/gpt4free -- cgit v1.2.3 From 5b0fa35185f1bfe664c41df5f1d72b7d0fe0a10b Mon Sep 17 00:00:00 2001 From: Daniel Shemesh Date: Fri, 28 Apr 2023 13:37:29 +0300 Subject: initial chatpdf reverse api --- unfinished/chatpdf/__init__.py | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 unfinished/chatpdf/__init__.py diff --git a/unfinished/chatpdf/__init__.py b/unfinished/chatpdf/__init__.py new file mode 100644 index 00000000..4c9d2d3e --- /dev/null +++ b/unfinished/chatpdf/__init__.py @@ -0,0 +1,75 @@ +import requests +import json + +class Completion: + + def request(prompt: str): + '''TODO: some sort of authentication + upload PDF from URL or local file + Then you should get the atoken and chat ID + ''' + + token = "your_token_here" + chat_id = "your_chat_id_here" + + url = "https://chat-pr4yueoqha-ue.a.run.app/" + + payload = json.dumps({ + "v": 2, + "chatSession": { + "type": "join", + "chatId": chat_id + }, + "history": [ + { + "id": "VNsSyJIq_0", + "author": "p_if2GPSfyN8hjDoA7unYe", + "msg": "", + "time": 1682672009270 + }, + { + "id": "Zk8DRUtx_6", + "author": "uplaceholder", + "msg": prompt, + "time": 1682672181339 + } + ] + }) + + # TODO: fix headers, use random user-agent, streaming response, etc + headers = { + 'authority': 'chat-pr4yueoqha-ue.a.run.app', + 'accept': '*/*', + 'accept-language': 'en-US,en;q=0.9', + 'atoken': token, + 'content-type': 'application/json', + 'origin': 'https://www.chatpdf.com', + 'referer': 'https://www.chatpdf.com/', + 'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"Windows"', + 'sec-fetch-dest': 'empty', + 'sec-fetch-mode': 'cors', + 'sec-fetch-site': 'cross-site', + 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36' + } + + response = requests.request("POST", url, headers=headers, data=payload).text + Completion.stream_completed = True + return {'response': response} + + @staticmethod + def create(prompt: str): + Thread(target=Completion.request, args=[prompt]).start() + + while Completion.stream_completed != True or not Completion.message_queue.empty(): + try: + message = Completion.message_queue.get(timeout=0.01) + for message in findall(Completion.regex, message): + yield loads(Completion.part1 + message + Completion.part2)['delta'] + + except Empty: + pass + + @staticmethod + def handle_stream_response(response): + Completion.message_queue.put(response.decode()) -- cgit v1.2.3 From 3c5baa488a50c90696532709529934f3492b99b7 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 12:36:09 +0100 Subject: Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 63d9bf29..b4d5d605 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ -we got a takedown... +We got a takedown request by openai's legal team... - -here is a lil poem to in the meantime: +here is a lil poem in the meantime: ```Once upon a time, in a land of code, A little boy sat, in his humble abode. -- cgit v1.2.3 From 144143c84e6cc4c1dbf854ec8915915c585de11a Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 13:48:49 +0100 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4d5d605..f653e683 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ We got a takedown request by openai's legal team... -here is a lil poem in the meantime: +here is a lil poem you can read in the meantime, while I am investigating it: ```Once upon a time, in a land of code, A little boy sat, in his humble abode. -- cgit v1.2.3 From 3630149afad092294214fb1393aa8a241865b73c Mon Sep 17 00:00:00 2001 From: Jisan <66010486+Jisan09@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:12:34 +0530 Subject: Update __init__.py --- forefront/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/forefront/__init__.py b/forefront/__init__.py index 615057f8..30aae844 100644 --- a/forefront/__init__.py +++ b/forefront/__init__.py @@ -39,11 +39,11 @@ class Account: } ) - try: - trace_token = response.json()['response']['id'] - if logging: print(trace_token) - except KeyError: - return 'Failed to create account!' + try: + trace_token = response.json()['response']['id'] + if logging: print(trace_token) + except KeyError: + return 'Failed to create account!' response = client.post( f"https://clerk.forefront.ai/v1/client/sign_ups/{trace_token}/prepare_verification?_clerk_js_version=4.32.6", -- cgit v1.2.3 From fdb6fbdcc4563f136db9011e0122c7375f5d4d17 Mon Sep 17 00:00:00 2001 From: Peter Labadorf <31414089+Plaba@users.noreply.github.com> Date: Fri, 28 Apr 2023 12:29:43 -0400 Subject: Update README.md Made the meter flow better and added some verses;) --- README.md | 56 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index f653e683..47689acd 100644 --- a/README.md +++ b/README.md @@ -2,41 +2,51 @@ We got a takedown request by openai's legal team... here is a lil poem you can read in the meantime, while I am investigating it: -```Once upon a time, in a land of code, +``` +There once was a time, in a land full of code, A little boy sat, in his humble abode. He tinkered and toyed with devtools galore, -And found himself curious, eager for more. +And found himself curious, and eager for more. -He copy-pasted requests, with glee and delight, +He copied and pasted, with glee and delight, A personal project, to last him the night. -For educational purposes, and fun it was too, -This little boy's journey had just begun anew. +For use academic, and also for fun, +This little boy's race he just started to run. -Now far away, in a tower so grand, -A big company stood, ruling the land. +Now quite far removed, in a tower so grand, +A company stood, it was ruling the land. Their software was mighty, their power supreme, But they never expected this boy and his dream. -As he played with their code, they started to fret, -"What if he breaks it? What if we're upset?" +As he played with their code, they then started to fear, +"His project is free! What of money so dear?" They panicked and worried, their faces turned red, -As visions of chaos danced in their head. +As visions of chaos now filled every head. -The CEO paced in his office so wide, -His minions all scurrying to hide. -"Who is this child?" he cried out in fear, -"Who dares to disrupt our digital sphere?" +The CEO paced, in his office so wide, +His minions all scrambled, and trying to hide. +"Who is this bad child?" he cried out in alarm, +"Our great AI moat, why would he cause harm?" The developers gathered, their keyboards ablaze, -To analyze the boy's mischievous ways. -They studied his project, they pored through his code, -And soon they discovered his humble abode. - -"We must stop him!" they cried with a shiver, -"This little boy's making our company quiver!" -So they plotted and schemed to halt his advance, -To put an end to his digital dance. - +To analyze closely the boy's evil ways. +They studied his project, they cracked every tome, +And soon they discovered his small, humble home. + +"We must stop him!" they cried, with a shout and a shiver, +"This little boy's Mᴀᴋɪɴɢ OUR COMPANY QUIVER!" +So they plotted and schemed to yet halt his advance, +To put an end to his dear digital dance. + +They filed then with GitHub a claim most obscene, +"His code is not his," said the company team, +Because of the law, the Great Copyright Mess, +This little boy got his first takedown request. + +Now new information we do not yet know, +But for the boy's good, we hope results show. +For the cause of the True, the Brave and the Right, +Till the long bitter end, will this boy live to fight. ``` ( I did not write it ) -- cgit v1.2.3 From 88b4ebba3de26c0fdbc5f5704abe126d42eba559 Mon Sep 17 00:00:00 2001 From: 0dminnimda <0dminnimda@gmail.com> Date: Fri, 28 Apr 2023 19:31:51 +0300 Subject: Print the mail messages only when logging --- forefront/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forefront/__init__.py b/forefront/__init__.py index 30aae844..03f24729 100644 --- a/forefront/__init__.py +++ b/forefront/__init__.py @@ -60,7 +60,7 @@ class Account: while True: sleep(1) for _ in mail.fetch_inbox(): - print(mail.get_message_content(_["id"])) + if logging: print(mail.get_message_content(_["id"])) mail_token = match(r"(\d){5,6}", mail.get_message_content(_["id"])).group(0) if mail_token: -- cgit v1.2.3 From 19a09d76a21508e75dfbdfb0e9cdfcd2e420c462 Mon Sep 17 00:00:00 2001 From: MrDiamondDog <84212701+MrDiamondDog@users.noreply.github.com> Date: Fri, 28 Apr 2023 13:48:18 -0600 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f653e683..3748745f 100644 --- a/README.md +++ b/README.md @@ -41,4 +41,4 @@ To put an end to his digital dance. ( I did not write it ) -discord: https://discord.com/gpt4free +discord: https://discord.gg/gpt4free -- cgit v1.2.3 From c00b21e0a3ff60a6d4b1ef379aba57893658d234 Mon Sep 17 00:00:00 2001 From: Samuel Feder <118295106+RavenOwO@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:07:26 +0200 Subject: typo corrected "refractoring" to "refactoring" --- unfinished/openai/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unfinished/openai/README.md b/unfinished/openai/README.md index 67e8645c..39196729 100644 --- a/unfinished/openai/README.md +++ b/unfinished/openai/README.md @@ -1,2 +1,2 @@ to do: -- code refractoring \ No newline at end of file +- code refactoring -- cgit v1.2.3 From b3d964b59e20adabfd3fd3d1f9ba06174738b80f Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:30:16 +0100 Subject: Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e2bc8e6c..da4806ad 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ We got a takedown request by openai's legal team... +discord sever for updates / support: +- https://discord.gg/gpt4free + here is a lil poem you can read in the meantime, while I am investigating it: ``` @@ -51,4 +54,4 @@ Till the long bitter end, will this boy live to fight. ( I did not write it ) -discord: https://discord.gg/gpt4free + -- cgit v1.2.3 From 06d20cbb42087e7ff632cc57c68b40a4d6fea23a Mon Sep 17 00:00:00 2001 From: Samuel Feder <118295106+RavenOwO@users.noreply.github.com> Date: Sat, 29 Apr 2023 00:37:07 +0200 Subject: typos --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index da4806ad..0a63da95 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -We got a takedown request by openai's legal team... +We got a takedown request by openAI's legal team... -discord sever for updates / support: +discord server for updates / support: - https://discord.gg/gpt4free -here is a lil poem you can read in the meantime, while I am investigating it: +here is a lil' poem you can read in the meantime, while I am investigating it: ``` There once was a time, in a land full of code, -- cgit v1.2.3 From aaad13f6d5c415718add95ea1f91ec384a347de1 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 23:51:15 +0100 Subject: Create OLDREADME.md --- OLDREADME.md | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 OLDREADME.md diff --git a/OLDREADME.md b/OLDREADME.md new file mode 100644 index 00000000..14bf0d93 --- /dev/null +++ b/OLDREADME.md @@ -0,0 +1,135 @@ +# GPT4free - use ChatGPT, for free!! + +##### You may join our discord server for updates and support ; ) +- [Discord Link](https://discord.gg/gpt4free) + +image + +Have you ever come across some amazing projects that you couldn't use **just because you didn't have an OpenAI API key?** + +**We've got you covered!** This repository offers **reverse-engineered** third-party APIs for `GPT-4/3.5`, sourced from various websites. You can simply **download** this repository, and use the available modules, which are designed to be used **just like OpenAI's official package**. **Unleash ChatGPT's potential for your projects, now!** You are welcome ; ). + +By the way, thank you so much for [![Stars](https://img.shields.io/github/stars/xtekky/gpt4free?style=social)](https://github.com/xtekky/gpt4free/stargazers) and all the support!! + +## Legal Notice + +This repository uses third-party APIs and AI models and is *not* associated with or endorsed by the API providers or the original developers of the models. This project is intended **for educational purposes only**. + +Please note the following: + +1. **Disclaimer**: The APIs, services, and trademarks mentioned in this repository belong to their respective owners. This project is *not* claiming any right over them. + +2. **Responsibility**: The author of this repository is *not* responsible for any consequences arising from the use or misuse of this repository or the content provided by the third-party APIs and any damage or losses caused by users' actions. + +3. **Educational Purposes Only**: This repository and its content are provided strictly for educational purposes. By using the information and code provided, users acknowledge that they are using the APIs and models at their own risk and agree to comply with any applicable laws and regulations. + + +## Table of Contents +| Section | Description | Link | Status | +| ------- | ----------- | ---- | ------ | +| **To do list** | List of tasks to be done | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#todo) | - | +| **Current Sites** | Current websites or platforms that can be used as APIs | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#current-sites) | - | +| **Best Sites for gpt4** | Recommended websites or platforms for gpt4 | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#best-sites) | - | +| **Streamlit GPT4Free GUI** | Web-based graphical user interface for interacting with gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#streamlit-gpt4free-gui) | - | +| **Docker** | Instructions on how to run gpt4free in a Docker container | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#docker-instructions) | - | +| **ChatGPT clone** | A ChatGPT clone with new features and scalability | [![Link to Website](https://img.shields.io/badge/Link-Visit%20Site-blue)](https://chat.chatbot.sex/chat) | - | +| **How to install** | Instructions on how to install gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#install) | - | +| **Legal Notice** | Legal notice or disclaimer | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#legal-notice) | - | +| **Copyright** | Copyright information | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#copyright) | - | +| **Star History** | Star History | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#star-history) | - | +| **Usage Examples** | | | | +| `theb` | Example usage for theb (gpt-3.5) | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./theb/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | +| `forefront` | Example usage for forefront (gpt-4) | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./forefront/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | || +| `quora (poe)` | Example usage for quora | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./quora/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | +| `you` | Example usage for you | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./you/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | +| **Try it Out** | | | | +| Google Colab Jupyter Notebook | Example usage for gpt4free | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DanielShemesh/gpt4free-colab/blob/main/gpt4free.ipynb) | - | +| replit Example (feel free to fork this repl) | Example usage for gpt4free | [![](https://img.shields.io/badge/Open%20in-Replit-1A1E27?logo=replit)](https://replit.com/@gpt4free/gpt4free-webui) | - | + + +## Todo + +- [ ] Add a GUI for the repo +- [ ] Make a general package named `openai_rev`, instead of different folders +- [ ] Live api status to know which are down and which can be used +- [ ] Integrate more API's in `./unfinished` as well as other ones in the lists +- [ ] Make an API to use as proxy for other projects +- [ ] Make a pypi package + +## Current Sites + +| Website s | Model(s) | +| ---------------------------------------------------- | ------------------------------- | +| [forefront.ai](https://chat.forefront.ai) | GPT-4/3.5 | +| [poe.com](https://poe.com) | GPT-4/3.5 | +| [writesonic.com](https://writesonic.com) | GPT-3.5 / Internet | +| [t3nsor.com](https://t3nsor.com) | GPT-3.5 | +| [you.com](https://you.com) | GPT-3.5 / Internet / good search| +| [sqlchat.ai](https://sqlchat.ai) | GPT-3.5 | +| [chat.openai.com/chat](https://chat.openai.com/chat) | GPT-3.5 | +| [bard.google.com](https://bard.google.com) | custom / search | +| [bing.com/chat](https://bing.com/chat) | GPT-4/3.5 | +| [chat.forefront.ai/](https://chat.forefront.ai/) | GPT-4/3.5 | + +## Best sites + +#### gpt-4 +- [`/forefront`](./forefront/README.md) + +#### gpt-3.5 +- [`/you`](./you/README.md) + +## Install +Download or clone this GitHub repo +install requirements with: +```sh +pip3 install -r requirements.txt +``` + +## To start gpt4free GUI +Move `streamlit_app.py` from `./gui` to the base folder +then run: +`streamlit run streamlit_app.py` or `python3 -m streamlit run streamlit_app.py` + +## Docker +Build +``` +docker build -t gpt4free:latest -f Docker/Dockerfile . +``` +Run +``` +docker run -p 8501:8501 gpt4free:latest +``` + +## ChatGPT clone +> currently implementing new features and trying to scale it, please be patient it may be unstable +> https://chat.chatbot.sex/chat +> This site was developed by me and includes **gpt-4/3.5**, **internet access** and **gpt-jailbreak's** like DAN +> run locally here: https://github.com/xtekky/chatgpt-clone + +## Copyright: +This program is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt) + +Most code, with the exception of `quora/api.py` (by [ading2210](https://github.com/ading2210)), has been written by me, [xtekky](https://github.com/xtekky). + +### Copyright Notice: +``` +xtekky/openai-gpt4: multiple reverse engineered language-model api's to decentralise the ai industry. +Copyright (C) 2023 xtekky + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +``` + +## Star History +[![Star History Chart](https://api.star-history.com/svg?repos=xtekky/gpt4free&type=Date)](https://star-history.com/#xtekky/gpt4free) -- cgit v1.2.3 From 9fe270819a515281ef20417d2e1e0172e333e62b Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 23:52:01 +0100 Subject: Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0a63da95..59c2b512 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ We got a takedown request by openAI's legal team... +you may refer to the old readme: [OLDREADME.md](./OLDREADME.md) + discord server for updates / support: - https://discord.gg/gpt4free -- cgit v1.2.3 From eb434543e9b183360004b2a1c75d06905323170a Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 23:52:11 +0100 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 59c2b512..f38fe2bb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -We got a takedown request by openAI's legal team... +We got a takedown request by openAI's legal team... you may refer to the old readme: [OLDREADME.md](./OLDREADME.md) -- cgit v1.2.3 From dc912e0fc985c0d8b17bb29a27bb6ee62dfb7bc8 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 23:54:35 +0100 Subject: _ --- unfinished/vercelai/__init__.py | 41 ++++++++++++++++++++++ unfinished/vercelai/test.js | 33 ++++++++++++++++++ unfinished/vercelai/test.py | 67 ++++++++++++++++++++++++++++++++++++ unfinished/vercelai/token.py | 0 unfinished/vercelai/v2.py | 27 --------------- unfinished/vercelai/vercelai_test.py | 5 +++ 6 files changed, 146 insertions(+), 27 deletions(-) create mode 100644 unfinished/vercelai/__init__.py create mode 100644 unfinished/vercelai/test.js create mode 100644 unfinished/vercelai/test.py create mode 100644 unfinished/vercelai/token.py delete mode 100644 unfinished/vercelai/v2.py create mode 100644 unfinished/vercelai/vercelai_test.py diff --git a/unfinished/vercelai/__init__.py b/unfinished/vercelai/__init__.py new file mode 100644 index 00000000..1dcb5b39 --- /dev/null +++ b/unfinished/vercelai/__init__.py @@ -0,0 +1,41 @@ +import requests + +class Completion: + def create(prompt: str, + model: str = 'openai:gpt-3.5-turbo', + temperature: float = 0.7, + max_tokens: int = 200, + top_p: float = 1, + top_k: int = 1, + frequency_penalty: float = 1, + presence_penalty: float = 1, + stopSequences: list = []): + + token = requests.get('https://play.vercel.ai/openai.jpeg', headers={ + 'authority': 'play.vercel.ai', + 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3', + 'referer': 'https://play.vercel.ai/', + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'}).text.replace('=','') + + print(token) + + headers = { + 'authority': 'play.vercel.ai', + 'custom-encoding': token, + 'origin': 'https://play.vercel.ai', + 'referer': 'https://play.vercel.ai/', + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36' + } + + for chunk in requests.post('https://play.vercel.ai/api/generate', headers=headers, stream=True, json={ + 'prompt': prompt, + 'model': model, + 'temperature': temperature, + 'maxTokens': max_tokens, + 'topK': top_p, + 'topP': top_k, + 'frequencyPenalty': frequency_penalty, + 'presencePenalty': presence_penalty, + 'stopSequences': stopSequences}).iter_lines(): + + yield (chunk) \ No newline at end of file diff --git a/unfinished/vercelai/test.js b/unfinished/vercelai/test.js new file mode 100644 index 00000000..0f822cfd --- /dev/null +++ b/unfinished/vercelai/test.js @@ -0,0 +1,33 @@ +(async () => { + + let response = await fetch("https://play.vercel.ai/openai.jpeg", { + "headers": { + "accept": "*/*", + "accept-language": "en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3", + "sec-ch-ua": "\"Chromium\";v=\"112\", \"Google Chrome\";v=\"112\", \"Not:A-Brand\";v=\"99\"", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\"macOS\"", + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "same-origin" + }, + "referrer": "https://play.vercel.ai/", + "referrerPolicy": "strict-origin-when-cross-origin", + "body": null, + "method": "GET", + "mode": "cors", + "credentials": "omit" + }); + + + let data = JSON.parse(atob(await response.text())) + let ret = eval("(".concat(data.c, ")(data.a)")); + + botPreventionToken = btoa(JSON.stringify({ + r: ret, + t: data.t + })) + + console.log(botPreventionToken); + +})() \ No newline at end of file diff --git a/unfinished/vercelai/test.py b/unfinished/vercelai/test.py new file mode 100644 index 00000000..318e71c3 --- /dev/null +++ b/unfinished/vercelai/test.py @@ -0,0 +1,67 @@ +import requests +from base64 import b64decode, b64encode +from json import loads +from json import dumps + +headers = { + 'Accept': '*/*', + 'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8', + 'Connection': 'keep-alive', + 'Referer': 'https://play.vercel.ai/', + 'Sec-Fetch-Dest': 'empty', + 'Sec-Fetch-Mode': 'cors', + 'Sec-Fetch-Site': 'same-origin', + 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36', + 'sec-ch-ua': '"Chromium";v="110", "Google Chrome";v="110", "Not:A-Brand";v="99"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"macOS"', +} + +response = requests.get('https://play.vercel.ai/openai.jpeg', headers=headers) + +token_data = loads(b64decode(response.text)) +print(token_data) + +raw_token = { + 'a': token_data['a'] * .1 * .2, + 't': token_data['t'] +} + +print(raw_token) + +new_token = b64encode(dumps(raw_token, separators=(',', ':')).encode()).decode() +print(new_token) + +import requests + +headers = { + 'authority': 'play.vercel.ai', + 'accept': '*/*', + 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3', + 'content-type': 'application/json', + 'custom-encoding': new_token, + 'origin': 'https://play.vercel.ai', + 'referer': 'https://play.vercel.ai/', + 'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"macOS"', + 'sec-fetch-dest': 'empty', + 'sec-fetch-mode': 'cors', + 'sec-fetch-site': 'same-origin', + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36', +} + +json_data = { + 'prompt': 'hello\n', + 'model': 'openai:gpt-3.5-turbo', + 'temperature': 0.7, + 'maxTokens': 200, + 'topK': 1, + 'topP': 1, + 'frequencyPenalty': 1, + 'presencePenalty': 1, + 'stopSequences': [], +} + +response = requests.post('https://play.vercel.ai/api/generate', headers=headers, json=json_data) +print(response.text) \ No newline at end of file diff --git a/unfinished/vercelai/token.py b/unfinished/vercelai/token.py new file mode 100644 index 00000000..e69de29b diff --git a/unfinished/vercelai/v2.py b/unfinished/vercelai/v2.py deleted file mode 100644 index 176ee342..00000000 --- a/unfinished/vercelai/v2.py +++ /dev/null @@ -1,27 +0,0 @@ -import requests - -token = requests.get('https://play.vercel.ai/openai.jpeg', headers={ - 'authority': 'play.vercel.ai', - 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3', - 'referer': 'https://play.vercel.ai/', - 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'}).text + '.' - -headers = { - 'authority': 'play.vercel.ai', - 'custom-encoding': token, - 'origin': 'https://play.vercel.ai', - 'referer': 'https://play.vercel.ai/', - 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36' -} - -for chunk in requests.post('https://play.vercel.ai/api/generate', headers=headers, stream=True, json={ - 'prompt': 'hi', - 'model': 'openai:gpt-3.5-turbo', - 'temperature': 0.7, - 'maxTokens': 200, - 'topK': 1, - 'topP': 1, - 'frequencyPenalty': 1, - 'presencePenalty': 1, - 'stopSequences': []}).iter_lines(): - print(chunk) diff --git a/unfinished/vercelai/vercelai_test.py b/unfinished/vercelai/vercelai_test.py new file mode 100644 index 00000000..24cbe0bc --- /dev/null +++ b/unfinished/vercelai/vercelai_test.py @@ -0,0 +1,5 @@ +import vercelai + +for token in vercelai.Completion.create('summarize the gnu gpl 1.0'): + print(token, end='', flush=True) + -- cgit v1.2.3 From b2d5309ce61fa0086845cb8d43564e044985c2d2 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Fri, 28 Apr 2023 23:58:49 +0100 Subject: readme --- OLDREADME.md | 135 ----------------------------------------------- README.md | 133 +++++++++++++++++++++++++++++++++++++++++++++- openaihosted/__init__.py | 62 ---------------------- openaihosted/readme.md | 18 ------- 4 files changed, 131 insertions(+), 217 deletions(-) delete mode 100644 OLDREADME.md delete mode 100644 openaihosted/__init__.py delete mode 100644 openaihosted/readme.md diff --git a/OLDREADME.md b/OLDREADME.md deleted file mode 100644 index 14bf0d93..00000000 --- a/OLDREADME.md +++ /dev/null @@ -1,135 +0,0 @@ -# GPT4free - use ChatGPT, for free!! - -##### You may join our discord server for updates and support ; ) -- [Discord Link](https://discord.gg/gpt4free) - -image - -Have you ever come across some amazing projects that you couldn't use **just because you didn't have an OpenAI API key?** - -**We've got you covered!** This repository offers **reverse-engineered** third-party APIs for `GPT-4/3.5`, sourced from various websites. You can simply **download** this repository, and use the available modules, which are designed to be used **just like OpenAI's official package**. **Unleash ChatGPT's potential for your projects, now!** You are welcome ; ). - -By the way, thank you so much for [![Stars](https://img.shields.io/github/stars/xtekky/gpt4free?style=social)](https://github.com/xtekky/gpt4free/stargazers) and all the support!! - -## Legal Notice - -This repository uses third-party APIs and AI models and is *not* associated with or endorsed by the API providers or the original developers of the models. This project is intended **for educational purposes only**. - -Please note the following: - -1. **Disclaimer**: The APIs, services, and trademarks mentioned in this repository belong to their respective owners. This project is *not* claiming any right over them. - -2. **Responsibility**: The author of this repository is *not* responsible for any consequences arising from the use or misuse of this repository or the content provided by the third-party APIs and any damage or losses caused by users' actions. - -3. **Educational Purposes Only**: This repository and its content are provided strictly for educational purposes. By using the information and code provided, users acknowledge that they are using the APIs and models at their own risk and agree to comply with any applicable laws and regulations. - - -## Table of Contents -| Section | Description | Link | Status | -| ------- | ----------- | ---- | ------ | -| **To do list** | List of tasks to be done | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#todo) | - | -| **Current Sites** | Current websites or platforms that can be used as APIs | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#current-sites) | - | -| **Best Sites for gpt4** | Recommended websites or platforms for gpt4 | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#best-sites) | - | -| **Streamlit GPT4Free GUI** | Web-based graphical user interface for interacting with gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#streamlit-gpt4free-gui) | - | -| **Docker** | Instructions on how to run gpt4free in a Docker container | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#docker-instructions) | - | -| **ChatGPT clone** | A ChatGPT clone with new features and scalability | [![Link to Website](https://img.shields.io/badge/Link-Visit%20Site-blue)](https://chat.chatbot.sex/chat) | - | -| **How to install** | Instructions on how to install gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#install) | - | -| **Legal Notice** | Legal notice or disclaimer | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#legal-notice) | - | -| **Copyright** | Copyright information | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#copyright) | - | -| **Star History** | Star History | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#star-history) | - | -| **Usage Examples** | | | | -| `theb` | Example usage for theb (gpt-3.5) | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./theb/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | -| `forefront` | Example usage for forefront (gpt-4) | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./forefront/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | || -| `quora (poe)` | Example usage for quora | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./quora/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | -| `you` | Example usage for you | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./you/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | -| **Try it Out** | | | | -| Google Colab Jupyter Notebook | Example usage for gpt4free | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DanielShemesh/gpt4free-colab/blob/main/gpt4free.ipynb) | - | -| replit Example (feel free to fork this repl) | Example usage for gpt4free | [![](https://img.shields.io/badge/Open%20in-Replit-1A1E27?logo=replit)](https://replit.com/@gpt4free/gpt4free-webui) | - | - - -## Todo - -- [ ] Add a GUI for the repo -- [ ] Make a general package named `openai_rev`, instead of different folders -- [ ] Live api status to know which are down and which can be used -- [ ] Integrate more API's in `./unfinished` as well as other ones in the lists -- [ ] Make an API to use as proxy for other projects -- [ ] Make a pypi package - -## Current Sites - -| Website s | Model(s) | -| ---------------------------------------------------- | ------------------------------- | -| [forefront.ai](https://chat.forefront.ai) | GPT-4/3.5 | -| [poe.com](https://poe.com) | GPT-4/3.5 | -| [writesonic.com](https://writesonic.com) | GPT-3.5 / Internet | -| [t3nsor.com](https://t3nsor.com) | GPT-3.5 | -| [you.com](https://you.com) | GPT-3.5 / Internet / good search| -| [sqlchat.ai](https://sqlchat.ai) | GPT-3.5 | -| [chat.openai.com/chat](https://chat.openai.com/chat) | GPT-3.5 | -| [bard.google.com](https://bard.google.com) | custom / search | -| [bing.com/chat](https://bing.com/chat) | GPT-4/3.5 | -| [chat.forefront.ai/](https://chat.forefront.ai/) | GPT-4/3.5 | - -## Best sites - -#### gpt-4 -- [`/forefront`](./forefront/README.md) - -#### gpt-3.5 -- [`/you`](./you/README.md) - -## Install -Download or clone this GitHub repo -install requirements with: -```sh -pip3 install -r requirements.txt -``` - -## To start gpt4free GUI -Move `streamlit_app.py` from `./gui` to the base folder -then run: -`streamlit run streamlit_app.py` or `python3 -m streamlit run streamlit_app.py` - -## Docker -Build -``` -docker build -t gpt4free:latest -f Docker/Dockerfile . -``` -Run -``` -docker run -p 8501:8501 gpt4free:latest -``` - -## ChatGPT clone -> currently implementing new features and trying to scale it, please be patient it may be unstable -> https://chat.chatbot.sex/chat -> This site was developed by me and includes **gpt-4/3.5**, **internet access** and **gpt-jailbreak's** like DAN -> run locally here: https://github.com/xtekky/chatgpt-clone - -## Copyright: -This program is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt) - -Most code, with the exception of `quora/api.py` (by [ading2210](https://github.com/ading2210)), has been written by me, [xtekky](https://github.com/xtekky). - -### Copyright Notice: -``` -xtekky/openai-gpt4: multiple reverse engineered language-model api's to decentralise the ai industry. -Copyright (C) 2023 xtekky - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -``` - -## Star History -[![Star History Chart](https://api.star-history.com/svg?repos=xtekky/gpt4free&type=Date)](https://star-history.com/#xtekky/gpt4free) diff --git a/README.md b/README.md index f38fe2bb..5980351d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ We got a takedown request by openAI's legal team... -you may refer to the old readme: [OLDREADME.md](./OLDREADME.md) - discord server for updates / support: - https://discord.gg/gpt4free @@ -56,4 +54,135 @@ Till the long bitter end, will this boy live to fight. ( I did not write it ) +_____________________________ + +# GPT4free - use ChatGPT, for free!! + +##### You may join our discord server for updates and support ; ) +- [Discord Link](https://discord.gg/gpt4free) + +image + +Just API's from some language model sites. + +## Legal Notice + +This repository uses third-party APIs and is *not* associated with or endorsed by the API providers. This project is intended **for educational purposes only**. This is just a little personal project. Sites may contact me to improve their security. + +Please note the following: + +1. **Disclaimer**: The APIs, services, and trademarks mentioned in this repository belong to their respective owners. This project is *not* claiming any right over them. + +2. **Responsibility**: The author of this repository is *not* responsible for any consequences arising from the use or misuse of this repository or the content provided by the third-party APIs and any damage or losses caused by users' actions. + +3. **Educational Purposes Only**: This repository and its content are provided strictly for educational purposes. By using the information and code provided, users acknowledge that they are using the APIs and models at their own risk and agree to comply with any applicable laws and regulations. + + +## Table of Contents +| Section | Description | Link | Status | +| ------- | ----------- | ---- | ------ | +| **To do list** | List of tasks to be done | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#todo) | - | +| **Current Sites** | Current websites or platforms that can be used as APIs | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#current-sites) | - | +| **Best Sites for gpt4** | Recommended websites or platforms for gpt4 | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#best-sites) | - | +| **Streamlit GPT4Free GUI** | Web-based graphical user interface for interacting with gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#streamlit-gpt4free-gui) | - | +| **Docker** | Instructions on how to run gpt4free in a Docker container | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#docker-instructions) | - | +| **ChatGPT clone** | A ChatGPT clone with new features and scalability | [![Link to Website](https://img.shields.io/badge/Link-Visit%20Site-blue)](https://chat.chatbot.sex/chat) | - | +| **How to install** | Instructions on how to install gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#install) | - | +| **Legal Notice** | Legal notice or disclaimer | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#legal-notice) | - | +| **Copyright** | Copyright information | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#copyright) | - | +| **Star History** | Star History | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#star-history) | - | +| **Usage Examples** | | | | +| `theb` | Example usage for theb (gpt-3.5) | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./theb/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | +| `forefront` | Example usage for forefront (gpt-4) | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./forefront/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | || +| `quora (poe)` | Example usage for quora | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./quora/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | +| `you` | Example usage for you | [![Link to File](https://img.shields.io/badge/Link-Go%20to%20File-blue)](./you/README.md) | ![Active](https://img.shields.io/badge/Active-brightgreen) | +| **Try it Out** | | | | +| Google Colab Jupyter Notebook | Example usage for gpt4free | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DanielShemesh/gpt4free-colab/blob/main/gpt4free.ipynb) | - | +| replit Example (feel free to fork this repl) | Example usage for gpt4free | [![](https://img.shields.io/badge/Open%20in-Replit-1A1E27?logo=replit)](https://replit.com/@gpt4free/gpt4free-webui) | - | + + +## Todo + +- [ ] Add a GUI for the repo +- [ ] Make a general package named `gpt4free`, instead of different folders +- [ ] Live api status to know which are down and which can be used +- [ ] Integrate more API's in `./unfinished` as well as other ones in the lists +- [ ] Make an API to use as proxy for other projects +- [ ] Make a pypi package + +## Current Sites + +| Website s | Model(s) | +| ---------------------------------------------------- | ------------------------------- | +| [forefront.ai](https://chat.forefront.ai) | GPT-4/3.5 | +| [poe.com](https://poe.com) | GPT-4/3.5 | +| [writesonic.com](https://writesonic.com) | GPT-3.5 / Internet | +| [t3nsor.com](https://t3nsor.com) | GPT-3.5 | +| [you.com](https://you.com) | GPT-3.5 / Internet / good search| +| [sqlchat.ai](https://sqlchat.ai) | GPT-3.5 | +| [bard.google.com](https://bard.google.com) | custom / search | +| [bing.com/chat](https://bing.com/chat) | GPT-4/3.5 | +| [chat.forefront.ai/](https://chat.forefront.ai/) | GPT-4/3.5 | + +## Best sites + +#### gpt-4 +- [`/forefront`](./forefront/README.md) + +#### gpt-3.5 +- [`/you`](./you/README.md) + +## Install +Download or clone this GitHub repo +install requirements with: +```sh +pip3 install -r requirements.txt +``` + +## To start gpt4free GUI +Move `streamlit_app.py` from `./gui` to the base folder +then run: +`streamlit run streamlit_app.py` or `python3 -m streamlit run streamlit_app.py` + +## Docker +Build +``` +docker build -t gpt4free:latest -f Docker/Dockerfile . +``` +Run +``` +docker run -p 8501:8501 gpt4free:latest +``` + +## ChatGPT clone +> currently implementing new features and trying to scale it, please be patient it may be unstable +> https://chat.chatbot.sex/chat +> This site was developed by me and includes **gpt-4/3.5**, **internet access** and **gpt-jailbreak's** like DAN +> run locally here: https://github.com/xtekky/chatgpt-clone + +## Copyright: +This program is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt) + +Most code, with the exception of `quora/api.py` (by [ading2210](https://github.com/ading2210)), has been written by me, [xtekky](https://github.com/xtekky). + +### Copyright Notice: +``` +xtekky/gpt4free: multiple reverse engineered language-model api's to decentralise the ai industry. +Copyright (C) 2023 xtekky + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +``` +## Star History +[![Star History Chart](https://api.star-history.com/svg?repos=xtekky/gpt4free&type=Date)](https://star-history.com/#xtekky/gpt4free) diff --git a/openaihosted/__init__.py b/openaihosted/__init__.py deleted file mode 100644 index 4f25a2be..00000000 --- a/openaihosted/__init__.py +++ /dev/null @@ -1,62 +0,0 @@ -import json -import re -import requests - - -class Completion: - @staticmethod - def create(messages): - headers = { - "authority": "openai.a2hosted.com", - "accept": "text/event-stream", - "accept-language": "en-US,en;q=0.9,id;q=0.8,ja;q=0.7", - "cache-control": "no-cache", - "sec-fetch-dest": "empty", - "sec-fetch-mode": "cors", - "sec-fetch-site": "cross-site", - "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0", - } - - query_param = Completion.__create_query_param(messages) - url = f"https://openai.a2hosted.com/chat?q={query_param}" - request = requests.get(url, headers=headers, stream=True) - if request.status_code != 200: - return Completion.__get_failure_response() - - content = request.content - response = Completion.__join_response(content) - - return {"responses": response} - - @classmethod - def __get_failure_response(cls) -> dict: - return dict( - response="Unable to fetch the response, Please try again.", - links=[], - extra={}, - ) - - @classmethod - def __multiple_replace(cls, string, reps) -> str: - for original, replacement in reps.items(): - string = string.replace(original, replacement) - return string - - @classmethod - def __create_query_param(cls, conversation) -> str: - encoded_conversation = json.dumps(conversation) - replacement = {" ": "%20", '"': "%22", "'": "%27"} - return Completion.__multiple_replace(encoded_conversation, replacement) - - @classmethod - def __convert_escape_codes(cls, text) -> str: - replacement = {'\\\\"': '"', '\\"': '"', "\\n": "\n", "\\'": "'"} - return Completion.__multiple_replace(text, replacement) - - @classmethod - def __join_response(cls, data) -> str: - data = data.decode("utf-8") - find_ans = re.findall(r'(?<={"msg":)[^}]*', str(data)) - ans = [Completion.__convert_escape_codes(x[1:-1]) for x in find_ans] - response = "".join(ans) - return response diff --git a/openaihosted/readme.md b/openaihosted/readme.md deleted file mode 100644 index 7b8ced56..00000000 --- a/openaihosted/readme.md +++ /dev/null @@ -1,18 +0,0 @@ -### Example: `openaihosted` (use like openai pypi package) - -```python -import openaihosted - -messages = [{"role": "system", "content": "You are a helpful assistant."}] -while True: - question = input("Question: ") - if question == "!stop": - break - - messages.append({"role": "user", "content": question}) - request = openaihosted.Completion.create(messages=messages) - - response = request["responses"] - messages.append({"role": "assistant", "content": response}) - print(f"Answer: {response}") -``` -- cgit v1.2.3