Deploy your ChatGPT API backend to various platforms for free with one click
Supports Vercel, Cloudflare Workers, Docker, Render, etc.
Support GPT4o mini, Claude 3 Haiku, Llama 3.1 70B, Mixtral 8x7B models
All models provided anonymously by DuckDuckGo
Vercel / Cloudflare Workers / Docker / Render / Hugging Face / More Serverless
Do not abuse
Use a third-party ChatGPT application to call the interface, for example:
Example (please replace chatcfapi.r12.top
with your own deployed domain name):
curl --request POST ' https://chatcfapi.r12.top/v1/chat/completions '
--header ' Content-Type: application/json '
--data ' {
"messages": [
{
"role": "user",
"content": "你好!"
}
],
"model": "gpt-4o-mini",
"stream": true
} '
Example (please replace chatcfapi.r12.top
with your own deployed domain name):
Visit http://chatcfapi.r12.top/v1/models
to view the currently supported models
The model name is obtained from DDG web page capture simultaneously (unknown models will be redirected to the gpt-4o-mini model)
Since the DDG API limits the number of concurrencies for a single IP, it is recommended to use Vercel for deployment. If you use local deployment such as Docker, please ensure that the project runs in the agent pool.
Method 1: Cloud Fork warehouse deployment
Import
the warehouse you just forked.Deploy
Method 2: Local Clone warehouse deployment
npm i -g vercel
vercel login
git clone https://github.com/leafmoes/DDG-Chat.git ddg-chat
cd ddg-chat
npm run publish
Method 3: One-click deployment
Import
the warehouse you just forked, and then follow the normal deployment process.Method one:
兼容性标志
to nodejs_compat
at运行时
Method two:
npm i -g wrangler
wrangler login
git clone https://github.com/leafmoes/DDG-Chat.git ddg-chat
cd ddg-chat
npm install
npm run publish:cf
Create a new space: Create a new Space
Space name:ddg-chat
License: MIT
Select the Space SDK: docker (Blank)
Space hardware: free
To set environment variables, go to Settings -> Variables and secrets -> Variables. It seems that API_PREFIX
must be set to configure environment variables. Due to the restriction of hugging face? Environment variables are in the post
Edit the README.md file and add app_port: 8787
in the metadata. This 8787 depends on the port of your docker image.
Add Dockerfile file:
FROM docker.io/leafmoes/ddg-chat:latest
Method 1: Command line build
docker run -it -d --name ddg-chat -p 8787:8787 leafmoes/ddg-chat:latest
Method 2: Build using docker-compose.yml
file
Download and save the docker-compose.yml file, and then run docker-compose up -d
in the directory where the file is located to start the service.
Docker related commands
docker logs -f ddg-chat # 查看服务实时日志
docker restart ddg-chat # 重启服务
docker stop ddg-chat # 停止服务
# API 服务使用的端口
PORT = 8787
# API 调用的前缀地址
API_PREFIX = ' / '
# 作为调用 API 验证的 API Key
API_KEY = ' dummy_key '
# 向 DDG 发送请求失败的重试次数
MAX_RETRY_COUNT = 3
# 向 DDG 发送请求失败的重试延迟,单位 ms
RETRY_DELAY = 5000
429 ERR_SERVICE_UNAVAILABLE
reported? How to solve it?Telegram
MIT License