📦 kimi-quota-monitor

v1.0.0

Kimi(Kimi Chat)会员额度监控与每日报告。用于用户需要(1)查看当前Kimi使用百分比,(2)设置或配置……

0· 22·0 当前·0 累计
0

运行时依赖

无特殊依赖

安装命令

点击复制
官方npx clawhub@latest install kimi-quota-monitor
镜像加速npx clawhub@latest install kimi-quota-monitor --registry https://cn.longxiaskill.com

技能文档

Kimi Quota Monitor 抓取 Kimi 会员额度百分比,计算周期抵扣逻辑,推送到微信。

⚠️ 使用前配置(必须) 本 skill 需填入个人认证信息方可运行。打开 scripts/fetch_quota.py,修改顶部“用户配置区”:

  • Cookies 文件
将已登录 Kimi 的 cookies 导出为 JSON,存为脚本同级目录(或绝对路径)。 格式(Playwright cookies 数组): [ {"name":"a1","value":"xxx","domain":".kimi.com","path":"/"}, {"name":"web_session","value":"xxx","domain":".kimi.com","path":"/"} ] 导出:浏览器开发者工具 → Application → Cookies → 复制 .kimi.com 域全部 cookies,保存为 kimi_cookies.json。

  • 微信推送目标 ID
获取 openclaw-weixin 用户 ID: openclaw message list-accounts --channel openclaw-weixin 将 TARGET_ID 替换为你的 ID(格式 xxx@im.wechat)。

  • localStorage 认证数据
在已登录 Kimi 的浏览器中,开发者工具 → Application → Local Storage → https://www.kimi.com,复制以下键值: access_token refresh_token msh_user_id msh_user_subscription_data 填入 LS_DATA 字典。 ⚠️ 以上信息敏感,请勿泄露。

Quick Start 手动抓取额度 配置完成后,在 skill 目录执行: python3 scripts/fetch_quota.py 脚本自动:

  • 启动 Playwright headless Chrome
  • 加载 cookies 与 localStorage 登录
  • 访问 kimi.com/membership/subscription
  • 提取额度百分比
  • 计算周期与抵扣
  • 推送到微信

配置定时任务 crontab 添加: 8 7 * /usr/bin/python3 /path/to/kimi-quota-monitor/scripts/fetch_quota.py >> /path/to/logs/kimi_quota.log 2>&1

Dependencies

  • playwright Python 包(pip install playwright)
  • 系统 Chrome 浏览器(google-chrome 或 chromium)
  • 已配置 openclaw-weixin 通道的 openclaw CLI
  • kimi_cookies.json(用户自备)

额度计算逻辑 重置日:每月 22 日 周期长度:当月总天数(28/29/30/31) 日基准:100% / 月天数 KimiClaw 预估:每日约 0.6% 抵扣:KimiClaw 预估值从差值中扣减,直至差值为 0 详见 references/quota_rules.md

Resources scripts/ └─ fetch_quota.py — 主脚本:抓取、计算、推送(顶部“用户配置区”须填写)

references/ └─ quota_rules.md — 计算规则、页面 URL、选择器、消息模板

Files scripts/fetch_quota.py — 核心自动化脚本(需用户配置) references/quota_rules.md — 计算规则与参考 kimi_cookies.json — Kimi 登录 cookies(用户自备,不含)

数据来源ClawHub ↗ · 中文优化:龙虾技能库