XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

readme

b2d5309c
t.me/xtekky <98614666+xtekky@users.noreply.github.com>
提交于

代码差异

4 个文件 +131 -217
Deleted OLDREADME.md +0 -135
@@ -1,135 +0,0 @@
1 # GPT4free - use ChatGPT, for free!!
2
3 ##### You may join our discord server for updates and support ; )
4 - [Discord Link](https://discord.gg/gpt4free)
5
6 <img width="1383" alt="image" src="https://user-images.githubusercontent.com/98614666/233799515-1a7cb6a3-b17f-42c4-956d-8d2a0664466f.png">
7
8 Have you ever come across some amazing projects that you couldn't use **just because you didn't have an OpenAI API key?**
9
10 **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 ; ).
11
12 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!!
13
14 ## Legal Notice <a name="legal-notice"></a>
15
16 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**.
17
18 Please note the following:
19
20 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.
21
22 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.
23
24 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.
25
26
27 ## Table of Contents
28 | Section | Description | Link | Status |
29 | ------- | ----------- | ---- | ------ |
30 | **To do list** | List of tasks to be done | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#todo) | - |
31 | **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) | - |
32 | **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) | - |
33 | **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) | - |
34 | **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) | - |
35 | **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) | - |
36 | **How to install** | Instructions on how to install gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#install) | - |
37 | **Legal Notice** | Legal notice or disclaimer | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#legal-notice) | - |
38 | **Copyright** | Copyright information | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#copyright) | - |
39 | **Star History** | Star History | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#star-history) | - |
40 | **Usage Examples** | | | |
41 | `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) |
42 | `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) | ||
43 | `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) |
44 | `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) |
45 | **Try it Out** | | | |
46 | 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) | - |
47 | 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) | - |
48
49
50 ## Todo <a name="todo"></a>
51
52 - [ ] Add a GUI for the repo
53 - [ ] Make a general package named `openai_rev`, instead of different folders
54 - [ ] Live api status to know which are down and which can be used
55 - [ ] Integrate more API's in `./unfinished` as well as other ones in the lists
56 - [ ] Make an API to use as proxy for other projects
57 - [ ] Make a pypi package
58
59 ## Current Sites <a name="current-sites"></a>
60
61 | Website s | Model(s) |
62 | ---------------------------------------------------- | ------------------------------- |
63 | [forefront.ai](https://chat.forefront.ai) | GPT-4/3.5 |
64 | [poe.com](https://poe.com) | GPT-4/3.5 |
65 | [writesonic.com](https://writesonic.com) | GPT-3.5 / Internet |
66 | [t3nsor.com](https://t3nsor.com) | GPT-3.5 |
67 | [you.com](https://you.com) | GPT-3.5 / Internet / good search|
68 | [sqlchat.ai](https://sqlchat.ai) | GPT-3.5 |
69 | [chat.openai.com/chat](https://chat.openai.com/chat) | GPT-3.5 |
70 | [bard.google.com](https://bard.google.com) | custom / search |
71 | [bing.com/chat](https://bing.com/chat) | GPT-4/3.5 |
72 | [chat.forefront.ai/](https://chat.forefront.ai/) | GPT-4/3.5 |
73
74 ## Best sites <a name="best-sites"></a>
75
76 #### gpt-4
77 - [`/forefront`](./forefront/README.md)
78
79 #### gpt-3.5
80 - [`/you`](./you/README.md)
81
82 ## Install <a name="install"></a>
83 Download or clone this GitHub repo
84 install requirements with:
85 ```sh
86 pip3 install -r requirements.txt
87 ```
88
89 ## To start gpt4free GUI <a name="streamlit-gpt4free-gui"></a>
90 Move `streamlit_app.py` from `./gui` to the base folder
91 then run:
92 `streamlit run streamlit_app.py` or `python3 -m streamlit run streamlit_app.py`
93
94 ## Docker <a name="docker-instructions"></a>
95 Build
96 ```
97 docker build -t gpt4free:latest -f Docker/Dockerfile .
98 ```
99 Run
100 ```
101 docker run -p 8501:8501 gpt4free:latest
102 ```
103
104 ## ChatGPT clone
105 > currently implementing new features and trying to scale it, please be patient it may be unstable
106 > https://chat.chatbot.sex/chat
107 > This site was developed by me and includes **gpt-4/3.5**, **internet access** and **gpt-jailbreak's** like DAN
108 > run locally here: https://github.com/xtekky/chatgpt-clone
109
110 ## Copyright:
111 This program is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt)
112
113 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).
114
115 ### Copyright Notice: <a name="copyright"></a>
116 ```
117 xtekky/openai-gpt4: multiple reverse engineered language-model api's to decentralise the ai industry.
118 Copyright (C) 2023 xtekky
119
120 This program is free software: you can redistribute it and/or modify
121 it under the terms of the GNU General Public License as published by
122 the Free Software Foundation, either version 3 of the License, or
123 (at your option) any later version.
124
125 This program is distributed in the hope that it will be useful,
126 but WITHOUT ANY WARRANTY; without even the implied warranty of
127 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
128 GNU General Public License for more details.
129
130 You should have received a copy of the GNU General Public License
131 along with this program. If not, see <https://www.gnu.org/licenses/>.
132 ```
133
134 ## Star History <a name="star-history"></a>
135 [![Star History Chart](https://api.star-history.com/svg?repos=xtekky/gpt4free&type=Date)](https://star-history.com/#xtekky/gpt4free)
Modified README.md +131 -2
@@ -1,6 +1,4 @@
1 1 We got a takedown request by openAI's legal team...
2 you may refer to the old readme: [OLDREADME.md](./OLDREADME.md)
3
4 2
5 3 discord server for updates / support:
6 4 - https://discord.gg/gpt4free
@@ -56,4 +54,135 @@ Till the long bitter end, will this boy live to fight.
56 54 ( I did not write it )
57 55
58 56
57 _____________________________
58
59 # GPT4free - use ChatGPT, for free!!
60
61 ##### You may join our discord server for updates and support ; )
62 - [Discord Link](https://discord.gg/gpt4free)
63
64 <img width="1383" alt="image" src="https://user-images.githubusercontent.com/98614666/233799515-1a7cb6a3-b17f-42c4-956d-8d2a0664466f.png">
65
66 Just API's from some language model sites.
67
68 ## Legal Notice <a name="legal-notice"></a>
69
70 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.
71
72 Please note the following:
73
74 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.
75
76 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.
77
78 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.
79
80
81 ## Table of Contents
82 | Section | Description | Link | Status |
83 | ------- | ----------- | ---- | ------ |
84 | **To do list** | List of tasks to be done | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#todo) | - |
85 | **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) | - |
86 | **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) | - |
87 | **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) | - |
88 | **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) | - |
89 | **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) | - |
90 | **How to install** | Instructions on how to install gpt4free | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#install) | - |
91 | **Legal Notice** | Legal notice or disclaimer | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#legal-notice) | - |
92 | **Copyright** | Copyright information | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#copyright) | - |
93 | **Star History** | Star History | [![Link to Section](https://img.shields.io/badge/Link-Go%20to%20Section-blue)](#star-history) | - |
94 | **Usage Examples** | | | |
95 | `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) |
96 | `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) | ||
97 | `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) |
98 | `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) |
99 | **Try it Out** | | | |
100 | 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) | - |
101 | 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) | - |
102
103
104 ## Todo <a name="todo"></a>
105
106 - [ ] Add a GUI for the repo
107 - [ ] Make a general package named `gpt4free`, instead of different folders
108 - [ ] Live api status to know which are down and which can be used
109 - [ ] Integrate more API's in `./unfinished` as well as other ones in the lists
110 - [ ] Make an API to use as proxy for other projects
111 - [ ] Make a pypi package
112
113 ## Current Sites <a name="current-sites"></a>
114
115 | Website s | Model(s) |
116 | ---------------------------------------------------- | ------------------------------- |
117 | [forefront.ai](https://chat.forefront.ai) | GPT-4/3.5 |
118 | [poe.com](https://poe.com) | GPT-4/3.5 |
119 | [writesonic.com](https://writesonic.com) | GPT-3.5 / Internet |
120 | [t3nsor.com](https://t3nsor.com) | GPT-3.5 |
121 | [you.com](https://you.com) | GPT-3.5 / Internet / good search|
122 | [sqlchat.ai](https://sqlchat.ai) | GPT-3.5 |
123 | [bard.google.com](https://bard.google.com) | custom / search |
124 | [bing.com/chat](https://bing.com/chat) | GPT-4/3.5 |
125 | [chat.forefront.ai/](https://chat.forefront.ai/) | GPT-4/3.5 |
126
127 ## Best sites <a name="best-sites"></a>
128
129 #### gpt-4
130 - [`/forefront`](./forefront/README.md)
131
132 #### gpt-3.5
133 - [`/you`](./you/README.md)
134
135 ## Install <a name="install"></a>
136 Download or clone this GitHub repo
137 install requirements with:
138 ```sh
139 pip3 install -r requirements.txt
140 ```
141
142 ## To start gpt4free GUI <a name="streamlit-gpt4free-gui"></a>
143 Move `streamlit_app.py` from `./gui` to the base folder
144 then run:
145 `streamlit run streamlit_app.py` or `python3 -m streamlit run streamlit_app.py`
146
147 ## Docker <a name="docker-instructions"></a>
148 Build
149 ```
150 docker build -t gpt4free:latest -f Docker/Dockerfile .
151 ```
152 Run
153 ```
154 docker run -p 8501:8501 gpt4free:latest
155 ```
156
157 ## ChatGPT clone
158 > currently implementing new features and trying to scale it, please be patient it may be unstable
159 > https://chat.chatbot.sex/chat
160 > This site was developed by me and includes **gpt-4/3.5**, **internet access** and **gpt-jailbreak's** like DAN
161 > run locally here: https://github.com/xtekky/chatgpt-clone
162
163 ## Copyright:
164 This program is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt)
165
166 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).
167
168 ### Copyright Notice: <a name="copyright"></a>
169 ```
170 xtekky/gpt4free: multiple reverse engineered language-model api's to decentralise the ai industry.
171 Copyright (C) 2023 xtekky
172
173 This program is free software: you can redistribute it and/or modify
174 it under the terms of the GNU General Public License as published by
175 the Free Software Foundation, either version 3 of the License, or
176 (at your option) any later version.
177
178 This program is distributed in the hope that it will be useful,
179 but WITHOUT ANY WARRANTY; without even the implied warranty of
180 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
181 GNU General Public License for more details.
182
183 You should have received a copy of the GNU General Public License
184 along with this program. If not, see <https://www.gnu.org/licenses/>.
185 ```
59 186
187 ## Star History <a name="star-history"></a>
188 [![Star History Chart](https://api.star-history.com/svg?repos=xtekky/gpt4free&type=Date)](https://star-history.com/#xtekky/gpt4free)
Deleted openaihosted/__init__.py +0 -62
@@ -1,62 +0,0 @@
1 import json
2 import re
3 import requests
4
5
6 class Completion:
7 @staticmethod
8 def create(messages):
9 headers = {
10 "authority": "openai.a2hosted.com",
11 "accept": "text/event-stream",
12 "accept-language": "en-US,en;q=0.9,id;q=0.8,ja;q=0.7",
13 "cache-control": "no-cache",
14 "sec-fetch-dest": "empty",
15 "sec-fetch-mode": "cors",
16 "sec-fetch-site": "cross-site",
17 "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0",
18 }
19
20 query_param = Completion.__create_query_param(messages)
21 url = f"https://openai.a2hosted.com/chat?q={query_param}"
22 request = requests.get(url, headers=headers, stream=True)
23 if request.status_code != 200:
24 return Completion.__get_failure_response()
25
26 content = request.content
27 response = Completion.__join_response(content)
28
29 return {"responses": response}
30
31 @classmethod
32 def __get_failure_response(cls) -> dict:
33 return dict(
34 response="Unable to fetch the response, Please try again.",
35 links=[],
36 extra={},
37 )
38
39 @classmethod
40 def __multiple_replace(cls, string, reps) -> str:
41 for original, replacement in reps.items():
42 string = string.replace(original, replacement)
43 return string
44
45 @classmethod
46 def __create_query_param(cls, conversation) -> str:
47 encoded_conversation = json.dumps(conversation)
48 replacement = {" ": "%20", '"': "%22", "'": "%27"}
49 return Completion.__multiple_replace(encoded_conversation, replacement)
50
51 @classmethod
52 def __convert_escape_codes(cls, text) -> str:
53 replacement = {'\\\\"': '"', '\\"': '"', "\\n": "\n", "\\'": "'"}
54 return Completion.__multiple_replace(text, replacement)
55
56 @classmethod
57 def __join_response(cls, data) -> str:
58 data = data.decode("utf-8")
59 find_ans = re.findall(r'(?<={"msg":)[^}]*', str(data))
60 ans = [Completion.__convert_escape_codes(x[1:-1]) for x in find_ans]
61 response = "".join(ans)
62 return response
Deleted openaihosted/readme.md +0 -18
@@ -1,18 +0,0 @@
1 ### Example: `openaihosted` (use like openai pypi package) <a name="example-openaihosted"></a>
2
3 ```python
4 import openaihosted
5
6 messages = [{"role": "system", "content": "You are a helpful assistant."}]
7 while True:
8 question = input("Question: ")
9 if question == "!stop":
10 break
11
12 messages.append({"role": "user", "content": question})
13 request = openaihosted.Completion.create(messages=messages)
14
15 response = request["responses"]
16 messages.append({"role": "assistant", "content": response})
17 print(f"Answer: {response}")
18 ```