Skip to content

Commit 98afd5b

Browse files
committed
Merge branch 'main' into fix/poe_account_creation
2 parents 2c720f8 + 4f94ba1 commit 98afd5b

9 files changed

+135
-32
lines changed

README.md

+26-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
# Gpt4free - use chatgpt, for free !!
1+
# GPT4free - use ChatGPT, for free!!
22

33
<img width="1383" alt="image" src="https://user-images.githubusercontent.com/98614666/233799515-1a7cb6a3-b17f-42c4-956d-8d2a0664466f.png">
44

5-
Have you ever come across some amazing projects that you couldnt use **just because you didn't have an OpenAI API key ?**
5+
Have you ever come across some amazing projects that you couldnt use **just because you didn't have an OpenAI API key?**
66

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 ; ).
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 ; ).
88

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
9+
By the way, thank you so much for `2k` stars and all the support!!
1510

1611

1712
## Table of Contents
1813

14+
- [To do list](#todo)
1915
- [Current Sites](#current-sites)
2016
- [Best Sites for gpt4](#best-sites)
21-
- [How to intall](#install)
17+
- [How to install](#install)
2218
- [Legal Notice](#legal-notice)
2319
- [Copyright](#copyright)
2420

@@ -31,6 +27,15 @@ By the way, thank you so much for `2k` stars and all the support !!
3127
- [`writesonic`](./writesonic/README.md)
3228
- [`you`](./you/README.md)
3329
- [`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
3439

3540
## Current Sites <a name="current-sites"></a>
3641

@@ -53,6 +58,7 @@ By the way, thank you so much for `2k` stars and all the support !!
5358
- [`/ora`](./ora/README.md)
5459
- here is proof / test: [`ora_gpt4_proof.py`](./testing/ora_gpt4_proof.py)
5560
- 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
5662

5763
#### gpt-3.5
5864
- [`/sqlchat`](./sqlchat/README.md)
@@ -63,12 +69,21 @@ By the way, thank you so much for `2k` stars and all the support !!
6369
- why ? its not sure if they use gpt, but rather claude but they have an amazing search and good reasoning model
6470

6571
## Install <a name="install"></a>
66-
- download or clone this github repo
72+
- download or clone this GitHub repo
6773

6874
install requirements with:
6975
```sh
7076
pip3 install -r requirements.txt
7177
```
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
7287
7388
## Legal Notice <a name="legal-notice"></a>
7489

ora/README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44

55
more gpt4 models in `/testing/ora_gpt4.py`
66

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+
710
```python
11+
# if using CompletionModel.load set these
12+
ora.user_id = '...'
13+
ora.session_token = '...'
14+
815
# normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
916
model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
1017
```
@@ -14,6 +21,7 @@ model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
1421
# import ora
1522
import ora
1623

24+
1725
# create model
1826
model = ora.CompletionModel.create(
1927
system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
@@ -38,4 +46,4 @@ while True:
3846
conversationId = init.id)
3947

4048
print(response.completion.choices[0].text)
41-
```
49+
```

ora/__init__.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@
44
from time import time
55
from random import randint
66

7+
user_id = None
8+
session_token = None
9+
710
class Completion:
811
def create(
912
model : CompletionModel,
1013
prompt: str,
1114
includeHistory: bool = True,
1215
conversationId: str or None = None) -> OraResponse:
13-
1416
extra = {
1517
'conversationId': conversationId} if conversationId else {}
1618

17-
response = post('https://ora.sh/api/conversation',
18-
headers = {
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 | {
1924
"host" : "ora.sh",
2025
"authorization" : f"Bearer AY0{randint(1111, 9999)}",
2126
"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 @@ def create(
2530
json = extra | {
2631
'chatbotId': model.id,
2732
'input' : prompt,
28-
'userId' : model.createdBy,
33+
'userId' : user_id if user_id else model.createdBy,
2934
'model' : model.modelName,
3035
'provider' : 'OPEN_AI',
3136
'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'])
3240

3341
return OraResponse({
3442
'id' : response['conversationId'],

phind/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import phind
55

66
# set cf_clearance cookie
77
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
89

910
prompt = 'who won the quatar world cup'
1011

phind/__init__.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from curl_cffi.requests import post
99

1010
cf_clearance = ''
11+
user_agent = ''
1112

1213
class PhindResponse:
1314

@@ -52,6 +53,9 @@ def json(self) -> dict:
5253

5354
class Search:
5455
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+
5559
if not actualSearch:
5660
return {
5761
'_type': 'SearchResponse',
@@ -83,7 +87,7 @@ def create(prompt: str, actualSearch: bool = True, language: str = 'en') -> dict
8387
'sec-fetch-dest': 'empty',
8488
'sec-fetch-mode': 'cors',
8589
'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',
90+
'user-agent': user_agent
8791
}
8892

8993
return post('https://www.phind.com/api/bing/search', headers = headers, json = {
@@ -102,6 +106,9 @@ def create(
102106
codeContext: str = '',
103107
language: str = 'en') -> PhindResponse:
104108

109+
if user_agent == '':
110+
raise ValueError('user_agent must be set, refer to documentation')
111+
105112
if results is None:
106113
results = Search.create(prompt, actualSearch = True)
107114

@@ -141,7 +148,7 @@ def create(
141148
'sec-fetch-dest': 'empty',
142149
'sec-fetch-mode': 'cors',
143150
'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',
151+
'user-agent': user_agent
145152
}
146153

147154
completion = ''
@@ -192,9 +199,7 @@ def request(model, prompt, results, creative, detailed, codeContext, language) -
192199
'creative': creative
193200
}
194201
}
195-
196-
print(cf_clearance)
197-
202+
198203
headers = {
199204
'authority': 'www.phind.com',
200205
'accept': '*/*',
@@ -209,7 +214,7 @@ def request(model, prompt, results, creative, detailed, codeContext, language) -
209214
'sec-fetch-dest': 'empty',
210215
'sec-fetch-mode': 'cors',
211216
'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',
217+
'user-agent': user_agent
213218
}
214219

215220
response = post('https://www.phind.com/api/infer/answer',
@@ -228,6 +233,9 @@ def create(
228233
codeContext : str = '',
229234
language : str = 'en'):
230235

236+
if user_agent == '':
237+
raise ValueError('user_agent must be set, refer to documentation')
238+
231239
if results is None:
232240
results = Search.create(prompt, actualSearch = True)
233241

testing/phind_test.py phind/phind_test.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import phind
22

33
# set cf_clearance cookie
4-
phind.cf_clearance = 'hWfIdYKgcnxnU5ayolWe9t7eEmAbULywS.qfHkm1T_A-1682166681-0-160'
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'
56

67
prompt = 'hello world'
78

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ pypasser
55
names
66
colorama
77
curl_cffi
8+
streamlit==1.21.0
89
selenium
910
fake-useragent

streamlit_app.py

+43
Original file line numberDiff line numberDiff line change
@@ -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

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
import ora
22

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 :
329
# 1 normal
430
# 2 solidity contract helper
531
# 3 swift project helper
@@ -16,12 +42,4 @@
1642
# 16 expert full-stack developer AI
1743
# 17 Solana development bot
1844
# 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)
45+
# 19 AI Ethicist and Philosopher

0 commit comments

Comments
 (0)