From 99d36a77530eae8585baa777d628f8bb134bec40 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Sun, 23 Apr 2023 16:53:18 +0100 Subject: Update ora_gpt4.py --- testing/ora_gpt4.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/testing/ora_gpt4.py b/testing/ora_gpt4.py index 1191d0ad..ab1fbf96 100644 --- a/testing/ora_gpt4.py +++ b/testing/ora_gpt4.py @@ -25,3 +25,16 @@ model = ora.CompletionModel.load(chatbot_id, 'gpt-4') response = ora.Completion.create(model, 'hello') print(response.completion.choices[0].text) +conversation_id = response.id + +while True: + # pass in conversationId to continue conversation + + prompt = input('>>> ') + response = ora.Completion.create( + model = model, + prompt = prompt, + includeHistory = True, # remember history + conversationId = conversation_id) + + print(response.completion.choices[0].text) \ No newline at end of file -- cgit v1.2.3 From 20af89c0c29abc63ef5e84e669fd4ef14998de40 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Sun, 23 Apr 2023 17:57:39 +0100 Subject: phind, user_agent and cf_clearance param for cloudflare bypass --- phind/README.md | 1 + phind/__init__.py | 20 ++++++++++++++------ phind/phind_test.py | 32 ++++++++++++++++++++++++++++++++ testing/phind_test.py | 31 ------------------------------- 4 files changed, 47 insertions(+), 37 deletions(-) create mode 100644 phind/phind_test.py delete mode 100644 testing/phind_test.py diff --git a/phind/README.md b/phind/README.md index c9b85dbb..f17f487f 100644 --- a/phind/README.md +++ b/phind/README.md @@ -5,6 +5,7 @@ import phind # set cf_clearance cookie phind.cf_clearance = 'xx.xx-1682166681-0-160' +phind.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' # same as the one from browser you got cf_clearance from prompt = 'who won the quatar world cup' diff --git a/phind/__init__.py b/phind/__init__.py index 8bae9f17..629befa5 100644 --- a/phind/__init__.py +++ b/phind/__init__.py @@ -8,6 +8,7 @@ from re import findall from curl_cffi.requests import post cf_clearance = '' +user_agent = '' class PhindResponse: @@ -52,6 +53,9 @@ class PhindResponse: class Search: def create(prompt: str, actualSearch: bool = True, language: str = 'en') -> dict: # None = no search + if user_agent == '': + raise ValueError('user_agent must be set, refer to documentation') + if not actualSearch: return { '_type': 'SearchResponse', @@ -83,7 +87,7 @@ class Search: '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', + 'user-agent': user_agent } return post('https://www.phind.com/api/bing/search', headers = headers, json = { @@ -102,6 +106,9 @@ class Completion: codeContext: str = '', language: str = 'en') -> PhindResponse: + if user_agent == '': + raise ValueError('user_agent must be set, refer to documentation') + if results is None: results = Search.create(prompt, actualSearch = True) @@ -141,7 +148,7 @@ class Completion: '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', + 'user-agent': user_agent } completion = '' @@ -192,9 +199,7 @@ class StreamingCompletion: 'creative': creative } } - - print(cf_clearance) - + headers = { 'authority': 'www.phind.com', 'accept': '*/*', @@ -209,7 +214,7 @@ class StreamingCompletion: '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', + 'user-agent': user_agent } response = post('https://www.phind.com/api/infer/answer', @@ -228,6 +233,9 @@ class StreamingCompletion: codeContext : str = '', language : str = 'en'): + if user_agent == '': + raise ValueError('user_agent must be set, refer to documentation') + if results is None: results = Search.create(prompt, actualSearch = True) diff --git a/phind/phind_test.py b/phind/phind_test.py new file mode 100644 index 00000000..94354fd8 --- /dev/null +++ b/phind/phind_test.py @@ -0,0 +1,32 @@ +import phind + +# set cf_clearance cookie +phind.cf_clearance = 'heguhSRBB9d0sjLvGbQECS8b80m2BQ31xEmk9ChshKI-1682268995-0-160' +phind.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' + +prompt = 'hello world' + +# normal completion +result = phind.Completion.create( + model = 'gpt-4', + prompt = prompt, + results = phind.Search.create(prompt, actualSearch = False), # create search (set actualSearch to False to disable internet) + creative = False, + detailed = False, + codeContext = '') # up to 3000 chars of code + +print(result.completion.choices[0].text) + +prompt = 'who won the quatar world cup' + +# help needed: not getting newlines from the stream, please submit a PR if you know how to fix this +# stream completion +for result in phind.StreamingCompletion.create( + model = 'gpt-3.5', + prompt = prompt, + results = phind.Search.create(prompt, actualSearch = True), # create search (set actualSearch to False to disable internet) + creative = False, + detailed = False, + codeContext = ''): # up to 3000 chars of code + + print(result.completion.choices[0].text, end='', flush=True) \ No newline at end of file diff --git a/testing/phind_test.py b/testing/phind_test.py deleted file mode 100644 index 3e9217e1..00000000 --- a/testing/phind_test.py +++ /dev/null @@ -1,31 +0,0 @@ -import phind - -# set cf_clearance cookie -phind.cf_clearance = 'hWfIdYKgcnxnU5ayolWe9t7eEmAbULywS.qfHkm1T_A-1682166681-0-160' - -prompt = 'hello world' - -# normal completion -result = phind.Completion.create( - model = 'gpt-4', - prompt = prompt, - results = phind.Search.create(prompt, actualSearch = False), # create search (set actualSearch to False to disable internet) - creative = False, - detailed = False, - codeContext = '') # up to 3000 chars of code - -print(result.completion.choices[0].text) - -prompt = 'who won the quatar world cup' - -# help needed: not getting newlines from the stream, please submit a PR if you know how to fix this -# stream completion -for result in phind.StreamingCompletion.create( - model = 'gpt-3.5', - prompt = prompt, - results = phind.Search.create(prompt, actualSearch = True), # create search (set actualSearch to False to disable internet) - creative = False, - detailed = False, - codeContext = ''): # up to 3000 chars of code - - print(result.completion.choices[0].text, end='', flush=True) \ No newline at end of file -- cgit v1.2.3 From a9d4b38a7e5352a662f81f0956b6d960ea59269a Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Mon, 24 Apr 2023 02:24:50 +0900 Subject: Update README.md github -> GitHub --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bc18fbe..e401ac26 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ By the way, thank you so much for `2k` stars and all the support !! - why ? its not sure if they use gpt, but rather claude but they have an amazing search and good reasoning model ## Install -- download or clone this github repo +- download or clone this GitHub repo install requirements with: ```sh -- cgit v1.2.3 From 027cc87505f0f324883d2a946c1a967a8c901c5e Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Sun, 23 Apr 2023 19:08:50 +0100 Subject: to do list --- README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e401ac26..154d7297 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,10 @@ Have you ever come across some amazing projects that you couldnt use **just beca By the way, thank you so much for `2k` stars and all the support !! -## Chatgpt clone -> 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 - ## Table of Contents +- [To do list](#todo) - [Current Sites](#current-sites) - [Best Sites for gpt4](#best-sites) - [How to intall](#install) @@ -31,6 +27,15 @@ By the way, thank you so much for `2k` stars and all the support !! - [`writesonic`](./writesonic/README.md) - [`you`](./you/README.md) - [`sqlchat`](./sqlchat/README.md) + +## Todo + +- [ ] add a GUI for the repo +- [ ] make a general package like `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` aswell as other ones in the lists +- [ ] make an api to use as proxy for other projects +- [ ] make a pypi package ## Current Sites @@ -70,6 +75,12 @@ install requirements with: pip3 install -r requirements.txt ``` +## 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 + ## 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**. -- cgit v1.2.3 From 5f93e91c35467cd72b2f9c6c1d1b76482e4d3d26 Mon Sep 17 00:00:00 2001 From: Will H <76015073+Whoffie@users.noreply.github.com> Date: Sun, 23 Apr 2023 19:25:28 -0500 Subject: Grammar suggestions in README --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 154d7297..c95399f0 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# Gpt4free - use chatgpt, for free !! +# GPT4free - use ChatGPT, for free!! image -Have you ever come across some amazing projects that you couldnt use **just because you didn't have an OpenAI API key ?** +Have you ever come across some amazing projects that you couldnt use **just because you didn't have an OpenAI API key?** -**We've got u 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 ; ). +**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 `2k` stars and all the support !! +By the way, thank you so much for `2k` stars and all the support!! ## Table of Contents @@ -75,7 +75,7 @@ install requirements with: pip3 install -r requirements.txt ``` -## Chatgpt clone +## 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 -- cgit v1.2.3 From da890d8599c5ed4a66f46bb959b468c7ad748415 Mon Sep 17 00:00:00 2001 From: Rupesh Sreeraman Date: Mon, 24 Apr 2023 21:22:44 +0530 Subject: Added GUI --- README.md | 3 +++ requirements.txt | 3 ++- streamlit_app.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 streamlit_app.py diff --git a/README.md b/README.md index c95399f0..4de0bd98 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,9 @@ install requirements with: ```sh pip3 install -r requirements.txt ``` +## To start gpt4free GUI +To start gpt4free GUI run the following command : +`streamlit run streamlit_app.py` ## ChatGPT clone > currently implementing new features and trying to scale it, please be patient it may be unstable diff --git a/requirements.txt b/requirements.txt index f9d6351a..eb2ac24c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ tls-client pypasser names colorama -curl_cffi \ No newline at end of file +curl_cffi +streamlit==1.21.0 \ No newline at end of file diff --git a/streamlit_app.py b/streamlit_app.py new file mode 100644 index 00000000..97bdf694 --- /dev/null +++ b/streamlit_app.py @@ -0,0 +1,43 @@ +import streamlit as st +import phind + +def phind_get_answer(question:str)->str: + # set cf_clearance cookie + phind.cf_clearance = 'heguhSRBB9d0sjLvGbQECS8b80m2BQ31xEmk9ChshKI-1682268995-0-160' + phind.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' + result = phind.Completion.create( + model = 'gpt-4', + prompt = question, + results = phind.Search.create(question, actualSearch = True), + creative = False, + detailed = False, + codeContext = '') + return result.completion.choices[0].text + + +st.set_page_config( + page_title="gpt4freeGUI", + initial_sidebar_state="expanded", + page_icon="🧠", + menu_items={ + 'Get Help': 'https://github.com/xtekky/gpt4free/blob/main/README.md', + 'Report a bug': "https://github.com/xtekky/gpt4free/issues", + 'About': "### gptfree GUI" + } +) + +st.header('GPT4free GUI') + +question_text_area = st.text_area('🤖 Ask Any Question :', placeholder='Explain quantum computing in 50 words') +if st.button('🧠 Think'): + answer = phind_get_answer(question_text_area) + st.caption("Answer :") + st.markdown(answer) + + +hide_streamlit_style = """ + + """ +st.markdown(hide_streamlit_style, unsafe_allow_html=True) \ No newline at end of file -- cgit v1.2.3 From e430481aa7a074dfebd4f682f2403f84d317e937 Mon Sep 17 00:00:00 2001 From: Ricardo Zapata Date: Mon, 24 Apr 2023 09:54:21 -0600 Subject: Spelling correction In line 17 the word "install" was missing the "s"! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c95399f0..d7f825d3 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ By the way, thank you so much for `2k` stars and all the support!! - [To do list](#todo) - [Current Sites](#current-sites) - [Best Sites for gpt4](#best-sites) -- [How to intall](#install) +- [How to install](#install) - [Legal Notice](#legal-notice) - [Copyright](#copyright) -- cgit v1.2.3 From 78662c779a76c5fd826205ed7028115269fd3501 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Mon, 24 Apr 2023 18:59:42 +0100 Subject: ora userid and session token for gpt-4 --- README.md | 1 + ora/README.md | 5 +++++ ora/__init__.py | 16 ++++++++++++---- testing/ora_gpt4.py | 43 ++++++++++++++++++++++++------------------- 4 files changed, 42 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index c95399f0..72f35354 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ By the way, thank you so much for `2k` stars and all the support!! - [`/ora`](./ora/README.md) - here is proof / test: [`ora_gpt4_proof.py`](./testing/ora_gpt4_proof.py) - why ?, no streaming compared to poe.com but u can send more than 1 message +- update: you need to use session token now and there is a limit, accounts are only google so no creator for now #### gpt-3.5 - [`/sqlchat`](./sqlchat/README.md) diff --git a/ora/README.md b/ora/README.md index b4ae0878..fb9f5974 100644 --- a/ora/README.md +++ b/ora/README.md @@ -5,6 +5,10 @@ more gpt4 models in `/testing/ora_gpt4.py` ```python +# if using CompletionModel.load set these +ora.user_id = '...' +ora.session_token = '...' + # normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5 ``` @@ -14,6 +18,7 @@ model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5 # import ora import ora + # create model model = ora.CompletionModel.create( system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible', diff --git a/ora/__init__.py b/ora/__init__.py index b6389f64..36e14cd5 100644 --- a/ora/__init__.py +++ b/ora/__init__.py @@ -4,18 +4,23 @@ from requests import post from time import time from random import randint +user_id = None +session_token = None + class Completion: def create( model : CompletionModel, prompt: str, includeHistory: bool = True, conversationId: str or None = None) -> OraResponse: - extra = { 'conversationId': conversationId} if conversationId else {} - response = post('https://ora.sh/api/conversation', - headers = { + cookies = { + "cookie" : f"__Secure-next-auth.session-token={session_token}"} if session_token else {} + + response = post('https://ora.sh/api/conversation', + headers = cookies | { "host" : "ora.sh", "authorization" : f"Bearer AY0{randint(1111, 9999)}", "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", @@ -25,10 +30,13 @@ class Completion: json = extra | { 'chatbotId': model.id, 'input' : prompt, - 'userId' : model.createdBy, + 'userId' : user_id if user_id else model.createdBy, 'model' : model.modelName, 'provider' : 'OPEN_AI', 'includeHistory': includeHistory}).json() + + if response.get('error'): + raise Exception('''set ora.user_id and ora.session_token\napi response: %s''' % response['error']) return OraResponse({ 'id' : response['conversationId'], diff --git a/testing/ora_gpt4.py b/testing/ora_gpt4.py index ab1fbf96..41f20876 100644 --- a/testing/ora_gpt4.py +++ b/testing/ora_gpt4.py @@ -1,27 +1,12 @@ import ora -# 1 normal -# 2 solidity contract helper -# 3 swift project helper -# 4 developer gpt -# 5 lawsuit bot for spam call -# 6 p5.js code help bot -# 8 AI professor, for controversial topics -# 9 HustleGPT, your entrepreneurial AI -# 10 midjourney prompts bot -# 11 AI philosophy professor -# 12 TypeScript and JavaScript code review bot -# 13 credit card transaction details to merchant and location bot -# 15 Chemical Compound Similarity and Purchase Tool bot -# 16 expert full-stack developer AI -# 17 Solana development bot -# 18 price guessing game bot -# 19 AI Ethicist and Philosopher +ora.user_id = '...' +ora.session_token = '...' gpt4_chatbot_ids = ['b8b12eaa-5d47-44d3-92a6-4d706f2bcacf', 'fbe53266-673c-4b70-9d2d-d247785ccd91', 'bd5781cf-727a-45e9-80fd-a3cfce1350c6', '993a0102-d397-47f6-98c3-2587f2c9ec3a', 'ae5c524e-d025-478b-ad46-8843a5745261', 'cc510743-e4ab-485e-9191-76960ecb6040', 'a5cd2481-8e24-4938-aa25-8e26d6233390', '6bca5930-2aa1-4bf4-96a7-bea4d32dcdac', '884a5f2b-47a2-47a5-9e0f-851bbe76b57c', 'd5f3c491-0e74-4ef7-bdca-b7d27c59e6b3', 'd72e83f6-ef4e-4702-844f-cf4bd432eef7', '6e80b170-11ed-4f1a-b992-fd04d7a9e78c', '8ef52d68-1b01-466f-bfbf-f25c13ff4a72', 'd0674e11-f22e-406b-98bc-c1ba8564f749', 'a051381d-6530-463f-be68-020afddf6a8f', '99c0afa1-9e32-4566-8909-f4ef9ac06226', '1be65282-9c59-4a96-99f8-d225059d9001', 'dba16bd8-5785-4248-a8e9-b5d1ecbfdd60', '1731450d-3226-42d0-b41c-4129fe009524', '8e74635d-000e-4819-ab2c-4e986b7a0f48', 'afe7ed01-c1ac-4129-9c71-2ca7f3800b30', 'e374c37a-8c44-4f0e-9e9f-1ad4609f24f5'] chatbot_id = gpt4_chatbot_ids[0] -model = ora.CompletionModel.load(chatbot_id, 'gpt-4') +model = ora.CompletionModel.load(chatbot_id, 'gpt-4') response = ora.Completion.create(model, 'hello') print(response.completion.choices[0].text) @@ -37,4 +22,24 @@ while True: includeHistory = True, # remember history conversationId = conversation_id) - print(response.completion.choices[0].text) \ No newline at end of file + print(response.completion.choices[0].text) + + +# bots : +# 1 normal +# 2 solidity contract helper +# 3 swift project helper +# 4 developer gpt +# 5 lawsuit bot for spam call +# 6 p5.js code help bot +# 8 AI professor, for controversial topics +# 9 HustleGPT, your entrepreneurial AI +# 10 midjourney prompts bot +# 11 AI philosophy professor +# 12 TypeScript and JavaScript code review bot +# 13 credit card transaction details to merchant and location bot +# 15 Chemical Compound Similarity and Purchase Tool bot +# 16 expert full-stack developer AI +# 17 Solana development bot +# 18 price guessing game bot +# 19 AI Ethicist and Philosopher \ No newline at end of file -- cgit v1.2.3 From 4f94ba1604acf0f845fdfd4fca3011bf2b7eebee Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Mon, 24 Apr 2023 19:26:27 +0100 Subject: userid and session_token --- ora/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ora/README.md b/ora/README.md index fb9f5974..36bc2806 100644 --- a/ora/README.md +++ b/ora/README.md @@ -4,6 +4,9 @@ more gpt4 models in `/testing/ora_gpt4.py` +find the userid by visiting https://ora.sh/api/auth/session ( must be logged in on the site ) +and session_token in the cookies, it should be: __Secure-next-auth.session-token + ```python # if using CompletionModel.load set these ora.user_id = '...' @@ -43,4 +46,4 @@ while True: conversationId = init.id) print(response.completion.choices[0].text) -``` \ No newline at end of file +``` -- cgit v1.2.3