AI模型聚合管理中转分发系统,一个应用管理您的所有AI模型,支持将多种大模型转为统一格式调用,支持OpenAI、Claude、Gemini等格式,可供个人或者企业内部管理与分发渠道使用。

CaIon c33b1522cc fix: 充值并发导致订单号相同 1 year ago
.github 1bfc46aa70 ci: update workflows 1 year ago
bin d84b0b0f5d chore: add model parameter to the time_test script (#245) 2 years ago
common 64b9d3b58c feat: 初步兼容生成内容检查 1 year ago
constant d7e25e1604 fix: fix SensitiveWords load error 1 year ago
controller c33b1522cc fix: 充值并发导致订单号相同 1 year ago
dto 3e03c5a742 fix: add missing id,object,created 1 year ago
i18n a721a5b6f9 chore: add error prompt for Azure 2 years ago
middleware f63ad9c03c fix: make the 'openai_organization' parameter actually work. 1 year ago
model d5e93e788d fix: midjourneys table 1 year ago
relay ff7da08bad fix: add missing created 1 year ago
router 9b5353a81a feat: support InsightFace (close #60) 1 year ago
service 9b64f4a34a fix: fix mj panic 1 year ago
web 2db4282666 feat: 保留功能 1 year ago
.gitignore 42451d9d02 refactor: update logging related logic 2 years ago
Dockerfile 7a4969c238 update Dockerfile 2 years ago
LICENSE 954ed893b9 Update LICENSE 2 years ago
Midjourney.md a26b9a9bff Update Midjourney.md 1 year ago
README.md bec21ade9d Update README.md 1 year ago
VERSION 7e80e2da3a fix: add a blank VERSION file (#135) 2 years ago
docker-compose.yml cb92d6fd5f revert compose 1 year ago
go.mod 7a663d26ec feat: 初步兼容敏感词过滤 1 year ago
go.sum 7a663d26ec feat: 初步兼容敏感词过滤 1 year ago
main.go 6013219f5b feat: 初步重构完成 1 year ago
makefile 699fe256d0 address comment 1 year ago
one-api.service c6717307d0 chore: update one-api.service 2 years ago

README.md

New API

[!NOTE] 本项目为开源项目,在One API的基础上进行二次开发,感谢原作者的无私奉献。 使用者必须在遵循 OpenAI 的使用条款以及法律法规的情况下使用,不得用于非法用途。

[!WARNING] 本项目为个人学习使用,不保证稳定性,且不提供任何技术支持,使用者必须在遵循 OpenAI 的使用条款以及法律法规的情况下使用,不得用于非法用途。
根据《生成式人工智能服务管理暂行办法》的要求,请勿对中国地区公众提供一切未经备案的生成式人工智能服务。

[!NOTE] 最新版Docker镜像 calciumion/new-api:latest
更新指令 docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR

主要变更

此分叉版本的主要变更如下:

  1. 全新的UI界面(部分界面还待更新)
  2. 添加Midjourney-Proxy(Plus)接口的支持,对接文档,支持的接口如下:
    • /mj/submit/imagine
    • /mj/submit/change
    • /mj/submit/blend
    • /mj/submit/describe
    • /mj/image/{id} (通过此接口获取图片,请必须在系统设置中填写服务器地址!!
    • /mj/task/{id}/fetch (此接口返回的图片地址为经过One API转发的地址)
    • /task/list-by-condition
    • /mj/submit/action (仅midjourney-proxy-plus支持,下同)
    • /mj/submit/modal
    • /mj/submit/shorten
    • /mj/task/{id}/image-seed
    • /mj/insight-face/swap (InsightFace)
  3. 支持在线充值功能,可在系统设置中设置,当前支持的支付接口:
    • 易支付
  4. 支持用key查询使用额度:
  5. 渠道显示已使用额度,支持指定组织访问
  6. 分页支持选择每页显示数量
  7. 兼容原版One API的数据库,可直接使用原版数据库(one-api.db)
  8. 支持模型按次数收费,可在 系统设置-运营设置 中设置
  9. 支持渠道加权随机
  10. 数据看板
  11. 可设置令牌能调用的模型
  12. 支持Telegram授权登录。
    1. 系统设置-配置登录注册-允许通过Telegram登录
    2. @Botfather输入指令/setdomain
    3. 选择你的bot,然后输入http(s)://你的网站地址/login
    4. Telegram Bot 名称是bot username 去掉@后的字符串

模型支持

此版本额外支持以下模型:

  1. 第三方模型 gps (gpt-4-gizmo-*)
  2. 智谱glm-4v,glm-4v识图
  3. Anthropic Claude 3 (claude-3-opus-20240229, claude-3-sonnet-20240229)
  4. Ollama,添加渠道时,密钥可以随便填写,默认的请求地址是http://localhost:11434,如果需要修改请在渠道中修改
  5. Midjourney-Proxy(Plus)接口,对接文档

您可以在渠道中添加自定义模型gpt-4-gizmo-*,此模型并非OpenAI官方模型,而是第三方模型,使用官方key无法调用。

部署

基于 Docker 进行部署

# 使用 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

使用宝塔面板Docker功能部署

# 使用 SQLite 的部署命令:
docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /www/wwwroot/new-api:/data calciumion/new-api:latest
# 使用 MySQL 的部署命令,在上面的基础上添加 `-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi"`,请自行修改数据库连接参数。
# 例如:
# 注意:数据库要开启远程访问,并且只允许服务器IP访问
docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:123456@tcp(宝塔的服务器地址:宝塔数据库端口)/宝塔数据库名称" -e TZ=Asia/Shanghai -v /www/wwwroot/new-api:/data calciumion/new-api:latest
# 注意:数据库要开启远程访问,并且只允许服务器IP访问

Midjourney接口设置文档

对接文档

交流群

界面截图

image

image

image
image
image image 夜间模式
image

image
image

相关项目

Star History

Star History Chart