Merge branch 'patch/localApps-DHbwey' into localApps
|
|
@ -0,0 +1,184 @@
|
|||
# Ech0 - 开源、自托管、专注思想流动的轻量级发布平台
|
||||
|
||||
<p align="center">
|
||||
<img alt="Ech0" src="./docs/imgs/logo.svg" width="100">
|
||||
</p>
|
||||
|
||||
Ech0 是一款专为轻量级分享而设计的开源自托管平台,支持快速发布与分享你的想法、文字与链接。简单直观的操作界面,轻松管理你的内容,让分享变得更加自由,确保数据完全掌控,随时随地与世界连接。
|
||||
|
||||

|
||||
|
||||
[预览地址](https://memo.vaaat.com/)
|
||||
[官网地址](https://echo.soopy.cn/)
|
||||
|
||||
---
|
||||
|
||||
## 核心优势
|
||||
|
||||
☁️ **原子级轻量**:内存占用、可执行文件、镜像大小均不到**30MB**,单SQLite文件存储架构
|
||||
🚀 **极速部署**:无需配置,从安装到使用只需1条命令
|
||||
✍️ **零干扰写作**:纯净的在线Markdown编辑器,**支持丰富的Markdown插件与预览**
|
||||
📦 **数据主权**:所有内容存储于本地SQLite文件,支持RSS订阅
|
||||
🎉 **永久免费**:MIT协议开源,无追踪/无订阅/无服务依赖
|
||||
🌍 **跨端适配**:完美兼容桌面/移动浏览器,支持手机、iPad、PC三端响应式布局
|
||||
👾 **WPA适配**:支持作为Web应用安装
|
||||
📝 **内置Todo管理**:轻松记录、管理每日待办事项,帮助你高效规划和追踪任务进度
|
||||
🔗 **Ech0 Connect**:全新内容聚合与互联功能,支持多实例间互通、内容订阅与同步,打造属于你的去中心化内容网络
|
||||
🎵 **无缝音乐集成**: 内置超低资源占用的音乐播放器,支持本地音频流解析,提供沉浸式背景音乐与专注模式
|
||||
🎥 **即时视频分享**: 原生支持哔哩哔哩视频智能解析,输入BV号/链接即可自动提取并嵌入
|
||||
🃏 **丰富的快捷卡片**:支持网站链接、GitHub项目等多种富媒体内容一键分享,让信息展示更加直观生动
|
||||
⚙️ **高级自定义功能**:为高级用户提供便捷自定义样式与脚本,分享更具表现力
|
||||
|
||||
---
|
||||
|
||||
## 3秒极速部署
|
||||
|
||||
### 🧙 脚本一键部署(推荐)
|
||||
```shell
|
||||
curl -fsSL "http://echo.soopy.cn/install.sh" -o install_ech0.sh && bash install_ech0.sh
|
||||
```
|
||||
|
||||
### 🐳 docker部署(推荐)
|
||||
|
||||
```shell
|
||||
docker run -d \
|
||||
--name ech0 \
|
||||
-p 6277:6277 \
|
||||
-v /opt/ech0/data:/app/data \
|
||||
-e JWT_SECRET="Hello Echos!" \
|
||||
sn0wl1n/ech0:latest
|
||||
```
|
||||
|
||||
> 💡 部署完成后访问 ip:6277 即可使用
|
||||
> 🚷 建议把`-e JWT_SECRET="Hello Echos!"`里的`Hello Echos!`改成别的内容以提高安全性
|
||||
> 📍 首次使用注册的账号会被设置为管理员(目前仅管理员支持发布内容)
|
||||
> 🎈 数据存储在/opt/ech0/data下
|
||||
|
||||
### 🐋 docker-componse部署
|
||||
|
||||
创建一个新目录并将 `docker-compose.yml` 文件放入其中
|
||||
|
||||
在该目录下执行以下命令启动服务:
|
||||
|
||||
```shell
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## 如何更新
|
||||
|
||||
### 🔄 Docker部署如何更新
|
||||
|
||||
```shell
|
||||
# 停止当前的容器
|
||||
docker stop ech0
|
||||
|
||||
# 移除容器
|
||||
docker rm ech0
|
||||
|
||||
# 拉取最新的镜像
|
||||
docker pull sn0wl1n/ech0:latest
|
||||
|
||||
# 启动新版本的容器
|
||||
docker run -d \
|
||||
--name ech0 \
|
||||
-p 6277:6277 \
|
||||
-v /opt/ech0/data:/app/data \
|
||||
-v /opt/ech0/config/config.yaml:/app/data/config/config.yaml \
|
||||
-e JWT_SECRET="Hello Echos!" \
|
||||
sn0wl1n/ech0:latest
|
||||
```
|
||||
|
||||
### 💎 Docker Compose部署如何更新
|
||||
|
||||
```shell
|
||||
# 进入 compose 文件目录
|
||||
cd /path/to/compose
|
||||
|
||||
# 拉取最新镜像并重启
|
||||
docker-compose pull && \
|
||||
docker-compose up -d --force-recreate
|
||||
|
||||
# 清理旧镜像
|
||||
docker image prune -f
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 🦖 未来目标
|
||||
|
||||
- [x] 使用裸Vue3重写整个前端
|
||||
- [x] 修复一个安全性的问题
|
||||
- [x] 重构后端,使其更加优雅高效
|
||||
- [ ] 优化各项画面细节 && 增加更多实用功能
|
||||
- [ ] 性能优化 && 美化界面
|
||||
|
||||
---
|
||||
|
||||
# ❓ 常见问题
|
||||
|
||||
1. **Ech0是什么?**
|
||||
Ech0 是一款轻量级的开源自托管平台,专为快速发布与分享个人想法、文字和链接而设计。它提供简洁的界面,支持零干扰的写作体验,所有数据存储于本地,确保用户对内容的完全控制。
|
||||
|
||||
2. **Ech0 是免费的吗?**
|
||||
是的,Ech0 完全免费且开源,遵循 MIT 协议。它没有广告、追踪、订阅或服务依赖。
|
||||
|
||||
3. **如何进行备份和恢复数据?**
|
||||
由于所有内容都存储在本地 SQLite 文件中,您只需备份/opt/ech0/data目录中的文件即可(具体选择部署时的映射路径)。在需要恢复时,直接将备份文件还原即可。
|
||||
|
||||
4. **Ech0 支持 RSS 吗?**
|
||||
是的,Ech0 支持 RSS 订阅,您可以通过 RSS 阅读器订阅您的内容更新。
|
||||
|
||||
5. **为什么发布失败,提示联系管理员?**
|
||||
当前版本设计上,只有管理员可以发布内容。部署后,首个注册的用户会自动被设置为系统管理员,其他用户无法发布内容(可在设置中分配权限)。
|
||||
|
||||
6. **为什么没有明确的权限划分?**
|
||||
Ech0 旨在保持简洁和轻量,因此在设计时没有复杂的权限系统。我们希望用户能够专注于分享内容,而不是被复杂的权限管理所困扰。为了保持流畅的使用体验,Ech0 尽量精简了功能,避免不必要的复杂性。(因此目前只有管理员与非管理员之分,所以请谨慎分配你的权限)
|
||||
|
||||
---
|
||||
|
||||
# 🛠️ 开发
|
||||
|
||||
🔧 依赖环境
|
||||
📌 后端: `Go 1.24.3+`
|
||||
📌 前端: `NodeJS v22.15.0, PNPM`
|
||||
|
||||
🏗️ 启动
|
||||
在Ech0根目录下:
|
||||
|
||||
后端:
|
||||
```shell
|
||||
go run cmd/ech0/main.go
|
||||
```
|
||||
|
||||
前端(新终端):
|
||||
```shell
|
||||
cd web # 进入前端目录
|
||||
|
||||
pnpm install
|
||||
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 🥰 致谢
|
||||
|
||||
- 感谢 [Gin](https://github.com/gin-gonic/gin) 提供高性能的后端框架支持
|
||||
- 感谢 [Md-Editor-V3](https://github.com/imzbf/md-editor-v3) 提供强大易用的 Markdown 编辑器
|
||||
- 感谢 [Figma](https://www.figma.com/) 提供便捷的 Logo 设计工具
|
||||
- 感谢舍友的 Logo 设计
|
||||
- 感谢所有开源社区的贡献者与支持者
|
||||
|
||||
---
|
||||
|
||||
# ☕ 支持
|
||||
|
||||
|
||||
🌟 如果你觉得 **Ech0** 不错,欢迎为项目点个 Star!🚀
|
||||
|
||||
Ech0 完全开源且免费,持续维护和优化离不开大家的支持。如果这个项目对你有所帮助,也欢迎通过赞助支持项目的持续发展。你的每一份鼓励和支持,都是我们前进的动力!
|
||||
你可以向打赏二维码付款,然后备注你的github名称,将在首页 `README.md` 页面向所有展示你的贡献
|
||||
|
||||
| 支持平台 | 二维码 |
|
||||
| :------: | :-------------: |
|
||||
| [**爱发电**](https://afdian.com/a/l1nsn0w) | <img src="./docs/imgs/pay.jpeg" alt="Pay" width="200"> |
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: ech0
|
||||
tags:
|
||||
- 实用工具
|
||||
title: Ech0 - 开源、自托管、专注思想流动的轻量级发布平台
|
||||
description: Ech0 - 开源、自托管、专注思想流动的轻量级发布平台
|
||||
additionalProperties:
|
||||
key: ech0
|
||||
name: ech0
|
||||
tags:
|
||||
- Tool
|
||||
shortDescZh: Ech0 是一款专为轻量级分享而设计的开源自托管平台,支持快速发布与分享你的想法、文字与链接。简单直观的操作界面,轻松管理你的内容,让分享变得更加自由,确保数据完全掌控,随时随地与世界连接。
|
||||
shortDescEn: Ech0 is an open source hosting platform designed for lightweight sharing, supporting the rapid publishing and sharing of your ideas, text and links. With a simple and intuitive interface, it's easy to manage your content, make sharing more free, ensure full control of your data, and connect with the world anytime, anywhere.
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 1
|
||||
recommend: 0
|
||||
website: https://memo.vaaat.com/
|
||||
github: https://github.com/lin-snow/Ech0
|
||||
document: https://github.com/lin-snow/Ech0/blob/main/README.md
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
CONTAINER_NAME="ech0"
|
||||
DATA_PATH="./data"
|
||||
PANEL_APP_PORT_HTTP="40120"
|
||||
JWT_SECRET="secret"
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: "./data"
|
||||
edit: true
|
||||
envKey: DATA_PATH
|
||||
labelEn: Data Path
|
||||
labelZh: 数据路径
|
||||
required: true
|
||||
type: text
|
||||
- default: 40120
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: "secret"
|
||||
edit: true
|
||||
envKey: JWT_SECRET
|
||||
labelEn: JWT Secret
|
||||
labelZh: JWT密钥
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
services:
|
||||
ech0:
|
||||
image: sn0wl1n/ech0:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:6277"
|
||||
volumes:
|
||||
- ${DATA_PATH}/data:/app/data
|
||||
environment:
|
||||
- JWT_SECRET="${JWT_SECRET}"
|
||||
networks:
|
||||
- 1panel-network
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
After Width: | Height: | Size: 26 KiB |
|
|
@ -1,2 +1,3 @@
|
|||
CONTAINER_NAME="gh-proxy"
|
||||
PANEL_APP_PORT_HTTP="40170"
|
||||
DATA_PATH="./data"
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 40170
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: "./data"
|
||||
disabled: true
|
||||
envKey: DATA_PATH
|
||||
labelEn: Data Path
|
||||
labelZh: 数据路径
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
services:
|
||||
gh-proxy:
|
||||
image: wjqserver/ghproxy:4.1.4
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
networks:
|
||||
- 1panel-network
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:8080"
|
||||
volumes:
|
||||
- ${DATA_PATH}/log:/data/ghproxy/log
|
||||
- ${DATA_PATH}/config:/data/ghproxy/config
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
|
@ -1,118 +1,132 @@
|
|||
# gh-proxy
|
||||
# GHProxy
|
||||
|
||||
## 简介
|
||||

|
||||

|
||||

|
||||

|
||||
[](https://goreportcard.com/report/github.com/WJQSERVER-STUDIO/ghproxy)
|
||||
|
||||
github release、archive以及项目文件的加速项目,支持clone,有Cloudflare Workers无服务器版本以及Python版本
|
||||
|
||||
## 演示
|
||||
支持 Git clone、raw、releases的 Github 加速项目, 支持自托管的同时带来卓越的性能与极低的资源占用(Golang和HertZ带来的优势), 同时支持多种额外功能
|
||||
|
||||
[https://gh.api.99988866.xyz/](https://gh.api.99988866.xyz/)
|
||||
## 项目说明
|
||||
|
||||
演示站为公共服务,如有大规模使用需求请自行部署,演示站有点不堪重负
|
||||
### 项目特点
|
||||
|
||||

|
||||
- ⚡ **基于 Go 语言实现,跨平台的同时提供高并发性能**
|
||||
- 🌐 **使用字节旗下的 [HertZ](https://github.com/cloudwego/hertz) 作为 Web 框架**
|
||||
- 📡 **使用 [Touka-HTTPC](https://github.com/satomitouka/touka-httpc) 作为 HTTP 客户端**
|
||||
- 📥 **支持 Git clone、raw、releases 等文件拉取**
|
||||
- 🐳 **支持反代Docker, GHCR等镜像仓库**
|
||||
- 🎨 **支持多个前端主题**
|
||||
- 🚫 **支持自定义黑名单/白名单**
|
||||
- 🗄️ **支持 Git Clone 缓存(配合 [Smart-Git](https://github.com/WJQSERVER-STUDIO/smart-git))**
|
||||
- 🐳 **支持自托管与Docker容器化部署**
|
||||
- ⚡ **支持速率限制**
|
||||
- ⚡ **支持带宽速率限制**
|
||||
- 🔒 **支持用户鉴权**
|
||||
- 🐚 **支持 shell 脚本多层嵌套加速**
|
||||
|
||||
当然也欢迎[捐赠](#捐赠)以支持作者
|
||||
### 项目相关
|
||||
|
||||
## python版本和cf worker版本差异
|
||||
[DEMO](https://ghproxy.1888866.xyz)
|
||||
|
||||
- python版本支持进行文件大小限制,超过设定返回原地址 [issue #8](https://github.com/hunshcn/gh-proxy/issues/8)
|
||||
[TG讨论群组](https://t.me/ghproxy_go)
|
||||
|
||||
- python版本支持特定user/repo 封禁/白名单 以及passby [issue #41](https://github.com/hunshcn/gh-proxy/issues/41)
|
||||
[相关文章](https://blog.wjqserver.com/categories/my-program/)
|
||||
|
||||
## 使用
|
||||
[GHProxy项目文档](https://wjqserver-docs.pages.dev/docs/ghproxy/) 感谢 [@redbunnys](https://github.com/redbunnys)的维护
|
||||
|
||||
直接在copy出来的url前加`https://gh.api.99988866.xyz/`即可
|
||||
### 使用示例
|
||||
|
||||
也可以直接访问,在input输入
|
||||
```bash
|
||||
# 下载文件
|
||||
https://ghproxy.1888866.xyz/raw.githubusercontent.com/WJQSERVER-STUDIO/tools-stable/main/tools-stable-ghproxy.sh
|
||||
https://ghproxy.1888866.xyz/https://raw.githubusercontent.com/WJQSERVER-STUDIO/tools-stable/main/tools-stable-ghproxy.sh
|
||||
|
||||
***大量使用请自行部署,以上域名仅为演示使用。***
|
||||
# 克隆仓库
|
||||
git clone https://ghproxy.1888866.xyz/github.com/WJQSERVER-STUDIO/ghproxy.git
|
||||
git clone https://ghproxy.1888866.xyz/https://github.com/WJQSERVER-STUDIO/ghproxy.git
|
||||
|
||||
访问私有仓库可以通过
|
||||
# Docker(OCI) 代理
|
||||
docker pull gh.example.com/wjqserver/ghproxy
|
||||
docker pull gh.example.com/adguard/adguardhome
|
||||
|
||||
`git clone https://user:TOKEN@ghproxy.com/https://github.com/xxxx/xxxx` [#71](https://github.com/hunshcn/gh-proxy/issues/71)
|
||||
docker pull gh.example.com/docker.io/wjqserver/ghproxy
|
||||
docker pull gh.example.com/docker.io/adguard/adguardhome
|
||||
|
||||
以下都是合法输入(仅示例,文件不存在):
|
||||
docker pull gh.example.com/ghcr.io/openfaas/queue-worker
|
||||
```
|
||||
|
||||
- 分支源码:https://github.com/hunshcn/project/archive/master.zip
|
||||
## 部署说明
|
||||
|
||||
- release源码:https://github.com/hunshcn/project/archive/v0.1.0.tar.gz
|
||||
|
||||
- release文件:https://github.com/hunshcn/project/releases/download/v0.1.0/example.zip
|
||||
|
||||
- 分支文件:https://github.com/hunshcn/project/blob/master/filename
|
||||
|
||||
- commit文件:https://github.com/hunshcn/project/blob/1111111111111111111111111111/filename
|
||||
|
||||
- gist:https://gist.githubusercontent.com/cielpy/351557e6e465c12986419ac5a4dd2568/raw/cmd.py
|
||||
|
||||
## cf worker版本部署
|
||||
|
||||
首页:https://workers.cloudflare.com
|
||||
|
||||
注册,登陆,`Start building`,取一个子域名,`Create a Worker`。
|
||||
|
||||
复制 [index.js](https://cdn.jsdelivr.net/gh/hunshcn/gh-proxy@master/index.js) 到左侧代码框,`Save and deploy`。如果正常,右侧应显示首页。
|
||||
|
||||
`ASSET_URL`是静态资源的url(实际上就是现在显示出来的那个输入框单页面)
|
||||
|
||||
`PREFIX`是前缀,默认(根路径情况为"/"),如果自定义路由为example.com/gh/*,请将PREFIX改为 '/gh/',注意,少一个杠都会错!
|
||||
|
||||
## Python版本部署
|
||||
可参考文章: https://blog.wjqserver.com/post/ghproxy-deploy-with-smart-git/
|
||||
|
||||
### Docker部署
|
||||
|
||||
- Docker-cli
|
||||
|
||||
```
|
||||
docker run -d --name="gh-proxy-py" \
|
||||
-p 0.0.0.0:80:80 \
|
||||
--restart=always \
|
||||
hunsh/gh-proxy-py:latest
|
||||
docker run -p 7210:8080 -v ./ghproxy/log/run:/data/ghproxy/log -v ./ghproxy/log/caddy:/data/caddy/log -v ./ghproxy/config:/data/ghproxy/config --restart always wjqserver/ghproxy
|
||||
```
|
||||
|
||||
第一个80是你要暴露出去的端口
|
||||
- Docker-Compose (建议使用)
|
||||
|
||||
### 直接部署
|
||||
参看[docker-compose.yml](https://github.com/WJQSERVER-STUDIO/ghproxy/blob/main/docker/compose/docker-compose.yml)
|
||||
|
||||
安装依赖(请使用python3)
|
||||
### 二进制文件部署(不推荐)
|
||||
|
||||
```pip install flask requests```
|
||||
一键部署脚本:
|
||||
|
||||
按需求修改`app/main.py`的前几项配置
|
||||
|
||||
*注意:* 可能需要在`return Response`前加两行
|
||||
```python3
|
||||
if 'Transfer-Encoding' in headers:
|
||||
headers.pop('Transfer-Encoding')
|
||||
```bash
|
||||
wget -O install.sh https://raw.githubusercontent.com/WJQSERVER-STUDIO/ghproxy/main/deploy/install.sh && chmod +x install.sh &&./install.sh
|
||||
```
|
||||
|
||||
### 注意
|
||||
Dev一键部署脚本:
|
||||
|
||||
python版本的机器如果无法正常访问github.io会启动报错,请自行修改静态文件url
|
||||
```bash
|
||||
wget -O install-dev.sh https://raw.githubusercontent.com/WJQSERVER-STUDIO/ghproxy/dev/deploy/install-dev.sh && chmod +x install-dev.sh && ./install-dev.sh
|
||||
```
|
||||
|
||||
python版本默认走服务器(2021.3.27更新)
|
||||
## 配置说明
|
||||
|
||||
## Cloudflare Workers计费
|
||||
参看[项目文档](https://github.com/WJQSERVER-STUDIO/ghproxy/blob/main/docs/config.md)
|
||||
|
||||
到 `overview` 页面可参看使用情况。免费版每天有 10 万次免费请求,并且有每分钟1000次请求的限制。
|
||||
### 前端页面
|
||||
|
||||
如果不够用,可升级到 $5 的高级版本,每月可用 1000 万次请求(超出部分 $0.5/百万次请求)。
|
||||
参看[GHProxy-Frontend](https://github.com/WJQSERVER-STUDIO/GHProxy-Frontend)
|
||||
|
||||
## Changelog
|
||||
## 项目简史
|
||||
|
||||
* 2020.04.10 增加对`raw.githubusercontent.com`文件的支持
|
||||
* 2020.04.09 增加Python版本(使用Flask)
|
||||
* 2020.03.23 新增了clone的支持
|
||||
* 2020.03.22 初始版本
|
||||
**本项目是[WJQSERVER-STUDIO/ghproxy-go](https://github.com/WJQSERVER-STUDIO/ghproxy-go)的重构版本,实现了原项目原定功能的同时,进一步优化了性能**
|
||||
关于此项目的详细开发过程,请参看Commit记录与[CHANGELOG.md](https://github.com/WJQSERVER-STUDIO/ghproxy/blob/main/CHANGELOG.md)
|
||||
|
||||
## 链接
|
||||
- v3.0.0 迁移到HertZ框架, 进一步提升效率
|
||||
- v2.4.1 对路径匹配进行优化
|
||||
- v2.0.0 对`proxy`核心模块进行了重构,大幅优化内存占用
|
||||
- v1.0.0 迁移至本仓库,并再次重构内容实现
|
||||
- v0.2.0 重构项目实现
|
||||
|
||||
[我的博客](https://hunsh.net)
|
||||
## LICENSE
|
||||
|
||||
## 参考
|
||||
本项目使用WJQserver Studio License 2.0 [WJQserver Studio License 2.0](https://wjqserver-studio.github.io/LICENSE/LICENSE.html)
|
||||
|
||||
[jsproxy](https://github.com/EtherDream/jsproxy/)
|
||||
在v2.3.0之前, 本项目使用WJQserver Studio License 1.2
|
||||
|
||||
## 捐赠
|
||||
在v1.0.0版本之前,本项目继承于[WJQSERVER-STUDIO/ghproxy-go](https://github.com/WJQSERVER-STUDIO/ghproxy-go)的APACHE2.0 LICENSE VERSION
|
||||
|
||||

|
||||

|
||||
## 赞助
|
||||
|
||||
如果您觉得本项目对您有帮助,欢迎赞助支持,您的赞助将用于Demo服务器开支及开发者时间成本支出,感谢您的支持!
|
||||
|
||||
为爱发电,开源不易
|
||||
|
||||
爱发电: https://afdian.com/a/wjqserver
|
||||
|
||||
USDT(TRC20): `TNfSYG6F2vkiibd6J6mhhHNWDgWgNdF5hN`
|
||||
|
||||
### 捐赠列表
|
||||
|
||||
| 赞助人 |金额|
|
||||
|--------|------|
|
||||
| starry | 8 USDT (TRC20) |
|
||||
|
|
@ -8,12 +8,12 @@ additionalProperties:
|
|||
name: gh-proxy
|
||||
tags:
|
||||
- Tool
|
||||
shortDescZh: GitHub release、archive 以及项目文件的加速项目
|
||||
shortDescZh: 支持 Git clone、raw、releases的 Github 加速项目, 支持自托管的同时带来卓越的性能与极低的资源占用(Golang和HertZ带来的优势), 同时支持多种额外功能
|
||||
shortDescEn: Acceleration project for GitHub releases, archives, and project files
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://github.com/hunshcn/gh-proxy
|
||||
github: https://github.com/hunshcn/gh-proxy
|
||||
document: https://github.com/hunshcn/gh-proxy
|
||||
website: https://github.com/WJQSERVER-STUDIO/ghproxy
|
||||
github: https://github.com/WJQSERVER-STUDIO/ghproxy
|
||||
document: https://github.com/WJQSERVER-STUDIO/ghproxy/blob/main/README.md
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
CONTAINER_NAME="gh-proxy"
|
||||
PANEL_APP_PORT_HTTP="40170"
|
||||
DATA_PATH="./data"
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 40170
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: "./data"
|
||||
disabled: true
|
||||
envKey: DATA_PATH
|
||||
labelEn: Data Path
|
||||
labelZh: 数据路径
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
services:
|
||||
gh-proxy:
|
||||
image: wjqserver/ghproxy:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
networks:
|
||||
- 1panel-network
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:8080"
|
||||
volumes:
|
||||
- ${DATA_PATH}/log:/data/ghproxy/log
|
||||
- ${DATA_PATH}/config:/data/ghproxy/config
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<div align="center">
|
||||
|
||||
# Kirara AI Chatbot Framework
|
||||
|
||||
[](https://github.com/lss233/chatgpt-mirai-qq-bot)
|
||||
|
||||
</div>
|
||||
|
||||
## 概述
|
||||
|
||||
Kirara 是一个基于插件生态和工作流系统的 AI 聊天机器人框架,支持多种 AI 模型和即时通讯平台。
|
||||
|
||||
## 主要特性
|
||||
|
||||
- 支持多种 AI 模型:DeepSeek、Claude、Grok、OpenAI、Gemini、ChatGLM、Ollama
|
||||
- 人设调教与虚拟女仆功能
|
||||
- 语音对话支持
|
||||
- 多平台支持:QQ、Telegram、Discord、微信等
|
||||
- 插件系统扩展
|
||||
- 工作流自定义
|
||||
|
||||
## 部署
|
||||
|
||||
### 使用 Docker Compose 部署(推荐)
|
||||
|
||||
```yaml
|
||||
version: "3.8"
|
||||
services:
|
||||
kirara-agent:
|
||||
image: lss233/kirara-agent-framework:latest
|
||||
container_name: kirara-agent
|
||||
restart: always
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:8080"
|
||||
```
|
||||
|
||||
启动命令:
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 直接使用 Docker 镜像
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name kirara-agent \
|
||||
--restart always \
|
||||
-v $(pwd)/data:/app/data \
|
||||
-p 8080:8080 \
|
||||
lss233/kirara-agent-framework:latest
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
环境变量配置:
|
||||
|
||||
| 变量名 | 描述 | 默认值 |
|
||||
|--------|------|--------|
|
||||
| PANEL_APP_PORT_HTTP | HTTP 服务端口 | 8080 |
|
||||
| DATA_PATH | 数据存储路径 | /app/data |
|
||||
|
||||
## 界面截图
|
||||
|
||||
(截图待添加)
|
||||
|
||||
## 交流与支持
|
||||
|
||||
- GitHub Issues: [https://github.com/lss233/chatgpt-mirai-qq-bot/issues](https://github.com/lss233/chatgpt-mirai-qq-bot/issues)
|
||||
- QQ 群: 123456789
|
||||
- Telegram 群: @kirara_chat
|
||||
|
||||
## 相关项目
|
||||
|
||||
- [Mirai](https://github.com/mamoe/mirai): QQ 协议实现
|
||||
- [ChatGPT-Mirai](https://github.com/lss233/chatgpt-mirai-qq-bot): 项目基础
|
||||
|
||||
## Star History
|
||||
|
||||
[](https://star-history.com/#lss233/chatgpt-mirai-qq-bot&Date)
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
name: kirara
|
||||
tags:
|
||||
- AI / 大模型
|
||||
- 聊天机器人
|
||||
title: Kirara AI 聊天机器人框架
|
||||
description: Kirara AI 聊天机器人框架
|
||||
additionalProperties:
|
||||
key: kirara
|
||||
name: kirara
|
||||
tags:
|
||||
- AI
|
||||
- Chatbot
|
||||
shortDescZh: 插件生态 x 工作流系统,DIY 你自己的 AI 聊天机器人!支持DeepSeek、Claude、Grok、OpenAI、Gemini、ChatGLM、Ollama,人设调教,虚拟女仆、语音对话 | 支持 QQ、Telegram、Discord、微信 等平台
|
||||
shortDescEn: Plugin ecosystem x workflow system, DIY your own AI chatbot! Supports DeepSeek, Claude, Grok, OpenAI, Gemini, ChatGLM, Ollama, character customization, virtual maid, voice chat | Supports QQ, Telegram, Discord, WeChat and other platforms
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://kirara-docs.app.lss233.com/
|
||||
github: https://github.com/lss233/chatgpt-mirai-qq-bot/
|
||||
document: https://github.com/lss233/chatgpt-mirai-qq-bot/blob/master/README.md
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 48080
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: ./data
|
||||
edit: true
|
||||
envKey: DATA_PATH
|
||||
labelEn: Data folder path
|
||||
labelZh: 数据文件夹路径
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
kirara-agent:
|
||||
image: lss233/kirara-agent-framework:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
volumes:
|
||||
- "${DATA_PATH}:/app/data"
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:8080"
|
||||
networks:
|
||||
- 1panel-network
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
After Width: | Height: | Size: 4.7 KiB |
|
|
@ -0,0 +1,17 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 40248
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: PASSWORD
|
||||
labelEn: Password
|
||||
labelZh: 密码
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
services:
|
||||
libreTV:
|
||||
image: "bestzwei/libretv:latest"
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
networks:
|
||||
- 1panel-network
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:8080"
|
||||
environment:
|
||||
- PASSWORD=${PASSWORD}
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
ACCESS_CODE="access_password"
|
||||
CONTAINER_NAME="lobe-chat"
|
||||
OPENAI_API_KEY="sk-xxx"
|
||||
OPENAI_MODEL_LIST=""
|
||||
OPENAI_PROXY_URL="https://api.openai.com/v1"
|
||||
PANEL_APP_PORT_HTTP="40247"
|
||||
SEARXNG_URL="https://searxng-instance.com"
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 40247
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: "password"
|
||||
edit: true
|
||||
envKey: OPENAI_API_KEY
|
||||
labelEn: OpenAI API Key
|
||||
labelZh: OpenAI API 密钥
|
||||
required: false
|
||||
type: password
|
||||
- default: "https://api.openai.com/v1"
|
||||
edit: true
|
||||
envKey: OPENAI_PROXY_URL
|
||||
labelEn: OpenAI Proxy URL
|
||||
labelZh: OpenAI 代理 URL
|
||||
required: false
|
||||
type: text
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: ACCESS_CODE
|
||||
labelEn: Access Code
|
||||
labelZh: 访问密码
|
||||
random: true
|
||||
required: false
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: OPENAI_MODEL_LIST
|
||||
labelEn: OpenAI Model List
|
||||
labelZh: OpenAI 模型列表
|
||||
required: false
|
||||
type: text
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: SEARXNG_URL
|
||||
labelEn: SEARXNG_URL
|
||||
labelZh: searxng地址
|
||||
required: false
|
||||
type: text
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
services:
|
||||
lobe-chat:
|
||||
image: lobehub/lobe-chat-pglite:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
networks:
|
||||
- 1panel-network
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:3210"
|
||||
environment:
|
||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
- OPENAI_PROXY_URL=${OPENAI_PROXY_URL}
|
||||
- ACCESS_CODE=${ACCESS_CODE}
|
||||
- OPENAI_MODEL_LIST=${OPENAI_MODEL_LIST}
|
||||
- SEARXNG_URL=${SEARXNG_URL}
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
<div align="center">
|
||||
|
||||
# ✨ Magic Resume ✨
|
||||
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||

|
||||

|
||||
|
||||
简体中文 | [English](./README.en-US.md)
|
||||
|
||||
</div>
|
||||
|
||||
Magic Resume 是一个现代化的在线简历编辑器,让创建专业简历变得简单有趣。基于 Next.js 和 Motion 构建,支持实时预览和自定义主题。
|
||||
|
||||
## 📸 项目截图
|
||||
|
||||

|
||||
|
||||
## ✨ 特性
|
||||
|
||||
- 🚀 基于 Next.js 14+ 构建
|
||||
- 💫 流畅的动画效果 (Motion)
|
||||
- 🎨 自定义主题支持
|
||||
- 🌙 深色模式
|
||||
- 📤 导出为 PDF
|
||||
- 🔄 实时预览
|
||||
- 💾 自动保存
|
||||
- 🔒 硬盘级存储
|
||||
|
||||
## 🛠️ 技术栈
|
||||
|
||||
- Next.js 14+
|
||||
- TypeScript
|
||||
- Motion
|
||||
- Tiptap
|
||||
- Tailwind CSS
|
||||
- Zustand
|
||||
- Shadcn/ui
|
||||
- Lucide Icons
|
||||
|
||||
## 🚀 快速开始
|
||||
|
||||
1. 克隆项目
|
||||
|
||||
```bash
|
||||
git clone git@github.com:JOYCEQL/magic-resume.git
|
||||
cd magic-resume
|
||||
```
|
||||
|
||||
2. 安装依赖
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
3. 启动开发服务器
|
||||
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
4. 打开浏览器访问 `http://localhost:3000`
|
||||
|
||||
## 📦 构建打包
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
|
||||
## ⚡ Vercel 部署
|
||||
|
||||
你可以一键部署自己的 Magic Resume 实例:
|
||||
|
||||
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FJOYCEQL%2Fmagic-resume)
|
||||
|
||||
## 🐳 Docker 部署
|
||||
|
||||
### Docker Compose
|
||||
|
||||
1. 确保你已经安装了 Docker 和 Docker Compose
|
||||
|
||||
2. 在项目根目录运行:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
这将会:
|
||||
|
||||
- 自动构建应用镜像
|
||||
- 在后台启动容器
|
||||
|
||||
### Docker Hub
|
||||
|
||||
最新版本的 Magic Resume 已经发布在 Docker Hub:
|
||||
|
||||
[Docker Hub](https://hub.docker.com/r/siyueqingchen/magic-resume/)
|
||||
|
||||
```bash
|
||||
docker pull siyueqingchen/magic-resume:main
|
||||
```
|
||||
|
||||
## 📝 开源协议
|
||||
|
||||
本项目采用 Apache 2.0 协议,但有一些自定义的部分 - 查看 [LICENSE](LICENSE) 了解详情
|
||||
|
||||
## 🗺️ 路线图
|
||||
|
||||
- [x] AI 辅助编写
|
||||
- [x] 多语言支持
|
||||
- [ ] 支持更多简历模板
|
||||
- [ ] 更多格式导出
|
||||
- [ ] 自定义模型
|
||||
- [ ] 智能一页
|
||||
- [ ] 导入 PDF, Markdown 等
|
||||
- [ ] 在线简历托管
|
||||
|
||||
## 📞 联系方式
|
||||
|
||||
可以通过以下方式关注最新动态:
|
||||
|
||||
- 作者:SiYue
|
||||
- X: @GuangzhouY81070
|
||||
- Discord: 欢迎加入群组 https://discord.gg/9mWgZrW3VN
|
||||
- 用户群:加微信 qingchensiyue
|
||||
- 邮箱:18806723365@163.com
|
||||
- 项目主页:https://github.com/JOYCEQL/magic-resume
|
||||
|
||||
## 🌟 支持项目
|
||||
|
||||
如果这个项目对你有帮助,欢迎点个 star ⭐️
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: Magic Resume
|
||||
tags:
|
||||
- 工具
|
||||
title: Magic Resume 是一个现代化的在线简历编辑器,让创建专业简历变得简单有趣。基于 Next.js 和 Motion 构建,支持实时预览和自定义主题。
|
||||
description: Magic Resume 是一个现代化的在线简历编辑器,让创建专业简历变得简单有趣。基于 Next.js 和 Motion 构建,支持实时预览和自定义主题。
|
||||
additionalProperties:
|
||||
key: magic-resume
|
||||
name: Magic Resume
|
||||
tags:
|
||||
- Tool
|
||||
shortDescZh: Magic Resume 是一个现代化的在线简历编辑器,让创建专业简历变得简单有趣。基于 Next.js 和 Motion 构建,支持实时预览和自定义主题。
|
||||
shortDescEn: Magic Resume is a modern online resume editor that makes creating professional resumes simple and enjoyable. Built with Next.js and Framer Motion, it supports real-time preview and custom themes
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://magicv.art/zh
|
||||
github: https://github.com/JOYCEQL/magic-resume
|
||||
document: https://github.com/JOYCEQL/magic-resume/blob/main/README.md
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
CONTAINER_NAME="magic-resume"
|
||||
PANEL_APP_PORT_HTTP="40250"
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 40170
|
||||
- default: 40250
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
services:
|
||||
gh-proxy:
|
||||
magic-resume:
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
networks:
|
||||
- 1panel-network
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:80"
|
||||
image: stilleshan/gh-proxy:2024-02-19
|
||||
- "${PANEL_APP_PORT_HTTP}:3000"
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
image: siyueqingchen/magic-resume:main
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
|
After Width: | Height: | Size: 5.8 KiB |
|
|
@ -0,0 +1,206 @@
|
|||
# MoonTV
|
||||
|
||||
<div align="center">
|
||||
<img src="public/logo.png" alt="LibreTV Logo" width="120">
|
||||
</div>
|
||||
|
||||
> 🎬 **MoonTV** 是一个开箱即用的、跨平台的影视聚合播放器。它基于 **Next.js 14** + **Tailwind CSS** + **TypeScript** 构建,支持多资源搜索、在线播放、收藏同步、播放记录、本地/云端存储,让你可以随时随地畅享海量免费影视内容。
|
||||
|
||||
<div align="center">
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
## ✨ 功能特性
|
||||
|
||||
- 🔍 **多源聚合搜索**:内置数十个免费资源站点,一次搜索立刻返回全源结果。
|
||||
- 📄 **丰富详情页**:支持剧集列表、演员、年份、简介等完整信息展示。
|
||||
- ▶️ **流畅在线播放**:集成 HLS.js & VidStack。
|
||||
- ❤️ **收藏 + 继续观看**:LocalStorage 存储,后续扩展 DB 存储。
|
||||
- 📱 **PWA**:离线缓存、安装到桌面/主屏,移动端原生体验。
|
||||
- 🌗 **响应式布局**:桌面侧边栏 + 移动底部导航,自适应各种屏幕尺寸。
|
||||
- 🚀 **极简部署**:一条 Docker 命令即可将完整服务跑起来,或免费部署到 Vercel。
|
||||
- 👿 **智能去广告**:自动跳过视频中的切片广告(实验性)
|
||||
|
||||
<details>
|
||||
<summary>点击查看项目截图</summary>
|
||||
<img src="public/screenshot.png" alt="项目截图" style="max-width:600px">
|
||||
</details>
|
||||
|
||||
## 🗺 目录
|
||||
|
||||
- [技术栈](#技术栈)
|
||||
- [部署](#部署)
|
||||
- [环境变量](#环境变量)
|
||||
- [配置说明](#配置说明)
|
||||
- [Roadmap](#roadmap)
|
||||
- [安全与隐私提醒](#安全与隐私提醒)
|
||||
- [License](#license)
|
||||
- [致谢](#致谢)
|
||||
|
||||
## 技术栈
|
||||
|
||||
| 分类 | 主要依赖 |
|
||||
| --------- | --------------------------------------------------------------------------------- |
|
||||
| 前端框架 | [Next.js 14](https://nextjs.org/) · App Router |
|
||||
| UI & 样式 | [Tailwind CSS 3](https://tailwindcss.com/) |
|
||||
| 语言 | TypeScript 4 |
|
||||
| 播放器 | [VidStack](https://vidstack.io/) · [HLS.js](https://github.com/video-dev/hls.js/) |
|
||||
| 代码质量 | ESLint · Prettier · Jest |
|
||||
| 部署 | Docker · Vercel |
|
||||
|
||||
## 部署
|
||||
|
||||
本项目支持 Vercel 和 Docker 部署,注意**不支持 Cloudflare**,后续亦无支持计划。
|
||||
|
||||
### Vercel 部署
|
||||
|
||||
> 推荐使用,零运维成本,免费额度足够个人使用。
|
||||
|
||||
1. **Fork** 本仓库到你的 GitHub 账户。
|
||||
2. 登陆 [Vercel](https://vercel.com/),点击 **Add New → Project**,选择 Fork 后的仓库。
|
||||
3. (强烈建议)设置 PASSWORD 环境变量。
|
||||
4. 保持默认设置完成首次部署。
|
||||
5. 如需自定义 `config.json`,请直接修改 Fork 后仓库中该文件。
|
||||
6. 每次 Push 到 `main` 分支将自动触发重新构建。
|
||||
|
||||
部署完成后即可通过分配的域名访问,也可以绑定自定义域名。
|
||||
|
||||
### Docker 部署
|
||||
|
||||
> 适用于自建服务器 / NAS / 群晖等场景。
|
||||
|
||||
#### 1. 直接运行(最简单)
|
||||
|
||||
```bash
|
||||
# 拉取预构建镜像
|
||||
docker pull ghcr.io/senshinya/moontv:latest
|
||||
|
||||
# 运行容器
|
||||
# -d: 后台运行 -p: 映射端口 3000 -> 3000
|
||||
docker run -d --name moontv -p 3000:3000 ghcr.io/senshinya/moontv:latest
|
||||
```
|
||||
|
||||
访问 `http://服务器 IP:3000` 即可。
|
||||
|
||||
#### 2. docker-compose 示例
|
||||
|
||||
```yaml
|
||||
version: '3.9'
|
||||
services:
|
||||
moontv:
|
||||
image: ghcr.io/senshinya/moontv:latest
|
||||
container_name: moontv
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '3000:3000'
|
||||
environment:
|
||||
- PASSWORD=your_password
|
||||
# 如需自定义配置,可挂载文件
|
||||
# volumes:
|
||||
# - ./config.json:/app/config.json:ro
|
||||
```
|
||||
|
||||
执行:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
随后同样访问 `http://服务器 IP:3000`。
|
||||
|
||||
### **请勿使用 Pull Bot 自动同步**
|
||||
|
||||
Pull Bot 会反复触发无效的 PR 和垃圾邮件,严重干扰项目维护。作者可能会直接拉黑所有 Pull Bot 自动发起的同步请求的仓库所有者。
|
||||
|
||||
**推荐做法:**
|
||||
|
||||
建议在 fork 的仓库中启用本仓库自带的 GitHub Actions 自动同步功能(见 `.github/workflows/sync.yml`)。
|
||||
|
||||
如需手动同步主仓库更新,也可以使用 GitHub 官方的 [Sync fork](https://docs.github.com/cn/github/collaborating-with-issues-and-pull-requests/syncing-a-fork) 功能。
|
||||
|
||||
## 环境变量
|
||||
|
||||
| 变量 | 说明 | 可选值 | 默认值 |
|
||||
| ----------------------------------- | ---------------------------------- | ---------------------------------------------------------------- | ------------ |
|
||||
| PASSWORD | 实例访问密码,留空则不启用密码保护 | 任意字符串 | (空) |
|
||||
| NEXT_PUBLIC_STORAGE_TYPE | 播放记录/收藏的存储方式 | localstorage(本地浏览器存储)、database(后端数据库,暂不支持) | localstorage |
|
||||
| NEXT_PUBLIC_ENABLE_BLOCKAD | 开启智能去广告功能(实验性) | true / false | false |
|
||||
| NEXT_PUBLIC_SEARCH_MAX_PAGE | 搜索接口可拉取的最大页数 | 1-50 | 5 |
|
||||
| NEXT_PUBLIC_AGGREGATE_SEARCH_RESULT | 搜索结果默认是否按标题和年份聚合 | true / false | true |
|
||||
|
||||
## 配置说明
|
||||
|
||||
所有可自定义项集中在根目录的 `config.json` 中:
|
||||
|
||||
```json
|
||||
{
|
||||
"cache_time": 7200,
|
||||
"api_site": {
|
||||
"dyttzy": {
|
||||
"api": "http://caiji.dyttzyapi.com/api.php/provide/vod",
|
||||
"name": "电影天堂资源",
|
||||
"detail": "http://caiji.dyttzyapi.com"
|
||||
}
|
||||
// ...更多站点
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `cache_time`:接口缓存时间(秒)。
|
||||
- `api_site`:你可以增删或替换任何资源站,字段说明:
|
||||
- `key`:唯一标识,保持小写字母/数字。
|
||||
- `api`:资源站提供的 `vod` JSON API 根地址。
|
||||
- `name`:在人机界面中展示的名称。
|
||||
- `detail`:(可选)部分无法通过 API 获取剧集详情的站点,需要提供网页详情根 URL,用于爬取。
|
||||
|
||||
MoonTV 支持标准的苹果 CMS V10 API 格式。
|
||||
|
||||
修改后 **无需重新构建**,服务会在启动时读取一次。
|
||||
|
||||
## Roadmap
|
||||
|
||||
- [ ] DB 存储
|
||||
- [ ] 深色模式
|
||||
|
||||
## 安全与隐私提醒
|
||||
|
||||
### 强烈建议设置密码保护
|
||||
|
||||
为了您的安全和避免潜在的法律风险,我们**强烈建议**在部署时设置密码保护:
|
||||
|
||||
- **避免公开访问**:不设置密码的实例任何人都可以访问,可能被恶意利用
|
||||
- **防范版权风险**:公开的视频搜索服务可能面临版权方的投诉举报
|
||||
- **保护个人隐私**:设置密码可以限制访问范围,保护您的使用记录
|
||||
|
||||
### 部署建议
|
||||
|
||||
1. **设置环境变量 `PASSWORD`**:为您的实例设置一个强密码
|
||||
2. **仅供个人使用**:请勿将您的实例链接公开分享或传播
|
||||
3. **遵守当地法律**:请确保您的使用行为符合当地法律法规
|
||||
|
||||
### 重要声明
|
||||
|
||||
- 本项目仅供学习和个人使用
|
||||
- 请勿将部署的实例用于商业用途或公开服务
|
||||
- 如因公开分享导致的任何法律问题,用户需自行承担责任
|
||||
- 项目开发者不对用户的使用行为承担任何法律责任
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE) © 2025 MoonTV & Contributors
|
||||
|
||||
## 致谢
|
||||
|
||||
- [ts-nextjs-tailwind-starter](https://github.com/theodorusclarence/ts-nextjs-tailwind-starter) — 项目最初基于该脚手架。
|
||||
- [LibreTV](https://github.com/LibreSpark/LibreTV) — 由此启发,站在巨人的肩膀上。
|
||||
- [VidStack](https://vidstack.io/) — 提供强大的网页视频播放器。
|
||||
- [HLS.js](https://github.com/video-dev/hls.js) — 实现 HLS 流媒体在浏览器中的播放支持。
|
||||
- 感谢所有提供免费影视接口的站点。
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: moontv
|
||||
tags:
|
||||
- 实用工具
|
||||
title: moontv - 免费在线视频搜索与观看平台
|
||||
description: 🎬 MoonTV 是一个开箱即用的、跨平台的影视聚合播放器。它基于 Next.js 14 + Tailwind CSS + TypeScript 构建,支持多资源搜索、在线播放、收藏同步、播放记录、本地/云端存储,让你可以随时随地畅享海量免费影视内容。
|
||||
additionalProperties:
|
||||
key: moontv
|
||||
name: moontv
|
||||
tags:
|
||||
- Tool
|
||||
shortDescZh: moontv - 免费在线视频搜索与观看平台
|
||||
shortDescEn: moontv - Free Online Video Search and Viewing Platform
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://github.com/senshinya/MoonTV
|
||||
github: https://github.com/senshinya/MoonTV
|
||||
document: https://github.com/senshinya/MoonTV/blob/main/README.md
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 40249
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: PASSWORD
|
||||
labelEn: Password
|
||||
labelZh: 密码
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
services:
|
||||
moontv:
|
||||
image: ghcr.io/senshinya/moontv:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
networks:
|
||||
- 1panel-network
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:3000"
|
||||
environment:
|
||||
- PASSWORD=${PASSWORD}
|
||||
- NEXT_PUBLIC_ENABLE_BLOCKAD=true
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
After Width: | Height: | Size: 200 KiB |
|
|
@ -0,0 +1,5 @@
|
|||
# neo-api
|
||||
|
||||
基于new-api的魔改版,部署流程请参考 new-api 教程
|
||||
[README.md](
|
||||
https://github.com/Calcium-Ion/new-api/blob/main/README.md)
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: neo api
|
||||
tags:
|
||||
- AI / 大模型
|
||||
title: OpenAI 接口管理 & 分发系统 new-api魔改版
|
||||
description: OpenAI 接口管理 & 分发系统 ,new-api魔改版
|
||||
additionalProperties:
|
||||
key: neo-api
|
||||
name: neo api
|
||||
tags:
|
||||
- AI
|
||||
shortDescZh: AI模型接口管理与分发系统,支持将多种大模型转为OpenAI格式调用、支持Midjourney Proxy、Suno、Rerank,兼容易支付协议,可供个人或者企业内部管理与分发渠道使用,本项目基于One API二次开发。
|
||||
shortDescEn: Access all LLM through the standard OpenAI API format, easy to deploy & use
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://github.com/wozulong/neo-api
|
||||
github: https://github.com/wozulong/neo-api
|
||||
document: https://github.com/wozulong/neo-api
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: PANEL_DB_HOST
|
||||
key: mysql
|
||||
labelEn: Database Service
|
||||
labelZh: 数据库服务
|
||||
required: true
|
||||
type: service
|
||||
- default: neoapi
|
||||
edit: true
|
||||
envKey: PANEL_DB_NAME
|
||||
labelEn: Database
|
||||
labelZh: 数据库名
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: neoapi
|
||||
edit: true
|
||||
envKey: PANEL_DB_USER
|
||||
labelEn: User
|
||||
labelZh: 数据库用户
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: neoapi
|
||||
edit: true
|
||||
envKey: PANEL_DB_USER_PASSWORD
|
||||
labelEn: Password
|
||||
labelZh: 数据库用户密码
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: 3000
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Time Zone
|
||||
labelZh: 时区
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
services:
|
||||
neo-api:
|
||||
image: pengzhile/new-api:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- ${PANEL_APP_PORT_HTTP}:3000
|
||||
networks:
|
||||
- 1panel-network
|
||||
command: --log-dir /app/logs
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./logs:/app/logs
|
||||
environment:
|
||||
- SQL_DSN=${PANEL_DB_USER}:${PANEL_DB_USER_PASSWORD}@tcp(${PANEL_DB_HOST}:3306)/${PANEL_DB_NAME} # 修改此行,或注释掉以使用 SQLite 作为数据库
|
||||
- TZ=${TZ}
|
||||
# - SESSION_SECRET=${SESSION_SECRET}
|
||||
# - REDIS_CONN_STRING=redis://redis
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
|
|
@ -0,0 +1,17 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 3000
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Time Zone
|
||||
labelZh: 时区
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
services:
|
||||
neo-api:
|
||||
image: pengzhile/new-api:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- ${PANEL_APP_PORT_HTTP}:3000
|
||||
networks:
|
||||
- 1panel-network
|
||||
command: --log-dir /app/logs
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./logs:/app/logs
|
||||
environment:
|
||||
- TZ=${TZ}
|
||||
# - SESSION_SECRET=${SESSION_SECRET}
|
||||
# - REDIS_CONN_STRING=redis://redis
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
<div align="center">
|
||||
|
||||

|
||||
|
||||
# New API
|
||||
|
||||
<a href="https://trendshift.io/repositories/8227" target="_blank"><img src="https://trendshift.io/api/badge/repositories/8227" alt="Calcium-Ion%2Fnew-api | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||
|
||||
</div>
|
||||
|
||||
> [!NOTE]
|
||||
> 本项目为开源项目,在[One API](https://github.com/songquanpeng/one-api)的基础上进行二次开发
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 使用者必须在遵循 OpenAI 的[使用条款](https://openai.com/policies/terms-of-use)以及**法律法规**的情况下使用,不得用于非法用途。
|
||||
> 本项目仅供个人学习使用,不保证稳定性,且不提供任何技术支持。
|
||||
> 根据[《生成式人工智能服务管理暂行办法》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm)的要求,请勿对中国地区公众提供一切未经备案的生成式人工智能服务。
|
||||
|
||||
> [!TIP]
|
||||
> 最新版Docker镜像:`calciumion/new-api:latest`
|
||||
> 默认账号root 密码123456
|
||||
> 更新指令:
|
||||
> ```
|
||||
> docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR
|
||||
> ```
|
||||
|
||||
|
||||
## 主要变更
|
||||
此分叉版本的主要变更如下:
|
||||
|
||||
1. 全新的UI界面(部分界面还待更新)
|
||||
2. 添加[Midjourney-Proxy(Plus)](https://github.com/novicezk/midjourney-proxy)接口的支持,[对接文档](Midjourney.md)
|
||||
3. 支持在线充值功能,可在系统设置中设置,当前支持的支付接口:
|
||||
+ [x] 易支付
|
||||
4. 支持用key查询使用额度:
|
||||
+ 配合项目[neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool)可实现用key查询使用
|
||||
5. 渠道显示已使用额度,支持指定组织访问
|
||||
6. 分页支持选择每页显示数量
|
||||
7. 兼容原版One API的数据库,可直接使用原版数据库(one-api.db)
|
||||
8. 支持模型按次数收费,可在 系统设置-运营设置 中设置
|
||||
9. 支持渠道**加权随机**
|
||||
10. 数据看板
|
||||
11. 可设置令牌能调用的模型
|
||||
12. 支持Telegram授权登录。
|
||||
1. 系统设置-配置登录注册-允许通过Telegram登录
|
||||
2. 对[@Botfather](https://t.me/botfather)输入指令/setdomain
|
||||
3. 选择你的bot,然后输入http(s)://你的网站地址/login
|
||||
4. Telegram Bot 名称是bot username 去掉@后的字符串
|
||||
13. 添加 [Suno API](https://github.com/Suno-API/Suno-API)接口的支持,[对接文档](Suno.md)
|
||||
14. 支持Rerank模型,目前仅兼容Cohere和Jina,可接入Dify,[对接文档](Rerank.md)
|
||||
15. **[OpenAI Realtime API](https://platform.openai.com/docs/guides/realtime/integration)** - 支持OpenAI的Realtime API,支持Azure渠道。
|
||||
|
||||
## 模型支持
|
||||
此版本额外支持以下模型:
|
||||
1. 第三方模型 **gps** (gpt-4-gizmo-*)
|
||||
2. 智谱glm-4v,glm-4v识图
|
||||
3. Anthropic Claude 3
|
||||
4. [Ollama](https://github.com/ollama/ollama?tab=readme-ov-file),添加渠道时,密钥可以随便填写,默认的请求地址是[http://localhost:11434](http://localhost:11434),如果需要修改请在渠道中修改
|
||||
5. [Midjourney-Proxy(Plus)](https://github.com/novicezk/midjourney-proxy)接口,[对接文档](Midjourney.md)
|
||||
6. [零一万物](https://platform.lingyiwanwu.com/)
|
||||
7. 自定义渠道,支持填入完整调用地址
|
||||
8. [Suno API](https://github.com/Suno-API/Suno-API) 接口,[对接文档](Suno.md)
|
||||
9. Rerank模型,目前支持[Cohere](https://cohere.ai/)和[Jina](https://jina.ai/),[对接文档](Rerank.md)
|
||||
10. Dify
|
||||
11. Vertex AI,目前兼容Claude,Gemini,Llama3.1
|
||||
|
||||
您可以在渠道中添加自定义模型gpt-4-gizmo-*,此模型并非OpenAI官方模型,而是第三方模型,使用官方key无法调用。
|
||||
|
||||
## 比原版One API多出的配置
|
||||
- `GENERATE_DEFAULT_TOKEN`:是否为新注册用户生成初始令牌,默认为 `false`。
|
||||
- `STREAMING_TIMEOUT`:设置流式一次回复的超时时间,默认为 60 秒。
|
||||
- `DIFY_DEBUG`:设置 Dify 渠道是否输出工作流和节点信息到客户端,默认为 `true`。
|
||||
- `FORCE_STREAM_OPTION`:是否覆盖客户端stream_options参数,请求上游返回流模式usage,默认为 `true`,建议开启,不影响客户端传入stream_options参数返回结果。
|
||||
- `GET_MEDIA_TOKEN`:是否统计图片token,默认为 `true`,关闭后将不再在本地计算图片token,可能会导致和上游计费不同,此项覆盖 `GET_MEDIA_TOKEN_NOT_STREAM` 选项作用。
|
||||
- `GET_MEDIA_TOKEN_NOT_STREAM`:是否在非流(`stream=false`)情况下统计图片token,默认为 `true`。
|
||||
- `UPDATE_TASK`:是否更新异步任务(Midjourney、Suno),默认为 `true`,关闭后将不会更新任务进度。
|
||||
- `GEMINI_MODEL_MAP`:Gemini模型指定版本(v1/v1beta),使用“模型:版本”指定,","分隔,例如:-e GEMINI_MODEL_MAP="gemini-1.5-pro-latest:v1beta,gemini-1.5-pro-001:v1beta",为空则使用默认配置(v1beta)
|
||||
- `COHERE_SAFETY_SETTING`:Cohere模型[安全设置](https://docs.cohere.com/docs/safety-modes#overview),可选值为 `NONE`, `CONTEXTUAL`,`STRICT`,默认为 `NONE`。
|
||||
## 部署
|
||||
### 部署要求
|
||||
- 本地数据库(默认):SQLite(Docker 部署默认使用 SQLite,必须挂载 `/data` 目录到宿主机)
|
||||
- 远程数据库:MySQL 版本 >= 5.7.8,PgSQL 版本 >= 9.6
|
||||
|
||||
### 使用宝塔面板Docker功能部署
|
||||
安装宝塔面板 (**9.2.0版本**及以上),前往 [宝塔面板](https://www.bt.cn/new/download.html) 官网,选择正式版的脚本下载安装
|
||||
安装后登录宝塔面板,在菜单栏中点击 Docker ,首次进入会提示安装 Docker 服务,点击立即安装,按提示完成安装
|
||||
安装完成后在应用商店中找到 **New-API** ,点击安装,配置基本选项 即可完成安装
|
||||
[图文教程](BT.md)
|
||||
|
||||
### 基于 Docker 进行部署
|
||||
### 使用 Docker Compose 部署(推荐)
|
||||
```shell
|
||||
# 下载项目
|
||||
git clone https://github.com/Calcium-Ion/new-api.git
|
||||
cd new-api
|
||||
# 按需编辑 docker-compose.yml
|
||||
# 启动
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 直接使用 Docker 镜像
|
||||
```shell
|
||||
# 使用 SQLite 的部署命令:
|
||||
docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
|
||||
# 使用 MySQL 的部署命令,在上面的基础上添加 `-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi"`,请自行修改数据库连接参数。
|
||||
# 例如:
|
||||
docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
|
||||
```
|
||||
|
||||
## 渠道重试
|
||||
渠道重试功能已经实现,可以在`设置->运营设置->通用设置`设置重试次数,**建议开启缓存**功能。
|
||||
如果开启了重试功能,第一次重试使用同优先级,第二次重试使用下一个优先级,以此类推。
|
||||
### 缓存设置方法
|
||||
1. `REDIS_CONN_STRING`:设置之后将使用 Redis 作为缓存使用。
|
||||
+ 例子:`REDIS_CONN_STRING=redis://default:redispw@localhost:49153`
|
||||
2. `MEMORY_CACHE_ENABLED`:启用内存缓存(如果设置了`REDIS_CONN_STRING`,则无需手动设置),会导致用户额度的更新存在一定的延迟,可选值为 `true` 和 `false`,未设置则默认为 `false`。
|
||||
+ 例子:`MEMORY_CACHE_ENABLED=true`
|
||||
### 为什么有的时候没有重试
|
||||
这些错误码不会重试:400,504,524
|
||||
### 我想让400也重试
|
||||
在`渠道->编辑`中,将`状态码复写`改为
|
||||
```json
|
||||
{
|
||||
"400": "500"
|
||||
}
|
||||
```
|
||||
可以实现400错误转为500错误,从而重试
|
||||
|
||||
## Midjourney接口设置文档
|
||||
[对接文档](Midjourney.md)
|
||||
|
||||
## Suno接口设置文档
|
||||
[对接文档](Suno.md)
|
||||
|
||||
## 界面截图
|
||||

|
||||
|
||||

|
||||

|
||||
|
||||

|
||||
夜间模式
|
||||

|
||||

|
||||
|
||||
## 交流群
|
||||
<img src="https://github.com/user-attachments/assets/9ca0bc82-e057-4230-a28d-9f198fa022e3" width="200">
|
||||
|
||||
## 相关项目
|
||||
- [One API](https://github.com/songquanpeng/one-api):原版项目
|
||||
- [Midjourney-Proxy](https://github.com/novicezk/midjourney-proxy):Midjourney接口支持
|
||||
- [chatnio](https://github.com/Deeptrain-Community/chatnio):下一代 AI 一站式 B/C 端解决方案
|
||||
- [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool):用key查询使用额度
|
||||
|
||||
## Star History
|
||||
|
||||
[](https://star-history.com/#Calcium-Ion/new-api&Date)
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: new api
|
||||
tags:
|
||||
- AI / 大模型
|
||||
title: OpenAI 接口管理 & 分发系统
|
||||
description: OpenAI 接口管理 & 分发系统
|
||||
additionalProperties:
|
||||
key: new-api
|
||||
name: new api
|
||||
tags:
|
||||
- AI
|
||||
shortDescZh: AI模型接口管理与分发系统,支持将多种大模型转为OpenAI格式调用、支持Midjourney Proxy、Suno、Rerank,兼容易支付协议,可供个人或者企业内部管理与分发渠道使用,本项目基于One API二次开发。
|
||||
shortDescEn: Access all LLM through the standard OpenAI API format, easy to deploy & use
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://nekoapi.com/
|
||||
github: https://github.com/Calcium-Ion/new-api
|
||||
document: https://github.com/Calcium-Ion/new-api/blob/main/README.md
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: PANEL_DB_HOST
|
||||
key: mysql
|
||||
labelEn: Database Service
|
||||
labelZh: 数据库服务
|
||||
required: true
|
||||
type: service
|
||||
- default: newapi
|
||||
edit: true
|
||||
envKey: PANEL_DB_NAME
|
||||
labelEn: Database
|
||||
labelZh: 数据库名
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: newapi
|
||||
edit: true
|
||||
envKey: PANEL_DB_USER
|
||||
labelEn: User
|
||||
labelZh: 数据库用户
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: newapi
|
||||
edit: true
|
||||
envKey: PANEL_DB_USER_PASSWORD
|
||||
labelEn: Password
|
||||
labelZh: 数据库用户密码
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: 3000
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Time Zone
|
||||
labelZh: 时区
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
services:
|
||||
new-api:
|
||||
image: calciumion/new-api:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- ${PANEL_APP_PORT_HTTP}:3000
|
||||
networks:
|
||||
- 1panel-network
|
||||
command: --log-dir /app/logs
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./logs:/app/logs
|
||||
environment:
|
||||
- SQL_DSN=${PANEL_DB_USER}:${PANEL_DB_USER_PASSWORD}@tcp(${PANEL_DB_HOST}:3306)/${PANEL_DB_NAME} # 修改此行,或注释掉以使用 SQLite 作为数据库
|
||||
- TZ=${TZ}
|
||||
# - SESSION_SECRET=${SESSION_SECRET}
|
||||
# - REDIS_CONN_STRING=redis://redis
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
After Width: | Height: | Size: 7.6 KiB |
|
|
@ -0,0 +1,17 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 3000
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Time Zone
|
||||
labelZh: 时区
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
services:
|
||||
new-api:
|
||||
image: calciumion/new-api:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- ${PANEL_APP_PORT_HTTP}:3000
|
||||
networks:
|
||||
- 1panel-network
|
||||
command: --log-dir /app/logs
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./logs:/app/logs
|
||||
environment:
|
||||
- TZ=${TZ}
|
||||
# - SESSION_SECRET=${SESSION_SECRET}
|
||||
# - REDIS_CONN_STRING=redis://redis
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 3000
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Time Zone
|
||||
labelZh: 时区
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
services:
|
||||
new-api:
|
||||
image: ghcr.io/veloera/veloera:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- ${PANEL_APP_PORT_HTTP}:3000
|
||||
networks:
|
||||
- 1panel-network
|
||||
command: --log-dir /app/logs
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./logs:/app/logs
|
||||
environment:
|
||||
- TZ=${TZ}
|
||||
# - SESSION_SECRET=${SESSION_SECRET}
|
||||
# - REDIS_CONN_STRING=redis://redis
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
[中文文档](readme-zh.md) / [English Document](README.md)
|
||||
|
||||
# Better Sync Service
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/github/release/haierkeys/obsidian-better-sync-service" alt="version">
|
||||
<img src="https://img.shields.io/github/license/haierkeys/obsidian-better-sync-service" alt="license">
|
||||
</p>
|
||||
|
||||
[BetterSync For Obsidian](https://github.com/haierkeys/obsidian-better-sync) 服务端,基于 Golang + Websocket
|
||||
构建的高性能笔记实时同步服务
|
||||
|
||||
## 功能清单
|
||||
|
||||
- [x] 多端笔记实时同步
|
||||
- [ ] 笔记云存储同步备份 - s3
|
||||
- [ ] 笔记云存储同步备份 - 阿里云
|
||||
- [ ] 笔记云存储同步备份 - CF R2
|
||||
- [ ] 笔记云存储同步备份 - minio
|
||||
- [ ] 笔记云存储同步备份 - webdav
|
||||
- [ ] 笔记云存储同步备份 - 增加备份策略
|
||||
- [x] Web页面管理
|
||||
- [x] 目前仅支持 Sqlite 存储
|
||||
- [ ] 增加git维护版本
|
||||
- [ ] 基于 google-diff-match-patch 算法优化
|
||||
|
||||
## BUGLIST (已知问题)
|
||||
|
||||
- webgui 除了登录/注册/复制配置之外的 界面无实际功能或点击异常
|
||||
- 部分用户连接ws后, 认证成功,但是不显示nickname
|
||||
|
||||
## 更新日志
|
||||
|
||||
查看完整的更新内容,请访问 [Changelog](https://github.com/haierkeys/obsidian-better-sync-service/releases)。
|
||||
|
||||
## 价格
|
||||
|
||||
本软件是开源且免费的。如果您想表示感谢或帮助支持继续开发,可以通过以下方式为我提供支持:
|
||||
|
||||
[<img src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3" alt="BuyMeACoffee" width="100">](https://ko-fi.com/haierkeys)
|
||||
|
||||
## 私有部署
|
||||
|
||||
- 目录设置
|
||||
|
||||
```bash
|
||||
# 创建项目所需的目录
|
||||
mkdir -p /data/better-sync
|
||||
cd /data/better-sync
|
||||
|
||||
mkdir -p ./config && mkdir -p ./storage/logs && mkdir -p ./storage/uploads
|
||||
```
|
||||
|
||||
首次启动如果不下载配置文件,程序会自动生成一个默认配置到 **config/config.yaml**
|
||||
|
||||
如果你想从网络下载一个默认配置 使用以下命令来下载
|
||||
|
||||
```bash
|
||||
# 从开源库下载默认配置文件到配置目录
|
||||
wget -P ./config/ https://raw.githubusercontent.com/haierkeys/obsidian-better-sync-service/main/config/config.yaml
|
||||
```
|
||||
|
||||
- 二进制安装
|
||||
|
||||
从 [Releases](https://github.com/haierkeys/obsidian-better-sync-service/releases) 下载最新版本,解压后执行:
|
||||
|
||||
```bash
|
||||
./better-sync-service run -c config/config.yaml
|
||||
```
|
||||
|
||||
|
||||
- 容器化安装(Docker 方式)
|
||||
|
||||
Docker 命令:
|
||||
|
||||
```bash
|
||||
# 拉取最新的容器镜像
|
||||
docker pull haierkeys/obsidian-better-sync-service:latest
|
||||
|
||||
# 创建并启动容器
|
||||
docker run -tid --name better-sync-service \
|
||||
-p 9000:9000 -p 9001:9001 \
|
||||
-v /data/better-sync/storage/:/better-sync/storage/ \
|
||||
-v /data/better-sync/config/:/better-sync/config/ \
|
||||
haierkeys/obsidian-better-sync-service:latest
|
||||
```
|
||||
|
||||
Docker Compose
|
||||
使用 *containrrr/watchtower* 来监听镜像实现自动更新项目
|
||||
**docker-compose.yaml** 内容如下
|
||||
|
||||
```yaml
|
||||
# docker-compose.yaml
|
||||
services:
|
||||
better-sync:
|
||||
image: haierkeys/obsidian-better-sync-service:latest # 你的应用镜像
|
||||
container_name: better-sync
|
||||
ports:
|
||||
- "9000:9000" # 映射端口 9000
|
||||
- "9001:9001" # 映射端口 9001
|
||||
volumes:
|
||||
- /data/better-sync/storage/:/better-sync/storage/ # 映射存储目录
|
||||
- /data/better-sync/config/:/better-sync/config/ # 映射配置目录
|
||||
|
||||
```
|
||||
|
||||
执行 **docker compose**
|
||||
|
||||
以服务方式注册 docker 容器
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
注销并销毁 docker 容器
|
||||
|
||||
```bash
|
||||
docker compose down
|
||||
```
|
||||
|
||||
### 使用
|
||||
|
||||
访问 `WebGUI` 地址 `http://{IP:PORT}`
|
||||
|
||||
点击在 复制 API 配置 获取配置信息, 到 `BetterSync For Obsidian` 插件中粘贴即可
|
||||
|
||||
首次访问需要进行用户注册,如需关闭注册, 请修改 `user.register-is-enable` 为 `false`
|
||||
|
||||
### 配置说明
|
||||
|
||||
默认的配置文件名为 **config.yaml**,请将其放置在 **根目录** 或 **config** 目录下。
|
||||
|
||||
更多配置详情请参考:
|
||||
|
||||
- [config/config.yaml](config/config.yaml)
|
||||
|
||||
## 其他资源
|
||||
|
||||
- [Better Sync For Obsidian](https://github.com/haierkeys/obsidian-better-sync)
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: Obsidian BetterSync
|
||||
tags:
|
||||
- 实用工具
|
||||
title: Obsidian 在线同步插件
|
||||
description: Obsidian 在线同步插件
|
||||
additionalProperties:
|
||||
key: better-sync-service
|
||||
name: Obsidian BetterSync
|
||||
tags:
|
||||
- Tool
|
||||
shortDescZh: Obsidian 在线同步插件
|
||||
shortDescEn: Obsidian BetterSync
|
||||
type: website
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://github.com/haierkeys/obsidian-better-sync-service
|
||||
github: https://github.com/haierkeys/obsidian-better-sync-service
|
||||
document: https://github.com/haierkeys/obsidian-better-sync-service/blob/master/readme-zh.md
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: 40166
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: HTTP Port
|
||||
labelZh: HTTP端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: 40167
|
||||
edit: true
|
||||
envKey: PRIVATE_HTTP_LISTEN
|
||||
labelEn: private-http-listen
|
||||
labelZh: 性能监控接口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: ./data
|
||||
edit: true
|
||||
envKey: DATA_PATH
|
||||
labelEn: Data folder path
|
||||
labelZh: 数据文件夹路径
|
||||
required: true
|
||||
type: text
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
services:
|
||||
better-sync:
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:9000"
|
||||
- "${PRIVATE_HTTP_LISTEN}:9001"
|
||||
volumes:
|
||||
- ${DATA_PATH}/storage:/better-sync/storage/
|
||||
- ${DATA_PATH}/config:/better-sync/config/
|
||||
image: haierkeys/obsidian-better-sync-service:latest
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
networks:
|
||||
- 1panel-network
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
||||
|
After Width: | Height: | Size: 6.2 KiB |
|
|
@ -0,0 +1,48 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: ""
|
||||
envKey: PANEL_DB_HOST
|
||||
key: mysql
|
||||
labelEn: Database Service
|
||||
labelZh: 数据库服务
|
||||
required: true
|
||||
type: service
|
||||
- default: oneapi
|
||||
envKey: PANEL_DB_NAME
|
||||
labelEn: Database
|
||||
labelZh: 数据库名
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: oneapi
|
||||
envKey: PANEL_DB_USER
|
||||
labelEn: User
|
||||
labelZh: 数据库用户
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: oneapi
|
||||
envKey: PANEL_DB_USER_PASSWORD
|
||||
labelEn: Password
|
||||
labelZh: 数据库用户密码
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: 3000
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Time Zone
|
||||
labelZh: 时区
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
services:
|
||||
one-api:
|
||||
image: justsong/one-api:v0.6.8
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- ${PANEL_APP_PORT_HTTP}:3000
|
||||
networks:
|
||||
- 1panel-network
|
||||
volumes:
|
||||
- ./data:/data
|
||||
environment:
|
||||
- SQL_DSN=${PANEL_DB_USER}:${PANEL_DB_USER_PASSWORD}@tcp(${PANEL_DB_HOST}:3306)/${PANEL_DB_NAME} # 修改此行,或注释掉以使用 SQLite 作为数据库
|
||||
- TZ=${TZ}
|
||||
# - REDIS_CONN_STRING=redis://redis
|
||||
# - SESSION_SECRET=random_string # 修改为随机字符串
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
# 使用说明
|
||||
|
||||
- 默认账户密码
|
||||
|
||||
```
|
||||
username:root
|
||||
password:123456
|
||||
```
|
||||
|
||||
# One API
|
||||
|
||||
**One API** 是一个通过标准的 OpenAI API 格式访问所有的大模型,开箱即用。
|
||||
|
||||
## 主要功能:
|
||||
|
||||
- 支持多种大模型:
|
||||
+ [x] [OpenAI ChatGPT 系列模型](https://platform.openai.com/docs/guides/gpt/chat-completions-api)(支持 [Azure OpenAI API](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference))
|
||||
+ [x] [Anthropic Claude 系列模型](https://anthropic.com)
|
||||
+ [x] [Google PaLM2/Gemini 系列模型](https://developers.generativeai.google)
|
||||
+ [x] [百度文心一言系列模型](https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html)
|
||||
+ [x] [阿里通义千问系列模型](https://help.aliyun.com/document_detail/2400395.html)
|
||||
+ [x] [讯飞星火认知大模型](https://www.xfyun.cn/doc/spark/Web.html)
|
||||
+ [x] [智谱 ChatGLM 系列模型](https://bigmodel.cn)
|
||||
+ [x] [360 智脑](https://ai.360.cn)
|
||||
+ [x] [腾讯混元大模型](https://cloud.tencent.com/document/product/1729)
|
||||
- 支持配置镜像以及众多第三方代理服务。
|
||||
- 支持通过**负载均衡**的方式访问多个渠道。
|
||||
- 支持 **stream 模式**,可以通过流式传输实现打字机效果。
|
||||
- 支持**多机部署**。
|
||||
- 支持**令牌管理**,设置令牌的过期时间和额度。
|
||||
- 支持**兑换码管理**,支持批量生成和导出兑换码,可使用兑换码为账户进行充值。
|
||||
- 支持**通道管理**,批量创建通道。
|
||||
- 支持**用户分组**以及**渠道分组**,支持为不同分组设置不同的倍率。
|
||||
- 支持渠道**设置模型列表**。
|
||||
- 支持**查看额度明细**。
|
||||
- 支持**用户邀请奖励**。
|
||||
- 支持以美元为单位显示额度。
|
||||
- 支持发布公告,设置充值链接,设置新用户初始额度。
|
||||
- 支持模型映射,重定向用户的请求模型,如无必要请不要设置,设置之后会导致请求体被重新构造而非直接透传,会导致部分还未正式支持的字段无法传递成功。
|
||||
- 支持失败自动重试。
|
||||
- 支持绘图接口。
|
||||
- 支持 [Cloudflare AI Gateway](https://developers.cloudflare.com/ai-gateway/providers/openai/),渠道设置的代理部分填写 `https://gateway.ai.cloudflare.com/v1/ACCOUNT_TAG/GATEWAY/openai` 即可。
|
||||
- 持丰富的**自定义**设置,
|
||||
1. 支持自定义系统名称,logo 以及页脚。
|
||||
2. 支持自定义首页和关于页面,可以选择使用 HTML & Markdown 代码进行自定义,或者使用一个单独的网页通过 iframe 嵌入。
|
||||
- 支持通过系统访问令牌访问管理 API(bearer token,用以替代 cookie,你可以自行抓包来查看 API 的用法)。
|
||||
- 支持 Cloudflare Turnstile 用户校验。
|
||||
- 支持用户管理,支持**多种用户登录注册方式**:
|
||||
+ 邮箱登录注册(支持注册邮箱白名单)以及通过邮箱进行密码重置。
|
||||
+ [GitHub 开放授权](https://github.com/settings/applications/new)。
|
||||
+ 微信公众号授权(需要额外部署 [WeChat Server](https://github.com/songquanpeng/wechat-server))。
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: One API
|
||||
tags:
|
||||
- AI / 大模型
|
||||
title: OpenAI 接口管理 & 分发系统
|
||||
description: OpenAI 接口管理 & 分发系统
|
||||
additionalProperties:
|
||||
key: one-api
|
||||
name: One API
|
||||
tags:
|
||||
- AI
|
||||
shortDescZh: 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
|
||||
shortDescEn: Access all LLM through the standard OpenAI API format, easy to deploy & use
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://openai.justsong.cn/
|
||||
github: https://github.com/songquanpeng/one-api
|
||||
document: https://github.com/songquanpeng/one-api
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: ""
|
||||
envKey: PANEL_DB_HOST
|
||||
key: mysql
|
||||
labelEn: Database Service
|
||||
labelZh: 数据库服务
|
||||
required: true
|
||||
type: service
|
||||
- default: oneapi
|
||||
envKey: PANEL_DB_NAME
|
||||
labelEn: Database
|
||||
labelZh: 数据库名
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: oneapi
|
||||
envKey: PANEL_DB_USER
|
||||
labelEn: User
|
||||
labelZh: 数据库用户
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: oneapi
|
||||
envKey: PANEL_DB_USER_PASSWORD
|
||||
labelEn: Password
|
||||
labelZh: 数据库用户密码
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: 3000
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Time Zone
|
||||
labelZh: 时区
|
||||
required: true
|
||||
type: text
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
services:
|
||||
one-api:
|
||||
image: justsong/one-api:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- ${PANEL_APP_PORT_HTTP}:3000
|
||||
networks:
|
||||
- 1panel-network
|
||||
volumes:
|
||||
- ./data:/data
|
||||
environment:
|
||||
- SQL_DSN=${PANEL_DB_USER}:${PANEL_DB_USER_PASSWORD}@tcp(${PANEL_DB_HOST}:3306)/${PANEL_DB_NAME} # 修改此行,或注释掉以使用 SQLite 作为数据库
|
||||
- TZ=${TZ}
|
||||
# - REDIS_CONN_STRING=redis://redis
|
||||
# - SESSION_SECRET=random_string # 修改为随机字符串
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
|
|
@ -0,0 +1,131 @@
|
|||
<p align="right">
|
||||
<strong>中文</strong> | <a href="./README.en.md">English</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/MartialBE/one-hub/assets/42402987/c4125d1a-5577-446d-ba15-2a71c52140c1">
|
||||
<img height="90" src="https://raw.githubusercontent.com/MartialBE/one-api/main/web/src/assets/images/logo.svg">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
|
||||
# One Hub
|
||||
|
||||
_本项目是基于[one-api](https://github.com/songquanpeng/one-api)二次开发而来的_
|
||||
|
||||
<p align="center">
|
||||
<a href="https://raw.githubusercontent.com/MartialBE/one-api/main/LICENSE">
|
||||
<img src="https://img.shields.io/github/license/MartialBE/one-api?color=brightgreen" alt="license">
|
||||
</a>
|
||||
<a href="https://github.com/MartialBE/one-hub/releases/latest">
|
||||
<img src="https://img.shields.io/github/v/release/MartialBE/one-api?color=brightgreen&include_prereleases" alt="release">
|
||||
</a>
|
||||
<a href="https://github.com/users/MartialBE/packages/container/package/one-api">
|
||||
<img src="https://img.shields.io/badge/docker-ghcr.io-blue" alt="docker">
|
||||
</a>
|
||||
<a href="https://hub.docker.com/r/martialbe/one-api">
|
||||
<img src="https://img.shields.io/badge/docker-dockerHub-blue" alt="docker">
|
||||
</a>
|
||||
<a href="https://goreportcard.com/report/github.com/MartialBE/one-api">
|
||||
<img src="https://goreportcard.com/badge/github.com/MartialBE/one-api" alt="GoReportCard">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
**请不要和原版混用,因为新增功能,数据库与原版不兼容**
|
||||
|
||||
**为了更加简洁,本项目之后,除了新增供应商时会更新程序自带的模型列表,平常不再更新程序自带的模型列表。**
|
||||
|
||||
**如果发现缺少新模型,请在`后台-模型价格-更新价格`中更新新增的模型**
|
||||
|
||||
[演示网站](https://one-api-martialbe.vercel.app/)
|
||||
|
||||
</div>
|
||||
|
||||
> [!WARNING]
|
||||
> 本项目为个人学习使用,不保证稳定性,且不提供任何技术支持,使用者必须在遵循 OpenAI 的使用条款以及法律法规的情况下使用,不得用于非法用途。
|
||||
> 根据[《生成式人工智能服务管理暂行办法》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm)的要求,请勿对中国地区公众提供一切未经备案的生成式人工智能服务。
|
||||
|
||||
## 功能变化
|
||||
|
||||
- 全新的 UI 界面
|
||||
- 新增用户仪表盘
|
||||
- 新增管理员分析数据统计界面
|
||||
- 重构了中转`供应商`模块
|
||||
- 支持使用`Azure Speech`模拟`TTS`功能
|
||||
- 渠道可配置单独的 http/socks5 代理
|
||||
- 支持动态返回用户模型列表
|
||||
- 支持自定义测速模型
|
||||
- 日志增加请求耗时
|
||||
- 支持和优化非 OpenAI 模型的函数调用(支持的模型可以在 lobe-chat 直接使用)
|
||||
- 支持完成倍率自定义
|
||||
- 支持完整的分页和排序
|
||||
- 支持`Telegram bot`
|
||||
- 支持模型按次收费
|
||||
- 支持模型通配符
|
||||
- 支持使用配置文件启动程序
|
||||
- 支持模型价格更新
|
||||
- 支持自动获取供应商模型
|
||||
- 支持仅聊天,开启后如果有传入`function call`参数会跳过该渠道
|
||||
- 支持支付
|
||||
- 支持配置用户组 RPM
|
||||
- 支持`Prometheus`监控
|
||||
|
||||
## 文档
|
||||
|
||||
请查看[文档](https://github.com/MartialBE/one-hub/wiki)
|
||||
|
||||
## 当前支持的供应商
|
||||
|
||||
| 供应商 | Chat | Embeddings | Audio | Images | 其他 |
|
||||
| --------------------------------------------------------------------- | ------------------------ | ---------- | ------ | ----------- | ---------------------------------------------------------------- |
|
||||
| [OpenAI](https://platform.openai.com/docs/api-reference/introduction) | ✅ | ✅ | ✅ | ✅ | - |
|
||||
| [Azure OpenAI](https://oai.azure.com/) | ✅ | ✅ | ✅ | ✅ | - |
|
||||
| [Azure Speech](https://portal.azure.com/) | - | - | ⚠️ tts | - | - |
|
||||
| [Anthropic](https://www.anthropic.com/) | ✅ | - | - | - | - |
|
||||
| [Gemini](https://aistudio.google.com/) | ✅ | - | - | - | - |
|
||||
| [百度文心](https://console.bce.baidu.com/qianfan/overview) | ✅ | ✅ | - | - | - |
|
||||
| [通义千问](https://dashscope.console.aliyun.com/overview) | ✅ | ✅ | - | - | - |
|
||||
| [讯飞星火](https://console.xfyun.cn/) | ✅ | - | - | - | - |
|
||||
| [智谱](https://open.bigmodel.cn/overview) | ✅ | ✅ | - | ⚠️ 图片生成 | - |
|
||||
| [腾讯混元](https://cloud.tencent.com/product/hunyuan) | ✅ | - | - | - | - |
|
||||
| [百川](https://platform.baichuan-ai.com/console/apikey) | ✅ | ✅ | - | - | - |
|
||||
| [MiniMax](https://www.minimaxi.com/user-center/basic-information) | ✅ | ✅ | - | - | - |
|
||||
| [Deepseek](https://platform.deepseek.com/usage) | ✅ | - | - | - | - |
|
||||
| [Moonshot](https://moonshot.ai/) | ✅ | - | - | - | - |
|
||||
| [Mistral](https://mistral.ai/) | ✅ | ✅ | - | - | - |
|
||||
| [Groq](https://console.groq.com/keys) | ✅ | - | - | - | - |
|
||||
| [Amazon Bedrock](https://console.aws.amazon.com/bedrock/home) | ⚠️ 仅支持 Anthropic 模型 | - | - | - | - |
|
||||
| [零一万物](https://platform.lingyiwanwu.com/details) | ✅ | - | - | - | - |
|
||||
| [Cloudflare AI](https://ai.cloudflare.com/) | ✅ | - | ⚠️ stt | ⚠️ 图片生成 | - |
|
||||
| [Midjourney](https://www.midjourney.com/) | - | - | - | - | [midjourney-proxy](https://github.com/novicezk/midjourney-proxy) |
|
||||
| [Cohere](https://cohere.com/) | ✅ | - | - | - | - |
|
||||
| [Stability AI](https://platform.stability.ai/account/credits) | - | - | - | ⚠️ 图片生成 | - |
|
||||
| [Coze](https://www.coze.com/open/docs/chat?_lang=zh) | ✅ | - | - | - | - |
|
||||
| [Ollama](https://github.com/ollama/ollama) | ✅ | ✅ | - | - | - |
|
||||
| [Suno](https://suno.com/) | - | - | - | - | [Suno-API](https://github.com/Suno-API/Suno-API) |
|
||||
|
||||
## 感谢
|
||||
|
||||
- 本程序使用了以下开源项目
|
||||
- [one-api](https://github.com/songquanpeng/one-api)为本项目的基础
|
||||
- [Berry Free React Admin Template](https://github.com/codedthemes/berry-free-react-admin-template)为本项目的前端界面
|
||||
- [minimal-ui-kit](https://github.com/minimal-ui-kit/material-kit-react),使用了其中的部分样式
|
||||
- [new api](https://github.com/Calcium-Ion/new-api),Midjourney/Suno 模块的代码来源于此
|
||||
- [go-zero](https://github.com/zeromicro/go-zero) - Token 限流器的实现
|
||||
|
||||
感谢以上项目的作者和贡献者
|
||||
|
||||
## 交流群
|
||||
|
||||
<img src="https://github.com/MartialBE/one-hub/assets/42402987/9b608d39-70ae-4b2e-be49-09afab6bd536" width="300">
|
||||
|
||||
## 其他
|
||||
|
||||
<a href="https://next.ossinsight.io/widgets/official/analyze-repo-stars-history?repo_id=689214770" target="_blank" style="display: block" align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://next.ossinsight.io/widgets/official/analyze-repo-stars-history/thumbnail.png?repo_id=689214770&image_size=auto&color_scheme=dark" width="721" height="auto">
|
||||
<img alt="Star History of MartialBE/one-api" src="https://next.ossinsight.io/widgets/official/analyze-repo-stars-history/thumbnail.png?repo_id=689214770&image_size=auto&color_scheme=light" width="721" height="auto">
|
||||
</picture>
|
||||
</a>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: one hub
|
||||
tags:
|
||||
- AI / 大模型
|
||||
title: OpenAI 接口管理 & 分发系统
|
||||
description: OpenAI 接口管理 & 分发系统
|
||||
additionalProperties:
|
||||
key: one-hub
|
||||
name: one-hub
|
||||
tags:
|
||||
- AI
|
||||
shortDescZh: AI模型接口管理与分发系统,支持将多种大模型转为OpenAI格式调用、支持Midjourney Proxy、Suno、Rerank,兼容易支付协议,可供个人或者企业内部管理与分发渠道使用,本项目基于One API二次开发。
|
||||
shortDescEn: Access all LLM through the standard OpenAI API format, easy to deploy & use
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://one-hub.xiao5.info/
|
||||
github: https://github.com/MartialBE/one-hub
|
||||
document: https://github.com/MartialBE/one-hub/blob/main/README.md
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: ""
|
||||
envKey: PANEL_DB_HOST
|
||||
key: mysql
|
||||
labelEn: Database Service
|
||||
labelZh: 数据库服务
|
||||
required: true
|
||||
type: service
|
||||
- default: onehub
|
||||
envKey: PANEL_DB_NAME
|
||||
labelEn: Database
|
||||
labelZh: 数据库名
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: onehub
|
||||
envKey: PANEL_DB_USER
|
||||
labelEn: User
|
||||
labelZh: 数据库用户
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: onehub
|
||||
envKey: PANEL_DB_USER_PASSWORD
|
||||
labelEn: Password
|
||||
labelZh: 数据库用户密码
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: 4000
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Time Zone
|
||||
labelZh: 时区
|
||||
required: true
|
||||
type: text
|
||||
- default: onehub
|
||||
envKey: USER_TOKEN_SECRET
|
||||
labelEn: USER_TOKEN_SECRET
|
||||
labelZh: SECRET随机字符串
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
services:
|
||||
one-hub:
|
||||
image: ghcr.io/martialbe/one-api:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- ${PANEL_APP_PORT_HTTP}:3000
|
||||
networks:
|
||||
- 1panel-network
|
||||
command: --log-dir /app/logs
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./logs:/app/logs
|
||||
environment:
|
||||
- SQL_DSN=${PANEL_DB_USER}:${PANEL_DB_USER_PASSWORD}@tcp(${PANEL_DB_HOST}:3306)/${PANEL_DB_NAME} # 修改此行,或注释掉以使用 SQLite 作为数据库
|
||||
- TZ=${TZ}
|
||||
- USER_TOKEN_SECRET=${USER_TOKEN_SECRET} # 必填,否则无法启动,修改为随机字符串,32位以上
|
||||
# - REDIS_CONN_STRING=redis://redis
|
||||
# - SESSION_SECRET=random_string # 推荐填写,否则每次重启后已登录用户的 cookie 将失效。
|
||||
# - HASHIDS_SALT=random_string # 可空,建议设置,字符串元素不能重复
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
|
@ -0,0 +1,4 @@
|
|||
CONTAINER_NAME="openlist"
|
||||
PANEL_APP_PORT_HTTP="40034"
|
||||
DATA_PATH="./data/data"
|
||||
MOUNT_PATH="./data/mnt"
|
||||
|
|
@ -0,0 +1,507 @@
|
|||
# uni-api
|
||||
|
||||
<p align="center">
|
||||
<a href="https://t.me/uni_api">
|
||||
<img src="https://img.shields.io/badge/Join Telegram Group-blue?&logo=telegram">
|
||||
</a>
|
||||
<a href="https://hub.docker.com/repository/docker/yym68686/uni-api">
|
||||
<img src="https://img.shields.io/docker/pulls/yym68686/uni-api?color=blue" alt="docker pull">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
[英文](./README.md) | [中文](./README_CN.md)
|
||||
|
||||
## 介绍
|
||||
|
||||
如果个人使用的话,one/new-api 过于复杂,有很多个人不需要使用的商用功能,如果你不想要复杂的前端界面,又想要支持的模型多一点,可以试试 uni-api。这是一个统一管理大模型 API 的项目,可以通过一个统一的API 接口调用多种不同提供商的服务,统一转换为 OpenAI 格式,支持负载均衡。目前支持的后端服务有:OpenAI、Anthropic、Gemini、Vertex、Azure、xai、Cohere、Groq、Cloudflare、OpenRouter 等。
|
||||
|
||||
## ✨ 特性
|
||||
|
||||
- 无前端,纯配置文件配置 API 渠道。只要写一个文件就能运行起一个属于自己的 API 站,文档有详细的配置指南,小白友好。
|
||||
- 统一管理多个后端服务,支持 OpenAI、Deepseek、OpenRouter 等其他 API 是 OpenAI 格式的提供商。支持 OpenAI Dalle-3 图像生成。
|
||||
- 同时支持 Anthropic、Gemini、Vertex AI、Azure、xai、Cohere、Groq、Cloudflare。Vertex 同时支持 Claude 和 Gemini API。
|
||||
- 支持 OpenAI、 Anthropic、Gemini、Vertex、Azure、xai 原生 tool use 函数调用。
|
||||
- 支持 OpenAI、Anthropic、Gemini、Vertex、Azure、xai 原生识图 API。
|
||||
- 支持四种负载均衡。
|
||||
1. 支持渠道级加权负载均衡,可以根据不同的渠道权重分配请求。默认不开启,需要配置渠道权重。
|
||||
2. 支持 Vertex 区域级负载均衡,支持 Vertex 高并发,最高可将 Gemini,Claude 并发提高 (API数量 * 区域数量) 倍。自动开启不需要额外配置。
|
||||
3. 除了 Vertex 区域级负载均衡,所有 API 均支持渠道级顺序负载均衡,提高沉浸式翻译体验。默认不开启,需要配置 `SCHEDULING_ALGORITHM` 为 `round_robin`。
|
||||
4. 支持单个渠道多个 API Key 自动开启 API key 级别的轮训负载均衡。
|
||||
- 支持自动重试,当一个 API 渠道响应失败时,自动重试下一个 API 渠道。
|
||||
- 支持渠道冷却,当一个 API 渠道响应失败时,会自动将该渠道排除冷却一段时间,不再请求该渠道,冷却时间结束后,会自动将该模型恢复,直到再次请求失败,会重新冷却。
|
||||
- 支持细粒度的模型超时时间设置,可以为每个模型设置不同的超时时间。
|
||||
- 支持细粒度的权限控制。支持使用通配符设置 API key 可用渠道的特定模型。
|
||||
- 支持限流,可以设置每分钟最多请求次数,可以设置为整数,如 2/min,2 次每分钟、5/hour,5 次每小时、10/day,10 次每天,10/month,10 次每月,10/year,10 次每年。默认60/min。
|
||||
- 支持多个标准 OpenAI 格式的接口:`/v1/chat/completions`,`/v1/images/generations`,`/v1/audio/transcriptions`,`/v1/moderations`,`/v1/models`。
|
||||
- 支持 OpenAI moderation 道德审查,可以对用户的消息进行道德审查,如果发现不当的消息,会返回错误信息。降低后台 API 被提供商封禁的风险。
|
||||
|
||||
## 使用方法
|
||||
|
||||
启动 uni-api 必须使用配置文件,有两种方式可以启动配置文件:
|
||||
|
||||
1. 第一种是使用 `CONFIG_URL` 环境变量填写配置文件 URL,uni-api启动时会自动下载。
|
||||
2. 第二种就是挂载名为 `api.yaml` 的配置文件到容器内。
|
||||
|
||||
### 方法一:挂载 `api.yaml` 配置文件启动 uni-api
|
||||
|
||||
必须事先填写完成配置文件才能启动 `uni-api`,必须使用名为 `api.yaml` 的配置文件才能启动 `uni-api`,可以配置多个模型,每个模型可以配置多个后端服务,支持负载均衡。下面是最小可运行的 `api.yaml` 配置文件的示例:
|
||||
|
||||
```yaml
|
||||
providers:
|
||||
- provider: provider_name # 服务提供商名称, 如 openai、anthropic、gemini、openrouter,随便取名字,必填
|
||||
base_url: https://api.your.com/v1/chat/completions # 后端服务的API地址,必填
|
||||
api: sk-YgS6GTi0b4bEabc4C # 提供商的API Key,必填,自动使用 base_url 和 api 通过 /v1/models 端点获取可用的所有模型。
|
||||
# 这里可以配置多个提供商,每个提供商可以配置多个 API Key,每个提供商可以配置多个模型。
|
||||
api_keys:
|
||||
- api: sk-Pkj60Yf8JFWxfgRmXQFWyGtWUddGZnmi3KlvowmRWpWpQxx # API Key,用户请求 uni-api 需要 API key,必填
|
||||
# 该 API Key 可以使用所有模型,即可以使用 providers 下面设置的所有渠道里面的所有模型,不需要一个个添加可用渠道。
|
||||
```
|
||||
|
||||
`api.yaml` 详细的高级配置:
|
||||
|
||||
```yaml
|
||||
providers:
|
||||
- provider: provider_name # 服务提供商名称, 如 openai、anthropic、gemini、openrouter,随便取名字,必填
|
||||
base_url: https://api.your.com/v1/chat/completions # 后端服务的API地址,必填
|
||||
api: sk-YgS6GTi0b4bEabc4C # 提供商的API Key,必填
|
||||
model: # 选填,如果不配置 model,会自动通过 base_url 和 api 通过 /v1/models 端点获取可用的所有模型。
|
||||
- gpt-4o # 可以使用的模型名称,必填
|
||||
- claude-3-5-sonnet-20240620: claude-3-5-sonnet # 重命名模型,claude-3-5-sonnet-20240620 是服务商的模型名称,claude-3-5-sonnet 是重命名后的名字,可以使用简洁的名字代替原来复杂的名称,选填
|
||||
- dall-e-3
|
||||
|
||||
- provider: anthropic
|
||||
base_url: https://api.anthropic.com/v1/messages
|
||||
api: # 支持多个 API Key,多个 key 自动开启轮训负载均衡,至少一个 key,必填
|
||||
- sk-ant-api03-bNnAOJyA-xQw_twAA
|
||||
- sk-ant-api02-bNnxxxx
|
||||
model:
|
||||
- claude-3-7-sonnet-20240620: claude-3-7-sonnet # 重命名模型,claude-3-7-sonnet-20240620 是服务商的模型名称,claude-3-7-sonnet 是重命名后的名字,可以使用简洁的名字代替原来复杂的名称,选填
|
||||
- claude-3-7-sonnet-20250219: claude-3-7-sonnet-think # 重命名模型,claude-3-7-sonnet-20250219 是服务商的模型名称,claude-3-7-sonnet-think 是重命名后的名字,可以使用简洁的名字代替原来复杂的名称,如果重命名后的名字里面有think,则自动转换为 claude 思考模型,默认思考 token 限制为 4096。选填
|
||||
tools: true # 是否支持工具,如生成代码、生成文档等,默认是 true,选填
|
||||
|
||||
- provider: gemini
|
||||
base_url: https://generativelanguage.googleapis.com/v1beta # base_url 支持 v1beta/v1, 仅供 Gemini 模型使用,必填
|
||||
api: # 支持多个 API Key,多个 key 自动开启轮训负载均衡,至少一个 key,必填
|
||||
- AIzaSyAN2k6IRdgw123
|
||||
- AIzaSyAN2k6IRdgw456
|
||||
- AIzaSyAN2k6IRdgw789
|
||||
model:
|
||||
- gemini-1.5-pro
|
||||
- gemini-1.5-flash-exp-0827: gemini-1.5-flash # 重命名后,原来的模型名字 gemini-1.5-flash-exp-0827 无法使用,如果要使用原来的名字,可以在 model 中添加原来的名字,只要加上下面一行就可以使用原来的名字了
|
||||
- gemini-1.5-flash-exp-0827 # 加上这一行,gemini-1.5-flash-exp-0827 和 gemini-1.5-flash 都可以被请求
|
||||
- gemini-1.5-pro: gemini-1.5-pro-search # 支持以 -search 后缀重命名模型启用搜索,使用 gemini-1.5-pro-search 模型请求 uni-api 时,表示 gemini-1.5-pro 模型自动使用 Google 官方搜索工具,支持全部 1.5/2.0 系列模型。
|
||||
tools: true
|
||||
preferences:
|
||||
api_key_rate_limit: 15/min # 每个 API Key 每分钟最多请求次数,选填。默认为 999999/min。支持多个频率约束条件:15/min,10/day
|
||||
# api_key_rate_limit: # 可以为每个模型设置不同的频率限制
|
||||
# gemini-1.5-flash: 15/min,1500/day
|
||||
# gemini-1.5-pro: 2/min,50/day
|
||||
# default: 4/min # 如果模型没有设置频率限制,使用 default 的频率限制
|
||||
api_key_cooldown_period: 60 # 每个 API Key 遭遇 429 错误后的冷却时间,单位为秒,选填。默认为 0 秒, 当设置为 0 秒时,不启用冷却机制。当存在多个 API key 时才会生效。
|
||||
api_key_schedule_algorithm: round_robin # 设置多个 API Key 的请求顺序,选填。默认为 round_robin,可选值有:round_robin,random,fixed_priority。当存在多个 API key 时才会生效。round_robin 是轮询负载均衡,random 是随机负载均衡,fixed_priority 是固定优先级调度,永远使用第一个可用的 API key。
|
||||
model_timeout: # 模型超时时间,单位为秒,默认 100 秒,选填
|
||||
gemini-1.5-pro: 10 # 模型 gemini-1.5-pro 的超时时间为 10 秒
|
||||
gemini-1.5-flash: 10 # 模型 gemini-1.5-flash 的超时时间为 10 秒
|
||||
default: 10 # 模型没有设置超时时间,使用默认的超时时间 10 秒,当请求的不在 model_timeout 里面的模型时,超时时间默认是 10 秒,不设置 default,uni-api 会使用全局配置的模型超时时间。
|
||||
proxy: socks5://[用户名]:[密码]@[IP地址]:[端口] # 代理地址,选填。支持 socks5 和 http 代理,默认不使用代理。
|
||||
headers: # 额外附加自定义HTTP请求头,选填。
|
||||
Custom-Header-1: Value-1
|
||||
Custom-Header-2: Value-2
|
||||
|
||||
- provider: vertex
|
||||
project_id: gen-lang-client-xxxxxxxxxxxxxx # 描述: 您的Google Cloud项目ID。格式: 字符串,通常由小写字母、数字和连字符组成。获取方式: 在Google Cloud Console的项目选择器中可以找到您的项目ID。
|
||||
private_key: "-----BEGIN PRIVATE KEY-----\nxxxxx\n-----END PRIVATE" # 描述: Google Cloud Vertex AI服务账号的私钥。格式: 一个 JSON 格式的字符串,包含服务账号的私钥信息。获取方式: 在 Google Cloud Console 中创建服务账号,生成JSON格式的密钥文件,然后将其内容设置为此环境变量的值。
|
||||
client_email: xxxxxxxxxx@xxxxxxx.gserviceaccount.com # 描述: Google Cloud Vertex AI 服务账号的电子邮件地址。格式: 通常是形如 "service-account-name@project-id.iam.gserviceaccount.com" 的字符串。获取方式: 在创建服务账号时生成,也可以在 Google Cloud Console 的"IAM与管理"部分查看服务账号详情获得。
|
||||
model:
|
||||
- gemini-1.5-pro
|
||||
- gemini-1.5-flash
|
||||
- gemini-1.5-pro: gemini-1.5-pro-search # 仅支持在 vertex Gemini API 中,以 -search 后缀重命名模型后,使用 gemini-1.5-pro-search 模型请求 uni-api 时,表示 gemini-1.5-pro 模型自动使用 Google 官方搜索工具。
|
||||
- claude-3-5-sonnet@20240620: claude-3-5-sonnet
|
||||
- claude-3-opus@20240229: claude-3-opus
|
||||
- claude-3-sonnet@20240229: claude-3-sonnet
|
||||
- claude-3-haiku@20240307: claude-3-haiku
|
||||
tools: true
|
||||
notes: https://xxxxx.com/ # 可以放服务商的网址,备注信息,官方文档,选填
|
||||
|
||||
- provider: cloudflare
|
||||
api: f42b3xxxxxxxxxxq4aoGAh # Cloudflare API Key,必填
|
||||
cf_account_id: 8ec0xxxxxxxxxxxxe721 # Cloudflare Account ID,必填
|
||||
model:
|
||||
- '@cf/meta/llama-3.1-8b-instruct': llama-3.1-8b # 重命名模型,@cf/meta/llama-3.1-8b-instruct 是服务商的原始的模型名称,必须使用引号包裹模型名,否则yaml语法错误,llama-3.1-8b 是重命名后的名字,可以使用简洁的名字代替原来复杂的名称,选填
|
||||
- '@cf/meta/llama-3.1-8b-instruct' # 必须使用引号包裹模型名,否则yaml语法错误
|
||||
|
||||
- provider: azure
|
||||
base_url: https://your-endpoint.openai.azure.com
|
||||
api: your-api-key
|
||||
model:
|
||||
- gpt-4o
|
||||
|
||||
- provider: other-provider
|
||||
base_url: https://api.xxx.com/v1/messages
|
||||
api: sk-bNnAOJyA-xQw_twAA
|
||||
model:
|
||||
- causallm-35b-beta2ep-q6k: causallm-35b
|
||||
- anthropic/claude-3-5-sonnet
|
||||
tools: false
|
||||
engine: openrouter # 强制使用某个消息格式,目前支持 gpt,claude,gemini,openrouter 原生格式,选填
|
||||
|
||||
api_keys:
|
||||
- api: sk-KjjI60Yf0JFWxfgRmXqFWyGtWUd9GZnmi3KlvowmRWpWpQRo # API Key,用户使用本服务需要 API key,必填
|
||||
model: # 该 API Key 可以使用的模型,必填。默认开启渠道级轮询负载均衡,每次请求模型按照 model 配置的顺序依次请求。与 providers 里面原始的渠道顺序无关。因此你可以设置每个 API key 请求顺序不一样。
|
||||
- gpt-4o # 可以使用的模型名称,可以使用所有提供商提供的 gpt-4o 模型
|
||||
- claude-3-5-sonnet # 可以使用的模型名称,可以使用所有提供商提供的 claude-3-5-sonnet 模型
|
||||
- gemini/* # 可以使用的模型名称,仅可以使用名为 gemini 提供商提供的所有模型,其中 gemini 是 provider 名称,* 代表所有模型
|
||||
role: admin # 设置 API key 的别名,选填。请求日志会显示该 API key 的别名。如果 role 为 admin,则仅有此 API key 可以请求 v1/stats,/v1/generate-api-key 端点。如果所有 API key 都没有设置 role 为 admin,则默认第一个 API key 为 admin 拥有请求 v1/stats,/v1/generate-api-key 端点的权限。
|
||||
|
||||
- api: sk-pkhf60Yf0JGyJxgRmXqFQyTgWUd9GZnmi3KlvowmRWpWqrhy
|
||||
model:
|
||||
- anthropic/claude-3-5-sonnet # 可以使用的模型名称,仅可以使用名为 anthropic 提供商提供的 claude-3-5-sonnet 模型。其他提供商的 claude-3-5-sonnet 模型不可以使用。这种写法不会匹配到other-provider提供的名为anthropic/claude-3-5-sonnet的模型。
|
||||
- <anthropic/claude-3-5-sonnet> # 通过在模型名两侧加上尖括号,这样就不会去名为anthropic的渠道下去寻找claude-3-5-sonnet模型,而是将整个 anthropic/claude-3-5-sonnet 作为模型名称。这种写法可以匹配到other-provider提供的名为 anthropic/claude-3-5-sonnet 的模型。但不会匹配到anthropic下面的claude-3-5-sonnet模型。
|
||||
- openai-test/text-moderation-latest # 当开启消息道德审查后,可以使用名为 openai-test 渠道下的 text-moderation-latest 模型进行道德审查。
|
||||
- sk-KjjI60Yd0JFWtxxxxxxxxxxxxxxwmRWpWpQRo/* # 支持将其他 api key 当作渠道
|
||||
preferences:
|
||||
SCHEDULING_ALGORITHM: fixed_priority # 当 SCHEDULING_ALGORITHM 为 fixed_priority 时,使用固定优先级调度,永远执行第一个拥有请求的模型的渠道。默认开启,SCHEDULING_ALGORITHM 缺省值为 fixed_priority。SCHEDULING_ALGORITHM 可选值有:fixed_priority,round_robin,weighted_round_robin, lottery, random。
|
||||
# 当 SCHEDULING_ALGORITHM 为 random 时,使用随机轮训负载均衡,随机请求拥有请求的模型的渠道。
|
||||
# 当 SCHEDULING_ALGORITHM 为 round_robin 时,使用轮训负载均衡,按照顺序请求用户使用的模型的渠道。
|
||||
AUTO_RETRY: true # 是否自动重试,自动重试下一个提供商,true 为自动重试,false 为不自动重试,默认为 true。也可以设置为数字,表示重试次数。
|
||||
rate_limit: 15/min # 支持限流,每分钟最多请求次数,可以设置为整数,如 2/min,2 次每分钟、5/hour,5 次每小时、10/day,10 次每天,10/month,10 次每月,10/year,10 次每年。默认999999/min,选填。支持多个频率约束条件:15/min,10/day
|
||||
# rate_limit: # 可以为每个模型设置不同的频率限制
|
||||
# gemini-1.5-flash: 15/min,1500/day
|
||||
# gemini-1.5-pro: 2/min,50/day
|
||||
# default: 4/min # 如果模型没有设置频率限制,使用 default 的频率限制
|
||||
ENABLE_MODERATION: true # 是否开启消息道德审查,true 为开启,false 为不开启,默认为 false,当开启后,会对用户的消息进行道德审查,如果发现不当的消息,会返回错误信息。
|
||||
|
||||
# 渠道级加权负载均衡配置示例
|
||||
- api: sk-KjjI60Yd0JFWtxxxxxxxxxxxxxxwmRWpWpQRo
|
||||
model:
|
||||
- gcp1/*: 5 # 冒号后面就是权重,权重仅支持正整数。
|
||||
- gcp2/*: 3 # 数字的大小代表权重,数字越大,请求的概率越大。
|
||||
- gcp3/*: 2 # 在该示例中,所有渠道加起来一共有 10 个权重,及 10 个请求里面有 5 个请求会请求 gcp1/* 模型,2 个请求会请求 gcp2/* 模型,3 个请求会请求 gcp3/* 模型。
|
||||
|
||||
preferences:
|
||||
SCHEDULING_ALGORITHM: weighted_round_robin # 仅当 SCHEDULING_ALGORITHM 为 weighted_round_robin 并且上面的渠道如果有权重,会按照加权后的顺序请求。使用加权轮训负载均衡,按照权重顺序请求拥有请求的模型的渠道。当 SCHEDULING_ALGORITHM 为 lottery 时,使用抽奖轮训负载均衡,按照权重随机请求拥有请求的模型的渠道。没设置权重的渠道自动回退到 round_robin 轮训负载均衡。
|
||||
AUTO_RETRY: true
|
||||
|
||||
preferences: # 全局配置
|
||||
model_timeout: # 模型超时时间,单位为秒,默认 100 秒,选填
|
||||
gpt-4o: 10 # 模型 gpt-4o 的超时时间为 10 秒,gpt-4o 是模型名称,当请求 gpt-4o-2024-08-06 等模型时,超时时间也是 10 秒
|
||||
claude-3-5-sonnet: 10 # 模型 claude-3-5-sonnet 的超时时间为 10 秒,当请求 claude-3-5-sonnet-20240620 等模型时,超时时间也是 10 秒
|
||||
default: 10 # 模型没有设置超时时间,使用默认的超时时间 10 秒,当请求的不在 model_timeout 里面的模型时,超时时间默认是 10 秒,不设置 default,uni-api 会使用 环境变量 TIMEOUT 设置的默认超时时间,默认超时时间是 100 秒
|
||||
o1-mini: 30 # 模型 o1-mini 的超时时间为 30 秒,当请求名字是 o1-mini 开头的模型时,超时时间是 30 秒
|
||||
o1-preview: 100 # 模型 o1-preview 的超时时间为 100 秒,当请求名字是 o1-preview 开头的模型时,超时时间是 100 秒
|
||||
cooldown_period: 300 # 渠道冷却时间,单位为秒,默认 300 秒,选填。当模型请求失败时,会自动将该渠道排除冷却一段时间,不再请求该渠道,冷却时间结束后,会自动将该模型恢复,直到再次请求失败,会重新冷却。当 cooldown_period 设置为 0 时,不启用冷却机制。
|
||||
rate_limit: 999999/min # uni-api 全局速率限制,单位为次数/分钟,支持多个频率约束条件,例如:15/min,10/day。默认 999999/min,选填。
|
||||
error_triggers: # 错误触发器,当模型返回的消息包含错误触发器中的任意一个字符串时,该渠道会自动返回报错。选填
|
||||
- The bot's usage is covered by the developer
|
||||
- process this request due to overload or policy
|
||||
proxy: socks5://[username]:[password]@[ip]:[port] # 全局代理地址,选填。
|
||||
```
|
||||
|
||||
挂载配置文件并启动 uni-api docker 容器:
|
||||
|
||||
```bash
|
||||
docker run --user root -p 8001:8000 --name uni-api -dit \
|
||||
-v ./api.yaml:/home/api.yaml \
|
||||
yym68686/uni-api:latest
|
||||
```
|
||||
|
||||
### 方法二:使用 `CONFIG_URL` 环境变量启动 uni-api
|
||||
|
||||
按照方法一写完配置文件后,上传到云端硬盘,获取文件的直链,然后使用 `CONFIG_URL` 环境变量启动 uni-api docker 容器:
|
||||
|
||||
```bash
|
||||
docker run --user root -p 8001:8000 --name uni-api -dit \
|
||||
-e CONFIG_URL=http://file_url/api.yaml \
|
||||
yym68686/uni-api:latest
|
||||
```
|
||||
|
||||
## 环境变量
|
||||
|
||||
- CONFIG_URL: 配置文件的下载地址,可以是本地文件,也可以是远程文件,选填
|
||||
- TIMEOUT: 请求超时时间,默认为 100 秒,超时时间可以控制当一个渠道没有响应时,切换下一个渠道需要的时间。选填
|
||||
- DISABLE_DATABASE: 是否禁用数据库,默认为 false,选填
|
||||
|
||||
## Vercel 部署
|
||||
|
||||
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fyym68686%2Funi-api%2Ftree%2Fmain&env=CONFIG_URL,DISABLE_DATABASE&project-name=uni-api-vercel&repository-name=uni-api-vercel)
|
||||
|
||||
点击上面的一键部署按钮后,设置环境变量 `CONFIG_URL` 为配置文件的直链, `DISABLE_DATABASE` 为 true,然后点击 Create 创建项目。部署完之后需要手动在 vercel 项目面板的 Settings -> Funcitons -> Function Max Duration 设置为 60 秒,然后点击 Deployments 菜单点击 Redeploy 重新部署,即可将超时时间设置为 60 秒,如果不重新部署,默认超时时间将是原来的 10 秒。注意不是删掉 vercel 项目重建,而是在当前部署好的 vercel 项目里面的 Deployments 菜单里面点 redeploy,这样才能让 Function Max Duration 的修改生效。
|
||||
|
||||
## Ubuntu 部署
|
||||
|
||||
在仓库 Releases 找到对应的二进制文件最新版本,例如名为 uni-api-linux-x86_64-0.0.99.pex 的文件。在服务器下载二进制文件并运行:
|
||||
|
||||
```bash
|
||||
wget https://github.com/yym68686/uni-api/releases/download/v0.0.99/uni-api-linux-x86_64-0.0.99.pex
|
||||
chmod +x uni-api-linux-x86_64-0.0.99.pex
|
||||
./uni-api-linux-x86_64-0.0.99.pex
|
||||
```
|
||||
|
||||
## serv00 远程部署(FreeBSD 14.0)
|
||||
|
||||
首先登录面板,Additional services 里面点击选项卡 Run your own applications 开启允许运行自己的程序,然后到面板 Port reservation 去随便开一个端口。
|
||||
|
||||
如果没有自己的域名,去面板 WWW websites 删掉默认给的域名,再新建一个域名 Domain 为刚才删掉的域名,点击 Advanced settings 后设置 Website type 为 Proxy 域名,Proxy port 指向你刚才开的端口,不要选中 Use HTTPS。
|
||||
|
||||
ssh 登陆到 serv00 服务器,执行下面的命令:
|
||||
|
||||
```bash
|
||||
git clone --depth 1 -b main --quiet https://github.com/yym68686/uni-api.git
|
||||
cd uni-api
|
||||
python -m venv uni-api
|
||||
tmux new -A -s uni-api
|
||||
source uni-api/bin/activate
|
||||
export CFLAGS="-I/usr/local/include"
|
||||
export CXXFLAGS="-I/usr/local/include"
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
export MAX_CONCURRENCY=1
|
||||
export CPUCOUNT=1
|
||||
export MAKEFLAGS="-j1"
|
||||
CMAKE_BUILD_PARALLEL_LEVEL=1 cpuset -l 0 pip install -vv -r requirements.txt
|
||||
cpuset -l 0 pip install -r -vv requirements.txt
|
||||
```
|
||||
|
||||
ctrl+b d 退出 tmux 等待几个小时安装完成,安装完成后执行下面的命令:
|
||||
|
||||
```bash
|
||||
tmux new -A -s uni-api
|
||||
source uni-api/bin/activate
|
||||
export CONFIG_URL=http://file_url/api.yaml
|
||||
export DISABLE_DATABASE=true
|
||||
# 修改端口,xxx 为端口,自行修改,对应刚刚在面板 Port reservation 开的端口
|
||||
sed -i '' 's/port=8000/port=xxx/' main.py
|
||||
sed -i '' 's/reload=True/reload=False/' main.py
|
||||
python main.py
|
||||
```
|
||||
|
||||
使用 ctrl+b d 退出 tmux,即可让程序后台运行。此时就可以在其他聊天客户端使用 uni-api 了。curl 测试脚本:
|
||||
|
||||
```bash
|
||||
curl -X POST https://xxx.serv00.net/v1/chat/completions \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer sk-xxx' \
|
||||
-d '{"model": "gpt-4o","messages": [{"role": "user","content": "你好"}]}'
|
||||
```
|
||||
|
||||
参考文档:
|
||||
|
||||
https://docs.serv00.com/Python/
|
||||
|
||||
https://linux.do/t/topic/201181
|
||||
|
||||
https://linux.do/t/topic/218738
|
||||
|
||||
## Docker 本地部署
|
||||
|
||||
Start the container
|
||||
|
||||
```bash
|
||||
docker run --user root -p 8001:8000 --name uni-api -dit \
|
||||
-e CONFIG_URL=http://file_url/api.yaml \ # 如果已经挂载了本地配置文件,不需要设置 CONFIG_URL
|
||||
-v ./api.yaml:/home/api.yaml \ # 如果已经设置 CONFIG_URL,不需要挂载配置文件
|
||||
-v ./uniapi_db:/home/data \ # 如果不想保存统计数据,不需要挂载该文件夹
|
||||
yym68686/uni-api:latest
|
||||
```
|
||||
|
||||
Or if you want to use Docker Compose, here is a docker-compose.yml example:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
uni-api:
|
||||
container_name: uni-api
|
||||
image: yym68686/uni-api:latest
|
||||
environment:
|
||||
- CONFIG_URL=http://file_url/api.yaml # 如果已经挂载了本地配置文件,不需要设置 CONFIG_URL
|
||||
ports:
|
||||
- 8001:8000
|
||||
volumes:
|
||||
- ./api.yaml:/home/api.yaml # 如果已经设置 CONFIG_URL,不需要挂载配置文件
|
||||
- ./uniapi_db:/home/data # 如果不想保存统计数据,不需要挂载该文件夹
|
||||
```
|
||||
|
||||
CONFIG_URL 就是可以自动下载远程的配置文件。比如你在某个平台不方便修改配置文件,可以把配置文件传到某个托管服务,可以提供直链给 uni-api 下载,CONFIG_URL 就是这个直链。如果使用本地挂载的配置文件,不需要设置 CONFIG_URL。CONFIG_URL 是在不方便挂载配置文件的情况下使用。
|
||||
|
||||
Run Docker Compose container in the background
|
||||
|
||||
```bash
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
Docker build
|
||||
|
||||
```bash
|
||||
docker build --no-cache -t uni-api:latest -f Dockerfile --platform linux/amd64 .
|
||||
docker tag uni-api:latest yym68686/uni-api:latest
|
||||
docker push yym68686/uni-api:latest
|
||||
```
|
||||
|
||||
One-Click Restart Docker Image
|
||||
|
||||
```bash
|
||||
set -eu
|
||||
docker pull yym68686/uni-api:latest
|
||||
docker rm -f uni-api
|
||||
docker run --user root -p 8001:8000 -dit --name uni-api \
|
||||
-e CONFIG_URL=http://file_url/api.yaml \
|
||||
-v ./api.yaml:/home/api.yaml \
|
||||
-v ./uniapi_db:/home/data \
|
||||
yym68686/uni-api:latest
|
||||
docker logs -f uni-api
|
||||
```
|
||||
|
||||
RESTful curl test
|
||||
|
||||
```bash
|
||||
curl -X POST http://127.0.0.1:8000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${API}" \
|
||||
-d '{"model": "gpt-4o","messages": [{"role": "user", "content": "Hello"}],"stream": true}'
|
||||
```
|
||||
|
||||
pex linux 打包:
|
||||
|
||||
```bash
|
||||
VERSION=$(cat VERSION)
|
||||
pex -D . -r requirements.txt \
|
||||
-c uvicorn \
|
||||
--inject-args 'main:app --host 0.0.0.0 --port 8000' \
|
||||
--platform linux_x86_64-cp-3.10.12-cp310 \
|
||||
--interpreter-constraint '==3.10.*' \
|
||||
--no-strip-pex-env \
|
||||
-o uni-api-linux-x86_64-${VERSION}.pex
|
||||
```
|
||||
|
||||
macos 打包:
|
||||
|
||||
```bash
|
||||
VERSION=$(cat VERSION)
|
||||
pex -r requirements.txt \
|
||||
-c uvicorn \
|
||||
--inject-args 'main:app --host 0.0.0.0 --port 8000' \
|
||||
-o uni-api-macos-arm64-${VERSION}.pex
|
||||
```
|
||||
|
||||
## 赞助商
|
||||
|
||||
我们感谢以下赞助商的支持:
|
||||
<!-- ¥2050 -->
|
||||
- @PowerHunter:¥2000
|
||||
- @IM4O4: ¥100
|
||||
- @ioi:¥50
|
||||
|
||||
## 如何赞助我们
|
||||
|
||||
如果您想支持我们的项目,您可以通过以下方式赞助我们:
|
||||
|
||||
1. [PayPal](https://www.paypal.me/yym68686)
|
||||
|
||||
2. [USDT-TRC20](https://pb.yym68686.top/~USDT-TRC20),USDT-TRC20 钱包地址:`TLFbqSv5pDu5he43mVmK1dNx7yBMFeN7d8`
|
||||
|
||||
3. [微信](https://pb.yym68686.top/~wechat)
|
||||
|
||||
4. [支付宝](https://pb.yym68686.top/~alipay)
|
||||
|
||||
感谢您的支持!
|
||||
|
||||
## 常见问题
|
||||
|
||||
- 为什么总是出现 `Error processing request or performing moral check: 404: No matching model found` 错误?
|
||||
|
||||
将 ENABLE_MODERATION 设置为 false 将修复这个问题。当 ENABLE_MODERATION 为 true 时,API 必须能够使用 text-moderation-latest 模型,如果你没有在提供商模型设置里面提供 text-moderation-latest,将会报错找不到模型。
|
||||
|
||||
- 怎么优先请求某个渠道,怎么设置渠道的优先级?
|
||||
|
||||
直接在api_keys里面通过设置渠道顺序即可。不需要做其他设置,示例配置文件:
|
||||
|
||||
```yaml
|
||||
providers:
|
||||
- provider: ai1
|
||||
base_url: https://xxx/v1/chat/completions
|
||||
api: sk-xxx
|
||||
|
||||
- provider: ai2
|
||||
base_url: https://xxx/v1/chat/completions
|
||||
api: sk-xxx
|
||||
|
||||
api_keys:
|
||||
- api: sk-1234
|
||||
model:
|
||||
- ai2/*
|
||||
- ai1/*
|
||||
```
|
||||
|
||||
这样设置则先请求 ai2,失败后请求 ai1。
|
||||
|
||||
- 各种调度算法背后的行为是怎样的?比如 fixed_priority,weighted_round_robin,lottery,random,round_robin?
|
||||
|
||||
所有调度算法需要通过在配置文件的 api_keys.(api).preferences.SCHEDULING_ALGORITHM 设置为 fixed_priority,weighted_round_robin,lottery,random,round_robin 中的任意值来开启。
|
||||
|
||||
1. fixed_priority:固定优先级调度。所有请求永远执行第一个拥有用户请求的模型的渠道。报错时,会切换下一个渠道。这是默认的调度算法。
|
||||
|
||||
2. weighted_round_robin:加权轮训负载均衡,按照配置文件 api_keys.(api).model 设定的权重顺序请求拥有用户请求的模型的渠道。
|
||||
|
||||
3. lottery:抽奖轮训负载均衡,按照配置文件 api_keys.(api).model 设置的权重随机请求拥有用户请求的模型的渠道。
|
||||
|
||||
4. round_robin:轮训负载均衡,按照配置文件 api_keys.(api).model 的配置顺序请求拥有用户请求的模型的渠道。可以查看上一个问题,如何设置渠道的优先级。
|
||||
|
||||
- 应该怎么正确填写 base_url?
|
||||
|
||||
除了高级配置里面所展示的一些特殊的渠道,所有 OpenAI 格式的提供商需要把 base_url 填完整,也就是说 base_url 必须以 /v1/chat/completions 结尾。如果你使用的 GitHub models,base_url 应该填写为 https://models.inference.ai.azure.com/chat/completions,而不是 Azure 的 URL。
|
||||
|
||||
对于 Azure 渠道,base_url 兼容以下几种写法:https://your-endpoint.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview 和 https://your-endpoint.services.ai.azure.com/models/chat/completions,https://your-endpoint.openai.azure.com,推荐使用第一种写法。如果不显式指定 api-version,默认使用 2024-10-21 版本。
|
||||
|
||||
- 模型超时时间是如何确认的?渠道级别的超时设置和全局模型超时设置的优先级是什么?
|
||||
|
||||
渠道级别的超时设置优先级高于全局模型超时设置。优先级顺序:渠道级别模型超时设置 > 渠道级别默认超时设置 > 全局模型超时设置 > 全局默认超时设置 > 环境变量 TIMEOUT。
|
||||
|
||||
通过调整模型超时时间,可以避免出现某些渠道请求超时报错的情况。如果你遇到 `{'error': '500', 'details': 'fetch_response_stream Read Response Timeout'}` 错误,请尝试增加模型超时时间。
|
||||
|
||||
- api_key_rate_limit 是怎么工作的?我如何给多个模型设置相同的频率限制?
|
||||
|
||||
如果你想同时给 gemini-1.5-pro-latest,gemini-1.5-pro,gemini-1.5-pro-001,gemini-1.5-pro-002 这四个模型设置相同的频率限制,可以这样设置:
|
||||
|
||||
```yaml
|
||||
api_key_rate_limit:
|
||||
gemini-1.5-pro: 1000/min
|
||||
```
|
||||
|
||||
这会匹配所有含有 gemini-1.5-pro 字符串的模型。gemini-1.5-pro-latest,gemini-1.5-pro,gemini-1.5-pro-001,gemini-1.5-pro-002 这四个模型频率限制都会设置为 1000/min。api_key_rate_limit 字段配置的逻辑如下,这是一个示例配置文件:
|
||||
|
||||
```yaml
|
||||
api_key_rate_limit:
|
||||
gemini-1.5-pro: 1000/min
|
||||
gemini-1.5-pro-002: 500/min
|
||||
```
|
||||
|
||||
此时如果有一个使用模型 gemini-1.5-pro-002 的请求。
|
||||
|
||||
首先,uni-api 会尝试精确匹配 api_key_rate_limit 的模型。如果刚好设置了 gemini-1.5-pro-002 的频率限制,则 gemini-1.5-pro-002 的频率限制则为 500/min,如果此时请求的模型不是 gemini-1.5-pro-002,而是 gemini-1.5-pro-latest,由于 api_key_rate_limit 没有设置 gemini-1.5-pro-latest 的频率限制,因此会寻找有没有前缀和 gemini-1.5-pro-latest 相同的模型被设置了,因此 gemini-1.5-pro-latest 的频率限制会被设置为 1000/min。
|
||||
|
||||
- 我想设置渠道1和渠道2为随机轮训,uni-api 在渠道1和渠道2请求失败后才自动重试渠道3,怎么设置?
|
||||
|
||||
uni-api 支持将 api key 本身作为渠道,可以通过这一特性对渠道进行分组管理。
|
||||
|
||||
```yaml
|
||||
api_keys:
|
||||
- api: sk-xxx1
|
||||
model:
|
||||
- sk-xxx2/* # 渠道 1 2 采用随机轮训,失败后请求渠道3
|
||||
- aws/* # 渠道3
|
||||
preferences:
|
||||
SCHEDULING_ALGORITHM: fixed_priority # 表示始终优先请求 api key:sk-xxx2 里面的渠道 1 2,失败后自动请求渠道 3
|
||||
|
||||
- api: sk-xxx2
|
||||
model:
|
||||
- anthropic/claude-3-7-sonnet # 渠道1
|
||||
- openrouter/claude-3-7-sonnet # 渠道2
|
||||
preferences:
|
||||
SCHEDULING_ALGORITHM: random # 渠道 1 2 采用随机轮训
|
||||
```
|
||||
|
||||
## ⭐ Star 历史
|
||||
|
||||
<a href="https://github.com/yym68686/uni-api/stargazers">
|
||||
<img width="500" alt="Star History Chart" src="https://api.star-history.com/svg?repos=yym68686/uni-api&type=Date">
|
||||
</a>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: uni-api
|
||||
tags:
|
||||
- AI / 大模型
|
||||
title: 统一管理大模型 API 的项目,可以通过一个统一的API 接口调用多种不同提供商的服务,统一转换为 OpenAI 格式。
|
||||
description: 如果个人使用的话,one/new-api 过于复杂,有很多个人不需要使用的商用功能,如果你不想要复杂的前端界面,又想要支持的模型多一点,可以试试 uni-api。这是一个统一管理大模型 API 的项目,可以通过一个统一的API 接口调用多种不同提供商的服务,统一转换为 OpenAI 格式,支持负载均衡。目前支持的后端服务有:OpenAI、Anthropic、Gemini、Vertex、Azure、xai、Cohere、Groq、Cloudflare、OpenRouter 等。
|
||||
additionalProperties:
|
||||
key: uni-api
|
||||
name: uni api
|
||||
tags:
|
||||
- AI
|
||||
shortDescZh: 这是一个统一管理大模型 API 的项目,可以通过一个统一的API 接口调用多种不同提供商的服务,统一转换为 OpenAI 格式,支持负载均衡。目前支持的后端服务有:OpenAI、Anthropic、Gemini、Vertex、Azure、xai、Cohere、Groq、Cloudflare、OpenRouter 等。
|
||||
shortDescEn: This is a project that unifies the management of LLM APIs. It can call multiple backend services through a unified API interface, convert them to the OpenAI format uniformly, and support load balancing.
|
||||
type: tool
|
||||
crossVersionUpdate: true
|
||||
limit: 0
|
||||
recommend: 0
|
||||
website: https://github.com/yym68686/uni-api
|
||||
github: https://github.com/yym68686/uni-api
|
||||
document: https://github.com/yym68686/uni-api/blob/main/README_CN.md
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
additionalProperties:
|
||||
formFields:
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: CONFIG_URL
|
||||
labelEn: CONFIG_URL
|
||||
labelZh: 远程配置文件地址(若配置,则首先拉取远程配置到本地)
|
||||
required: false
|
||||
type: text
|
||||
- default: ./config
|
||||
edit: true
|
||||
envKey: LOCAL_CONFIG_PATH
|
||||
labelEn: local config file path
|
||||
labelZh: 本地配置文件地址
|
||||
required: true
|
||||
type: text
|
||||
- default: ./data
|
||||
edit: true
|
||||
envKey: DATA_PATH
|
||||
labelEn: uni-api data path
|
||||
labelZh: uni-api数据存储路径
|
||||
required: true
|
||||
type: text
|
||||
- default: 38000
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: Port
|
||||
labelZh: 端口
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
services:
|
||||
uni-api:
|
||||
image: yym68686/uni-api:latest
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
ports:
|
||||
- ${PANEL_APP_PORT_HTTP}:8000
|
||||
volumes:
|
||||
- "${DATA_PATH}:/home/data"
|
||||
- "${LOCAL_CONFIG_PATH}:/home/api.yaml"
|
||||
environment:
|
||||
- CONFIG_URL=${CONFIG_URL}
|
||||
networks:
|
||||
- 1panel-network
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
|
After Width: | Height: | Size: 43 KiB |