可以将网络上的 ChatGPT 转换为 OpenAI API 格式的服务。
Go to file
2024-04-06 15:05:57 +08:00
api init first commit 2024-04-05 04:58:52 +08:00
chatgpt fix repeat history 2024-04-06 15:05:57 +08:00
utils fix repeat history 2024-04-06 15:05:57 +08:00
chat2api.py fix repeat history 2024-04-06 15:05:57 +08:00
docker-compose.yml upload README 2024-04-05 05:11:25 +08:00
Dockerfile fix repeat history 2024-04-06 15:05:57 +08:00
LICENSE upload README 2024-04-05 05:11:25 +08:00
README.md fix repeat history 2024-04-06 15:05:57 +08:00
requirements.txt fix repeat history 2024-04-06 15:05:57 +08:00

CHAT2API

🌟无需账号即可使用免费、无限的gpt3.5目前只能转gpt3.5

🔍以假乱真回复格式与真实api完全一致支持max_tokensstream等参数

Deploy

直接部署

git clone https://github.com/LanQian528/chat2api
cd chat2api
pip install -r requirements.txt
python chat2api.py

Docker部署

您需要安装Docker和Docker Compose。

docker run -d \
  --name chat2api \
  -p 5005:5005 \
  lanqian528/chat2api:latest

Docker Compose部署

创建一个新的目录例如chat2api并进入该目录

mkdir chat2api
cd chat2api

在此目录中下载库中的docker-compose.yml文件

docker-compose up -d

Usage

curl --location 'http://127.0.0.1:5005/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
     "model": "gpt-3.5-turbo",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "stream": true
   }'

常见问题

  • 当返回错误代码403这意味着当前IP地址被 CF 盾拦截请尝试更换IP地址或者在环境变量 PROXY_URL 中设置代理。
  • 来自Xiaofei的礼物:将环境变量设置为 CHATGPT_BASE_URL=http://api.angelxf.me:8080/api 可无视CF盾和IP问题。

高级设置

默认情况不需要设置,除非你有需求

环境变量

PROXY_URL=http://username:password@proxy:port
CHATGPT_BASE_URL=https://chat.openai.com/backend-anon
HISTORY_DISABLED=true

License

MIT License