最新消息

A

奇源空间

反抗 变革 自由

立即注册 前往卡网 官方群聊 服务列表
  • 奇源空间官方社群公告

    奇源空间官方社群通道

    奇源空间发卡网 各类游戏辅助续费 白号/黑号 Steam解封 GTA刷金
    卡网地址:https://store.neverforever.space

国外搬运 用ChannelMonitor自动测试OneAPI/NewAPI的渠道并自动更新

主题 作者
自治委员
gemgemgemgemgemgem
管理成员
联邦委员
议会议员
VIP
07
896
127


佬们的公益API实在太多啦!如果手动对每个进行维护需要耗费大量精力,因此写了个项目:
Channel Monitor 是一个用于监控OneAPI/NewAPI渠道的工具,它直接读取channels数据表,每间隔一段时间测试每个渠道的模型可用性,根据请求是否成功更新可用模型,写入到数据表中,以此来实现渠道的自动监控,保证整体OneAPI/NewAPI的高可用,尽可能减少错误返回次数。
项目地址:GitHub - DullJZ/ChannelMonitor: Channel Monitor 是一个用于监控OneAPI/NewAPI渠道的工具,它直接读取channels数据表,每间隔一段时间测试每个渠道的模型可用性,根据请求是否成功更新可用模型,写入到数据表中,以此来实现渠道的自动监控,保证整体OneAPI/NewAPI的高可用,尽可能减少错误返回次数。 10

特性​

  • 直接读写OneAPI/NewAPI的数据库
  • 测试渠道的每个模型可用性
  • 自动向上游获取可用模型
  • 自动更新数据库中的每个渠道可用模型
  • 支持排除不予监控的渠道和模型
  • 支持间隔时间配置
  • TODO: 多线程并发测试
运行截图:
1731497888807.png

安装​

二进制​

Releases页面下载最新版本的二进制文件,在同一目录下配置config.json后运行即可。建议使用screen或nohup等工具后台运行。

mkdir ChannelMonitor && cd ChannelMonitor
wget https://github.com/DullJZ/ChannelMonitor/releases/download/v0.1.0/ChannelMonitor_linux_amd64
chmod +x ChannelMonitor_linux_amd64
# 下载并修改配置文件
wget https://raw.githubusercontent.com/DullJZ/ChannelMonitor/refs/heads/main/config_example.json -O config.json
nano config.json
screen -S ChannelMonitor
./ChannelMonitor_linux_amd64

Docker​


docker pull dulljz/channel-monitor
# 下载并修改配置文件
wget https://raw.githubusercontent.com/DullJZ/ChannelMonitor/refs/heads/main/config_example.json -O config.json
nano config.json
# 如果使用宿主机的数据库,可以简单使用host模式,
# 并使用localhost:3306作为数据库地址
docker run -d --name ChannelMonitor -v ./config.json:/app/config.json -net host dulljz/channel-monitor

Docker Compose​


version: '3'
services:
channel-monitor:
image: dulljz/channel-monitor
volumes:
- ./config.json:/app/config.json
# 如果使用宿主机的数据库,可以简单使用host模式,
# 并使用localhost:3306作为数据库地址
network_mode: host


# 下载并修改配置文件
wget https://raw.githubusercontent.com/DullJZ/ChannelMonitor/refs/heads/main/config_example.json -O config.json
nano config.json
docker-compose up -d

配置​


{
// 排除不予监控的渠道ID
"exclude_channel": [5],
// 排除不予监控的模型ID
"exclude_model": ["advanced-voice"],
// 模型列表,仅当获取不到渠道的模型(/v1/models)时使用
"models": ["gpt-3.5-turbo", "gpt-3.5-turbo"],
// 模型可用性测试的时间间隔,建议不小于30分钟,接收的时间格式为s、m、h
"time_period": "1h",
// 数据库DSN字符串,格式为:user:password@tcp(host:port)/database
"db_dsn": "YOUR_DB_DSN"
}
 
顶部