Raju Komati commited on
Commit
98afd5b
·
unverified ·
2 Parent(s): 2c720f8 4f94ba1

Merge branch 'main' into fix/poe_account_creation

Browse files
README.md CHANGED
@@ -1,24 +1,20 @@
1
- # Gpt4free - use chatgpt, for free !!
2
 
3
  <img width="1383" alt="image" src="https://user-images.githubusercontent.com/98614666/233799515-1a7cb6a3-b17f-42c4-956d-8d2a0664466f.png">
4
 
5
- Have you ever come across some amazing projects that you couldnt use **just because you didn't have an OpenAI API key ?**
6
 
7
- **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 ; ).
8
 
9
- By the way, thank you so much for `2k` stars and all the support !!
10
-
11
- ## Chatgpt clone
12
- > https://chat.chatbot.sex/chat
13
- > This site was developed by me and includes **gpt-4/3.5**, **internet access** and **gpt-jailbreak's** like DAN
14
- > run locally here: https://github.com/xtekky/chatgpt-clone
15
 
16
 
17
  ## Table of Contents
18
 
 
19
  - [Current Sites](#current-sites)
20
  - [Best Sites for gpt4](#best-sites)
21
- - [How to intall](#install)
22
  - [Legal Notice](#legal-notice)
23
  - [Copyright](#copyright)
24
 
@@ -31,6 +27,15 @@ By the way, thank you so much for `2k` stars and all the support !!
31
  - [`writesonic`](./writesonic/README.md)
32
  - [`you`](./you/README.md)
33
  - [`sqlchat`](./sqlchat/README.md)
 
 
 
 
 
 
 
 
 
34
 
35
  ## Current Sites <a name="current-sites"></a>
36
 
@@ -53,6 +58,7 @@ By the way, thank you so much for `2k` stars and all the support !!
53
  - [`/ora`](./ora/README.md)
54
  - here is proof / test: [`ora_gpt4_proof.py`](./testing/ora_gpt4_proof.py)
55
  - why ?, no streaming compared to poe.com but u can send more than 1 message
 
56
 
57
  #### gpt-3.5
58
  - [`/sqlchat`](./sqlchat/README.md)
@@ -63,12 +69,21 @@ By the way, thank you so much for `2k` stars and all the support !!
63
  - why ? its not sure if they use gpt, but rather claude but they have an amazing search and good reasoning model
64
 
65
  ## Install <a name="install"></a>
66
- - download or clone this github repo
67
 
68
  install requirements with:
69
  ```sh
70
  pip3 install -r requirements.txt
71
  ```
 
 
 
 
 
 
 
 
 
72
 
73
  ## Legal Notice <a name="legal-notice"></a>
74
 
 
1
+ # GPT4free - use ChatGPT, for free!!
2
 
3
  <img width="1383" alt="image" src="https://user-images.githubusercontent.com/98614666/233799515-1a7cb6a3-b17f-42c4-956d-8d2a0664466f.png">
4
 
5
+ Have you ever come across some amazing projects that you couldnt use **just because you didn't have an OpenAI API key?**
6
 
7
+ **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 ; ).
8
 
9
+ By the way, thank you so much for `2k` stars and all the support!!
 
 
 
 
 
10
 
11
 
12
  ## Table of Contents
13
 
14
+ - [To do list](#todo)
15
  - [Current Sites](#current-sites)
16
  - [Best Sites for gpt4](#best-sites)
17
+ - [How to install](#install)
18
  - [Legal Notice](#legal-notice)
19
  - [Copyright](#copyright)
20
 
 
27
  - [`writesonic`](./writesonic/README.md)
28
  - [`you`](./you/README.md)
29
  - [`sqlchat`](./sqlchat/README.md)
30
+
31
+ ## Todo <a name="todo"></a>
32
+
33
+ - [ ] add a GUI for the repo
34
+ - [ ] make a general package like `openai_rev`, instead of different folders
35
+ - [ ] live api status to know which are down and which can be used
36
+ - [ ] integrate more api's in `./unfinished` aswell as other ones in the lists
37
+ - [ ] make an api to use as proxy for other projects
38
+ - [ ] make a pypi package
39
 
40
  ## Current Sites <a name="current-sites"></a>
41
 
 
58
  - [`/ora`](./ora/README.md)
59
  - here is proof / test: [`ora_gpt4_proof.py`](./testing/ora_gpt4_proof.py)
60
  - why ?, no streaming compared to poe.com but u can send more than 1 message
61
+ - update: you need to use session token now and there is a limit, accounts are only google so no creator for now
62
 
63
  #### gpt-3.5
64
  - [`/sqlchat`](./sqlchat/README.md)
 
69
  - why ? its not sure if they use gpt, but rather claude but they have an amazing search and good reasoning model
70
 
71
  ## Install <a name="install"></a>
72
+ - download or clone this GitHub repo
73
 
74
  install requirements with:
75
  ```sh
76
  pip3 install -r requirements.txt
77
  ```
78
+ ## To start gpt4free GUI
79
+ To start gpt4free GUI run the following command :
80
+ `streamlit run streamlit_app.py`
81
+
82
+ ## ChatGPT clone
83
+ > currently implementing new features and trying to scale it, please be patient it may be unstable
84
+ > https://chat.chatbot.sex/chat
85
+ > This site was developed by me and includes **gpt-4/3.5**, **internet access** and **gpt-jailbreak's** like DAN
86
+ > run locally here: https://github.com/xtekky/chatgpt-clone
87
 
88
  ## Legal Notice <a name="legal-notice"></a>
89
 
ora/README.md CHANGED
@@ -4,7 +4,14 @@
4
 
5
  more gpt4 models in `/testing/ora_gpt4.py`
6
 
 
 
 
7
  ```python
 
 
 
 
8
  # normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
9
  model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
10
  ```
@@ -14,6 +21,7 @@ model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
14
  # import ora
15
  import ora
16
 
 
17
  # create model
18
  model = ora.CompletionModel.create(
19
  system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
@@ -38,4 +46,4 @@ while True:
38
  conversationId = init.id)
39
 
40
  print(response.completion.choices[0].text)
41
- ```
 
4
 
5
  more gpt4 models in `/testing/ora_gpt4.py`
6
 
7
+ find the userid by visiting https://ora.sh/api/auth/session ( must be logged in on the site )
8
+ and session_token in the cookies, it should be: __Secure-next-auth.session-token
9
+
10
  ```python
11
+ # if using CompletionModel.load set these
12
+ ora.user_id = '...'
13
+ ora.session_token = '...'
14
+
15
  # normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
16
  model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
17
  ```
 
21
  # import ora
22
  import ora
23
 
24
+
25
  # create model
26
  model = ora.CompletionModel.create(
27
  system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
 
46
  conversationId = init.id)
47
 
48
  print(response.completion.choices[0].text)
49
+ ```
ora/__init__.py CHANGED
@@ -4,18 +4,23 @@ from requests import post
4
  from time import time
5
  from random import randint
6
 
 
 
 
7
  class Completion:
8
  def create(
9
  model : CompletionModel,
10
  prompt: str,
11
  includeHistory: bool = True,
12
  conversationId: str or None = None) -> OraResponse:
13
-
14
  extra = {
15
  'conversationId': conversationId} if conversationId else {}
16
 
17
- response = post('https://ora.sh/api/conversation',
18
- headers = {
 
 
 
19
  "host" : "ora.sh",
20
  "authorization" : f"Bearer AY0{randint(1111, 9999)}",
21
  "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:
25
  json = extra | {
26
  'chatbotId': model.id,
27
  'input' : prompt,
28
- 'userId' : model.createdBy,
29
  'model' : model.modelName,
30
  'provider' : 'OPEN_AI',
31
  'includeHistory': includeHistory}).json()
 
 
 
32
 
33
  return OraResponse({
34
  'id' : response['conversationId'],
 
4
  from time import time
5
  from random import randint
6
 
7
+ user_id = None
8
+ session_token = None
9
+
10
  class Completion:
11
  def create(
12
  model : CompletionModel,
13
  prompt: str,
14
  includeHistory: bool = True,
15
  conversationId: str or None = None) -> OraResponse:
 
16
  extra = {
17
  'conversationId': conversationId} if conversationId else {}
18
 
19
+ cookies = {
20
+ "cookie" : f"__Secure-next-auth.session-token={session_token}"} if session_token else {}
21
+
22
+ response = post('https://ora.sh/api/conversation',
23
+ headers = cookies | {
24
  "host" : "ora.sh",
25
  "authorization" : f"Bearer AY0{randint(1111, 9999)}",
26
  "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",
 
30
  json = extra | {
31
  'chatbotId': model.id,
32
  'input' : prompt,
33
+ 'userId' : user_id if user_id else model.createdBy,
34
  'model' : model.modelName,
35
  'provider' : 'OPEN_AI',
36
  'includeHistory': includeHistory}).json()
37
+
38
+ if response.get('error'):
39
+ raise Exception('''set ora.user_id and ora.session_token\napi response: %s''' % response['error'])
40
 
41
  return OraResponse({
42
  'id' : response['conversationId'],
phind/README.md CHANGED
@@ -5,6 +5,7 @@ import phind
5
 
6
  # set cf_clearance cookie
7
  phind.cf_clearance = 'xx.xx-1682166681-0-160'
 
8
 
9
  prompt = 'who won the quatar world cup'
10
 
 
5
 
6
  # set cf_clearance cookie
7
  phind.cf_clearance = 'xx.xx-1682166681-0-160'
8
+ 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
9
 
10
  prompt = 'who won the quatar world cup'
11
 
phind/__init__.py CHANGED
@@ -8,6 +8,7 @@ from re import findall
8
  from curl_cffi.requests import post
9
 
10
  cf_clearance = ''
 
11
 
12
  class PhindResponse:
13
 
@@ -52,6 +53,9 @@ class PhindResponse:
52
 
53
  class Search:
54
  def create(prompt: str, actualSearch: bool = True, language: str = 'en') -> dict: # None = no search
 
 
 
55
  if not actualSearch:
56
  return {
57
  '_type': 'SearchResponse',
@@ -83,7 +87,7 @@ class Search:
83
  'sec-fetch-dest': 'empty',
84
  'sec-fetch-mode': 'cors',
85
  'sec-fetch-site': 'same-origin',
86
- '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',
87
  }
88
 
89
  return post('https://www.phind.com/api/bing/search', headers = headers, json = {
@@ -102,6 +106,9 @@ class Completion:
102
  codeContext: str = '',
103
  language: str = 'en') -> PhindResponse:
104
 
 
 
 
105
  if results is None:
106
  results = Search.create(prompt, actualSearch = True)
107
 
@@ -141,7 +148,7 @@ class Completion:
141
  'sec-fetch-dest': 'empty',
142
  'sec-fetch-mode': 'cors',
143
  'sec-fetch-site': 'same-origin',
144
- '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',
145
  }
146
 
147
  completion = ''
@@ -192,9 +199,7 @@ class StreamingCompletion:
192
  'creative': creative
193
  }
194
  }
195
-
196
- print(cf_clearance)
197
-
198
  headers = {
199
  'authority': 'www.phind.com',
200
  'accept': '*/*',
@@ -209,7 +214,7 @@ class StreamingCompletion:
209
  'sec-fetch-dest': 'empty',
210
  'sec-fetch-mode': 'cors',
211
  'sec-fetch-site': 'same-origin',
212
- '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',
213
  }
214
 
215
  response = post('https://www.phind.com/api/infer/answer',
@@ -228,6 +233,9 @@ class StreamingCompletion:
228
  codeContext : str = '',
229
  language : str = 'en'):
230
 
 
 
 
231
  if results is None:
232
  results = Search.create(prompt, actualSearch = True)
233
 
 
8
  from curl_cffi.requests import post
9
 
10
  cf_clearance = ''
11
+ user_agent = ''
12
 
13
  class PhindResponse:
14
 
 
53
 
54
  class Search:
55
  def create(prompt: str, actualSearch: bool = True, language: str = 'en') -> dict: # None = no search
56
+ if user_agent == '':
57
+ raise ValueError('user_agent must be set, refer to documentation')
58
+
59
  if not actualSearch:
60
  return {
61
  '_type': 'SearchResponse',
 
87
  'sec-fetch-dest': 'empty',
88
  'sec-fetch-mode': 'cors',
89
  'sec-fetch-site': 'same-origin',
90
+ 'user-agent': user_agent
91
  }
92
 
93
  return post('https://www.phind.com/api/bing/search', headers = headers, json = {
 
106
  codeContext: str = '',
107
  language: str = 'en') -> PhindResponse:
108
 
109
+ if user_agent == '':
110
+ raise ValueError('user_agent must be set, refer to documentation')
111
+
112
  if results is None:
113
  results = Search.create(prompt, actualSearch = True)
114
 
 
148
  'sec-fetch-dest': 'empty',
149
  'sec-fetch-mode': 'cors',
150
  'sec-fetch-site': 'same-origin',
151
+ 'user-agent': user_agent
152
  }
153
 
154
  completion = ''
 
199
  'creative': creative
200
  }
201
  }
202
+
 
 
203
  headers = {
204
  'authority': 'www.phind.com',
205
  'accept': '*/*',
 
214
  'sec-fetch-dest': 'empty',
215
  'sec-fetch-mode': 'cors',
216
  'sec-fetch-site': 'same-origin',
217
+ 'user-agent': user_agent
218
  }
219
 
220
  response = post('https://www.phind.com/api/infer/answer',
 
233
  codeContext : str = '',
234
  language : str = 'en'):
235
 
236
+ if user_agent == '':
237
+ raise ValueError('user_agent must be set, refer to documentation')
238
+
239
  if results is None:
240
  results = Search.create(prompt, actualSearch = True)
241
 
{testing → phind}/phind_test.py RENAMED
@@ -1,7 +1,8 @@
1
  import phind
2
 
3
  # set cf_clearance cookie
4
- phind.cf_clearance = 'hWfIdYKgcnxnU5ayolWe9t7eEmAbULywS.qfHkm1T_A-1682166681-0-160'
 
5
 
6
  prompt = 'hello world'
7
 
 
1
  import phind
2
 
3
  # set cf_clearance cookie
4
+ phind.cf_clearance = 'heguhSRBB9d0sjLvGbQECS8b80m2BQ31xEmk9ChshKI-1682268995-0-160'
5
+ 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'
6
 
7
  prompt = 'hello world'
8
 
requirements.txt CHANGED
@@ -5,5 +5,6 @@ pypasser
5
  names
6
  colorama
7
  curl_cffi
 
8
  selenium
9
  fake-useragent
 
5
  names
6
  colorama
7
  curl_cffi
8
+ streamlit==1.21.0
9
  selenium
10
  fake-useragent
streamlit_app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import phind
3
+
4
+ def phind_get_answer(question:str)->str:
5
+ # set cf_clearance cookie
6
+ phind.cf_clearance = 'heguhSRBB9d0sjLvGbQECS8b80m2BQ31xEmk9ChshKI-1682268995-0-160'
7
+ 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'
8
+ result = phind.Completion.create(
9
+ model = 'gpt-4',
10
+ prompt = question,
11
+ results = phind.Search.create(question, actualSearch = True),
12
+ creative = False,
13
+ detailed = False,
14
+ codeContext = '')
15
+ return result.completion.choices[0].text
16
+
17
+
18
+ st.set_page_config(
19
+ page_title="gpt4freeGUI",
20
+ initial_sidebar_state="expanded",
21
+ page_icon="🧠",
22
+ menu_items={
23
+ 'Get Help': 'https://github.com/xtekky/gpt4free/blob/main/README.md',
24
+ 'Report a bug': "https://github.com/xtekky/gpt4free/issues",
25
+ 'About': "### gptfree GUI"
26
+ }
27
+ )
28
+
29
+ st.header('GPT4free GUI')
30
+
31
+ question_text_area = st.text_area('🤖 Ask Any Question :', placeholder='Explain quantum computing in 50 words')
32
+ if st.button('🧠 Think'):
33
+ answer = phind_get_answer(question_text_area)
34
+ st.caption("Answer :")
35
+ st.markdown(answer)
36
+
37
+
38
+ hide_streamlit_style = """
39
+ <style>
40
+ footer {visibility: hidden;}
41
+ </style>
42
+ """
43
+ st.markdown(hide_streamlit_style, unsafe_allow_html=True)
testing/ora_gpt4.py CHANGED
@@ -1,5 +1,31 @@
1
  import ora
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  # 1 normal
4
  # 2 solidity contract helper
5
  # 3 swift project helper
@@ -16,12 +42,4 @@ import ora
16
  # 16 expert full-stack developer AI
17
  # 17 Solana development bot
18
  # 18 price guessing game bot
19
- # 19 AI Ethicist and Philosopher
20
-
21
- 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']
22
- chatbot_id = gpt4_chatbot_ids[0]
23
-
24
- model = ora.CompletionModel.load(chatbot_id, 'gpt-4')
25
- response = ora.Completion.create(model, 'hello')
26
-
27
- print(response.completion.choices[0].text)
 
1
  import ora
2
 
3
+ ora.user_id = '...'
4
+ ora.session_token = '...'
5
+
6
+ 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']
7
+ chatbot_id = gpt4_chatbot_ids[0]
8
+
9
+ model = ora.CompletionModel.load(chatbot_id, 'gpt-4')
10
+ response = ora.Completion.create(model, 'hello')
11
+
12
+ print(response.completion.choices[0].text)
13
+ conversation_id = response.id
14
+
15
+ while True:
16
+ # pass in conversationId to continue conversation
17
+
18
+ prompt = input('>>> ')
19
+ response = ora.Completion.create(
20
+ model = model,
21
+ prompt = prompt,
22
+ includeHistory = True, # remember history
23
+ conversationId = conversation_id)
24
+
25
+ print(response.completion.choices[0].text)
26
+
27
+
28
+ # bots :
29
  # 1 normal
30
  # 2 solidity contract helper
31
  # 3 swift project helper
 
42
  # 16 expert full-stack developer AI
43
  # 17 Solana development bot
44
  # 18 price guessing game bot
45
+ # 19 AI Ethicist and Philosopher