Skip to content

StartNight/modelScope_free_quota_inquiry

Repository files navigation

ModelScope 免费 API 额度查询工具

查询魔搭(ModelScope)平台免费 API 的额度使用情况,支持账户级概览和模型级详细查询。

功能特性

  • 账户额度概览:查看免费额度、总额度、已用额度
  • 模型额度详情:查询每个模型的限额和剩余额度
  • 三种交互模式:GUI 图形界面 / CLI 命令行 / HTML 报告
  • 跨平台:支持 Windows、macOS、Linux
  • API Key 安全:支持环境变量/命令行参数/GUI输入,无硬编码

快速开始

下载可执行文件(免安装)

前往 Releases 页面下载对应平台的可执行文件:

平台 文件名
Windows modelscope-quota-windows-x64.exe
macOS modelscope-quota-macos-arm64
Linux modelscope-quota-linux-x64

Windows 双击运行即可;macOS/Linux 首次运行需添加执行权限:

# macOS
chmod +x modelscope-quota-macos-arm64
./modelscope-quota-macos-arm64

# Linux
chmod +x modelscope-quota-linux-x64
./modelscope-quota-linux-x64

macOS 安全提示:首次打开可能被 Gatekeeper 阻止,请在"系统设置 → 隐私与安全性"中点击"仍要打开"。

从源码运行

git clone https://github.com/YOUR_USERNAME/modelscope-quota-tool.git
cd modelscope-quota-tool
pip install -r requirements.txt
python modelscope_quota.py --gui

使用说明

配置 API Key

三种方式(优先级从高到低):

  1. GUI 输入:启动后在输入框中填写
  2. 命令行参数--api-key KEY
  3. 环境变量export MODELSCOPE_API_KEY=ms-xxxxxxxx

API Key 获取:登录 魔搭平台 → 账户设置 → API Token

命令行参数

python modelscope_quota.py              # 默认概览模式
python modelscope_quota.py --gui        # 启动 GUI 图形界面
python modelscope_quota.py --all        # 查询所有模型额度
python modelscope_quota.py --model ID   # 查询指定模型额度
python modelscope_quota.py --report     # 生成 HTML 额度报告
python modelscope_quota.py --api-key KEY  # 指定 API Key
python modelscope_quota.py --workers N  # 并发线程数(默认5,上限10)

Windows 快捷启动

脚本 功能
打开额度查询.bat 启动 GUI 模式(无控制台窗口)
查询额度.bat CLI 查询所有模型额度
生成额度报告.bat 生成 HTML 报告并在浏览器中打开

项目结构

├── models.py              # 数据模型定义
├── config.py              # API Key 配置管理
├── api_client.py          # ModelScope API 客户端
├── cli.py                 # CLI 交互模式
├── gui.py                 # GUI 交互模式(Tkinter)
├── report.py              # HTML 报告生成
├── main.py                # 入口调度
├── modelscope_quota.py    # 入口脚本
├── requirements.txt       # 依赖声明
├── modelscope_quota.spec  # PyInstaller 打包配置
├── .github/workflows/     # GitHub Actions CI/CD
└── bat 启动脚本            # Windows 快捷启动

开发与构建

本地开发

pip install -r requirements.txt

本地打包

pip install pyinstaller
pyinstaller modelscope_quota.spec

构建产物在 dist/ 目录下。

发布新版本

推送 tag 触发 GitHub Actions 自动构建并发布 Release:

git tag v1.0.0
git push origin v1.0.0

许可证

MIT License

About

魔搭免费配额查询

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors