duck2api / README.md
sanbo
upate
6390363
|
raw
history blame
3.4 kB
---
title: Duck2api
emoji: 🏢
colorFrom: red
colorTo: green
sdk: docker
pinned: false
license: apache-2.0
short_description: duck 2 api service
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
# duck2api
> 高版本使用镜像网站 https://p.till.us.kg/till/https/duckduckgo.com/?q=DuckDuckGo+AI+Chat&ia=chat&duckai=1 进行访问
>
# Web端
访问http://你的服务器ip:7860/web
本地访问: http://127.0.0.1:7860/web
![web使用](https://raw.githubusercontent.com/hhhaiai/Picture/main/img/202410221640721.png)
## Deploy
### 编译部署
```bash
git clone https://github.com/openChatGpts/Duck2api.git
cd Duck2api
go build -o duck2api
chmod +x ./duck2api
./duck2api
```
### Docker部署
暂时支持
## Usage
``` bash
# 其他地址版本
curl --location 'http://你的服务器ip:7860/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Say this is a test!"}],
"stream": true
}'
# 本地版本
curl --location 'http://127.0.0.1:7860/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Say this is a test!"}],
"stream": true
}'
## 系统提示词
curl --location 'http://127.0.0.1:7860/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"messages": [{"role":"system","content":"你是一个辅助机器人"},{"role": "user", "content": "你的知识库最后什么日期"}],
"stream": true
}'
## 非流式系统提示词
curl --location 'http://127.0.0.1:7860/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"messages": [{"role":"system","content":"你是一个辅助机器人"},{"role": "user", "content": "你的知识库最后什么日期"}],
"stream": false
}'
## 加入更多参数
curl --location 'http://127.0.0.1:7860/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"messages": [{"role":"system","content":"你是一个辅助机器人"},{"role": "user", "content": "你的知识库最后什么日期"}],
"stream": true,
"temperature":0.35,
"top_p":0.15
}'
curl --location 'http://127.0.0.1:7860/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"messages": [{"role":"system","content":"你是一个辅助机器人"},{"role": "user", "content": "你的知识库最后什么日期"}],
"stream": false,
"temperature":0.35,
"top_p":0.15
}'
```
## 支持的模型
- ~~gpt-3.5-turbo~~ duckduckGO官方已移除3.5模型的支持
- claude-3-haiku
- llama-3.1-70b
- mixtral-8x7b
- gpt-4o-mini
## 高级设置
默认情况不需要设置,除非你有需求
### 环境变量
```
Authorization=your_authorization 用户认证 key。
TLS_CERT=path_to_your_tls_cert 存储TLS(传输层安全协议)证书的路径。
TLS_KEY=path_to_your_tls_key 存储TLS(传输层安全协议)证书的路径。
PROXY_URL=your_proxy_url 添加代理池来。
```
## 鸣谢
感谢各位大佬的pr支持,感谢。
## 参考项目
https://github.com/xqdoo00o/ChatGPT-to-API
## License
MIT License