gpt4free-ts/README.md

230 行
9.0 KiB
Markdown
Raw 通常表示 履歴

2023-06-10 01:28:11 +09:00
<div align="center">
2023-06-07 12:44:55 +09:00
2023-06-10 01:28:11 +09:00
# GPT4Free TypeScript Version 🆓
###### Providing a free OpenAI GPT-4 API!
2023-06-11 12:33:31 +09:00
English | [中文](README_zh.md) | [日本語](README_ja.md)
2023-06-07 13:03:40 +09:00
2023-06-10 01:28:11 +09:00
[![Discord Server](https://discordapp.com/api/guilds/1115852499535020084/widget.png?style=banner2&count=true)](https://discord.gg/bbH68Kzm)
<p>You can join our discord: <a href="https://discord.gg/bbH68Kzm">discord.gg/gptgod<a> for further updates. <a href="https://discord.gg/bbH68Kzm"><img align="center" alt="gpt4free Discord" width="22px" src="https://raw.githubusercontent.com/peterthehan/peterthehan/master/assets/discord.svg" /></a></p>
</div>
## 👍 GPT4 Website Base on this project [GPTGOD](http://gptgod.site)
<details>
2023-06-11 19:53:05 +09:00
<summary><strong>Website Feature (Click to expand)</strong></summary>
2023-05-16 13:27:09 +09:00
### GPTGOD Support
2023-06-11 19:53:05 +09:00
- [x] Midjourney The Most Powerful AI Drawing System in History
2023-05-16 13:27:41 +09:00
- [x] Stable Diffusion
2023-05-16 13:27:09 +09:00
- [x] Claude
- [x] Chatgpt
- [x] Chatgpt with internet
- [x] Create wechat ai robot for yourself, just need one step
2023-05-09 11:55:50 +09:00
2023-05-11 11:39:59 +09:00
In the next two weeks, I will open source all the code for GPTGOD. If you need, Please watch this project or follow me
to receive notifications.
2023-05-09 11:55:50 +09:00
2023-05-10 08:14:50 +09:00
Why now? because there are stil some secret config should be removed from that project.
2023-06-10 01:28:11 +09:00
</details>
2023-05-09 11:55:09 +09:00
2023-06-10 01:28:11 +09:00
## 🚩 Reverse target
2023-05-11 11:39:59 +09:00
2023-05-05 19:38:46 +09:00
Still striving to keep updating.
Have implemented models here:
2023-05-11 11:44:46 +09:00
If you do not want your website to appear here, please raise an issue and I will remove it immediately.
2023-05-12 18:16:25 +09:00
|model|support|status|active time|
|--|--|--|--|
2023-06-06 17:28:19 +09:00
|[ai.mcbbs.gq](https://ai.mcbbs.gq)|gpt3.5|![Active](https://img.shields.io/badge/Active-brightgreen)|after 2023-06-03|
2023-06-10 01:28:11 +09:00
|[forefront.ai](https://chat.forefront.ai)|👍GPT-4/gpt3.5|![Active](https://img.shields.io/badge/Active-brightgreen)|after 2023-06-03|
2023-06-13 08:31:00 +09:00
|[you.com](https://you.com)|GPT-3.5|![Active](https://img.shields.io/badge/Active-brightgreen)|after 2023-05-12
2023-05-11 22:35:47 +09:00
|[phind.com](https://www.phind.com/)|GPT-4 / Internet / good search|![Active](https://img.shields.io/badge/Active-grey)|
2023-06-13 08:31:00 +09:00
|[bing.com/chat](https://bing.com/chat)|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||
2023-05-04 22:40:33 +09:00
2023-06-10 01:28:11 +09:00
## 🏃‍♂️ Run
First of all, you should create file `.env`.
> ***All operation methods require this step.***
```env
http_proxy=http://host:port
rapid_api_key=xxxxxxxxxx
EMAIL_TYPE=temp-email44
DEBUG=0
2023-06-12 12:20:03 +09:00
POOL_SIZE=1
2023-06-10 01:28:11 +09:00
```
- `http_proxy`: config your proxy if you can not access target website directly
- `rapid_api_key`: you should config this if you use forefront api, this apikey is used for receive register email, get api key here
- `EMAIL_TYPE`: temp email type includes `temp-email` `temp-email44` `tempmail-lol`
- [temp-email](https://rapidapi.com/Privatix/api/temp-mail): soft limit 100req/days, if over use money, need bind credit card! Very Stable!
- [temp-email44](https://rapidapi.com/calvinloveland335703-0p6BxLYIH8f/api/temp-mail44): hard limit 100req/days! Stable!
- [tempmail-lol](): nothing need, limit 25request/5min. Not Stable.
- `DEBUG`: Valid when use `forefront` You can set =1 when you run local. show reverse process
2023-06-12 12:20:03 +09:00
- `POOL_SIZE`: `forefront` concurrency size. Keep set=1 until you run it successfully!!! You can engage in {POOL_SIZE} conversations concurrently. More pool size, More conversation can be done simultaneously, But use more RAM
2023-06-10 01:28:11 +09:00
### Run local 🖥️
2023-05-04 22:47:53 +09:00
```shell
2023-05-05 22:03:38 +09:00
# install module
2023-05-04 22:47:53 +09:00
yarn
2023-05-05 22:03:38 +09:00
# start server
2023-05-04 22:47:53 +09:00
yarn start
```
2023-06-12 16:09:30 +09:00
### Run with docker(Suggest!) 🐳
2023-05-09 22:41:17 +09:00
```
2023-06-08 12:02:01 +09:00
docker run -p 3000:3000 --env-file .env xiangsx/gpt4free-ts:latest
2023-05-09 22:41:17 +09:00
```
2023-06-10 01:28:11 +09:00
### Deploy with docker-compose 🎭
2023-05-09 22:41:17 +09:00
2023-05-09 22:42:37 +09:00
first, you should create file .env; Follow step "Run with docker
2023-05-09 22:41:17 +09:00
2023-05-05 22:03:38 +09:00
deploy
2023-05-11 11:39:59 +09:00
2023-05-04 22:47:53 +09:00
```
docker-compose up --build -d
```
2023-05-04 22:52:29 +09:00
2023-06-10 01:28:11 +09:00
## 🚀 Let's Use GPT4
2023-05-04 22:52:29 +09:00
2023-06-13 11:42:33 +09:00
> Return when chat complete http://127.0.0.1:3000/ask?prompt=***&model=***&site=***
2023-05-07 02:10:52 +09:00
2023-06-13 11:42:33 +09:00
> Return with eventstream http://127.0.0.1:3000/ask/stream?prompt=***&model=***&site=***
2023-05-07 02:10:52 +09:00
2023-06-13 11:42:33 +09:00
### Request Params 📝
2023-06-03 15:45:28 +09:00
2023-06-13 11:42:33 +09:00
- `prompt`: your question. It can be a `string` or `jsonstr`.
2023-06-13 14:36:57 +09:00
- example `jsonstr`:`[{"role":"user","content":"hello\n"},{"role":"assistant","content":"Hi there! How can I assist you today?"},{"role":"user","content":"who are you"}]`
- example `string`: `who are you`
2023-06-13 11:42:33 +09:00
- `model`: default `gpt3.5-turbo`. model include:`gpt4` `gpt3.5-turbo`
- `site`: default `you`. target site, include `forefront` `you` `mcbbs`
### Response Params 🔙
Response when chat end(/ask):
```typescript
interface ChatResponse {
content: string;
error?: string;
}
```
Response with stream like(/ask/stream):
```
event: message
data: {"content":"I"}
event: done
data: {"content":"'m"}
event: error
data: {"error":"some thind wrong"}
```
2023-06-03 15:45:28 +09:00
2023-06-10 01:28:11 +09:00
### Example💡
2023-06-13 11:42:33 +09:00
1. request to site you with history
req:
[127.0.0.1:3000/ask?site=you&prompt=[{"role":"user","content":"hello"},{"role":"assistant","content":"Hi there! How can I assist you today?"},{"role":"user","content":"who are you"}]]()
res:
```json
{
"content": "Hi there! How can I assist you today?"
}
```
[127.0.0.1:3000/ask?site=you&prompt=[{"role":"user","content":"你好\n"},{"role":"assistant","content":"你好!有什么我可以帮助你的吗?"},{"role":"user","content":"你是谁"}]]()
2. request to site you with stream return
req:
[127.0.0.1:3000/ask/stream?site=you&prompt=who are you]()
res:
```
event: message
data: {"content":"I"}
event: message
data: {"content":"'m"}
event: message
data: {"content":" a"}
event: message
data: {"content":" search"}
event: message
data: {"content":" assistant"}
........
event: done
data: {"content":"done"}
```
2023-06-03 15:45:28 +09:00
2023-06-11 21:49:13 +09:00
## 👥 Wechat Group
<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/0a788688-ab0b-4e95-8438-20af4e7a5362" width=240 />
2023-06-12 22:30:13 +09:00
<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/399549fa-34b9-4611-873f-f539d2dca04a" width=240 />
2023-05-05 22:03:38 +09:00
2023-05-09 13:22:04 +09:00
## 🌟 Star History
[![Star History Chart](https://api.star-history.com/svg?repos=xiangsx/gpt4free-ts&type=Date)](https://star-history.com/#xiangsx/gpt4free-ts&&type=Date)
2023-05-05 22:03:38 +09:00
<p>You may join our discord: <a href="https://discord.com/invite/gpt4free">discord.gg/gpt4free<a> for further updates. <a href="https://discord.gg/gpt4free"><img align="center" alt="gpt4free Discord" width="22px" src="https://raw.githubusercontent.com/peterthehan/peterthehan/master/assets/discord.svg" /></a></p>
2023-06-07 15:18:52 +09:00
This is a replication project for the typescript version of [gpt4free](https://github.com/xtekky/gpt4free)
2023-05-05 22:03:38 +09:00
<img alt="gpt4free logo" src="https://user-images.githubusercontent.com/98614666/233799515-1a7cb6a3-b17f-42c4-956d-8d2a0664466f.png">
## Legal Notice <a name="legal-notice"></a>
2023-05-11 11:39:59 +09:00
This repository is _not_ associated with or endorsed by providers of the APIs contained in this GitHub repository. This
project is intended **for educational purposes only**. This is just a little personal project. Sites may contact me to
improve their security or request the removal of their site from this repository.
2023-05-05 22:03:38 +09:00
Please note the following:
2023-05-11 11:39:59 +09:00
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 nor is it affiliated with or endorsed by any of the providers
mentioned.
2023-05-05 22:03:38 +09:00
2023-05-11 11:39:59 +09:00
2. **Responsibility**: The author of this repository is _not_ responsible for any consequences, damages, or losses
arising from the use or misuse of this repository or the content provided by the third-party APIs. Users are solely
responsible for their actions and any repercussions that may follow. We strongly recommend the users to follow the
TOS of the each Website.
2023-05-05 22:03:38 +09:00
2023-05-11 11:39:59 +09:00
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.
2023-05-05 22:03:38 +09:00
2023-05-11 11:39:59 +09:00
4. **Copyright**: All content in this repository, including but not limited to code, images, and documentation, is the
intellectual property of the repository author, unless otherwise stated. Unauthorized copying, distribution, or use
of any content in this repository is strictly prohibited without the express written consent of the repository
author.
2023-05-05 22:03:38 +09:00
2023-05-11 11:39:59 +09:00
5. **Indemnification**: Users agree to indemnify, defend, and hold harmless the author of this repository from and
against any and all claims, liabilities, damages, losses, or expenses, including legal fees and costs, arising out of
or in any way connected with their use or misuse of this repository, its content, or related third-party APIs.
2023-05-05 22:03:38 +09:00
2023-05-11 11:39:59 +09:00
6. **Updates and Changes**: The author reserves the right to modify, update, or remove any content, information, or
features in this repository at any time without prior notice. Users are responsible for regularly reviewing the
content and any changes made to this repository.
2023-05-05 22:03:38 +09:00
2023-05-11 11:39:59 +09:00
By using this repository or any code related to it, you agree to these terms. The author is not responsible for any
copies, forks, or reuploads made by other users. This is the author's only account and repository. To prevent
impersonation or irresponsible actions, you may comply with the GNU GPL license this Repository uses.