Kimi Usage Monitor
Monitor Kimi K2.5 usage quotas from the Kimi console to make informed decisions about task prioritization and resource allocation.
When to Use This Skill
- - Before intensive operations: Check quota before starting multi-step research or coding tasks
- Autonomous planning: Self-prioritize tasks based on remaining usage percentage
- Rate limit awareness: Know when quotas reset to time high-priority work
- Usage tracking: Log patterns for long-term capacity planning
Quick Start
Prerequisites: Chrome with OpenClaw extension attached
- 1. Open Chrome → INLINECODE0
- Click OpenClaw extension icon (badge should show ON)
- Ensure you're logged into Kimi
CODEBLOCK0
Platform Support: Linux ✅ | macOS ✅ | Windows (WSL) ✅ | Windows (Native) ✅
Usage Data Available
The Kimi console shows:
| Metric | Description | Decision Threshold |
|---|
| Weekly Usage | Percentage of weekly quota consumed | >75% = prioritize |
| Weekly Reset |
Hours until quota resets | Plan heavy tasks after reset |
|
Rate Limit | Additional rate limiting quota | Secondary resource |
|
Rate Reset | Hours until rate limit resets | Short-term buffer |
Autonomous Decision Guidelines
When operating autonomously, use these heuristics:
🟢 High Capacity (>50% remaining)
- - Proceed with full capability
- Accept multi-step research tasks
- Spawn subagents as needed
- Enable verbose reasoning
🟡 Moderate Capacity (25-50% remaining)
- - Batch similar operations
- Prefer concise outputs
- Use subagents sparingly
- Disable non-essential reasoning
🔴 Low Capacity (<25% remaining)
- - Essential tasks only
- Single-step operations
- Avoid subagent spawning
- Prioritize user-directed work over proactive tasks
Pre-Flight Checks for Intensive Operations
Before spawning subagents or starting multi-step tasks, check capacity:
CODEBLOCK1
Returns exit code 0 if cleared, 1 if blocked. Use in scripts:
CODEBLOCK2
Subagent Guard
Check specifically before spawning subagents:
CODEBLOCK3
Returns JSON with can_spawn boolean:
CODEBLOCK4
Integration Ideas
Hourly monitoring cron:
CODEBLOCK5
Pre-task validation:
CODEBLOCK6
Script Reference
| Script | Purpose |
|---|
| INLINECODE2 | Main usage scraper (browser-based) |
| INLINECODE3 |
Autonomous logging + decision wrapper |
|
scripts/preflight_check.py | Pre-flight validation for operations |
|
scripts/subagent_guard.py | Check before spawning subagents |
|
check_usage.sh | Quick CLI wrapper |
Note: Alternative Playwright-based scraper (fetch_kimi_usage.py) available for non-OpenClaw environments (requires system dependencies).
Troubleshooting
"Browser not available"
- - Ensure Chrome extension is attached (badge shows ON)
- Verify the Kimi console tab is open
"Could not detect usage"
- - Make sure you're logged into Kimi
- Check that the console page has fully loaded
Authentication errors
- - Re-authenticate at INLINECODE8
- The browser tool uses your existing Chrome session
Output Format
Human-Readable (default)
CODEBLOCK7
JSON (--json flag)
CODEBLOCK8
License
MIT License - Feel free to modify and distribute.
Kimi 用量监控器
从 Kimi 控制台监控 Kimi K2.5 用量配额,以便对任务优先级和资源分配做出明智决策。
何时使用此技能
- - 高强度操作前:在开始多步骤研究或编码任务前检查配额
- 自主规划:根据剩余用量百分比自动确定任务优先级
- 速率限制感知:了解配额重置时间,以便安排高优先级工作
- 用量追踪:记录使用模式,用于长期容量规划
快速开始
前置条件: 已安装 OpenClaw 扩展的 Chrome 浏览器
- 1. 打开 Chrome → https://www.kimi.com/code/console?from=membership
- 点击 OpenClaw 扩展图标(徽章应显示为 ON)
- 确保已登录 Kimi
bash
检查当前用量(Linux/macOS/WSL)
./check_usage.sh
Windows 原生
check_usage.bat # CMD
.\check_usage.ps1 # PowerShell
JSON 格式输出(所有平台)
python3 scripts/fetch_usage.py --json
平台支持: Linux ✅ | macOS ✅ | Windows (WSL) ✅ | Windows (原生) ✅
可用用量数据
Kimi 控制台显示:
| 指标 | 描述 | 决策阈值 |
|---|
| 周用量 | 每周配额已消耗百分比 | >75% = 优先处理 |
| 周重置 |
配额重置剩余小时数 | 重置后安排重任务 |
|
速率限制 | 额外的速率限制配额 | 次要资源 |
|
速率重置 | 速率限制重置剩余小时数 | 短期缓冲 |
自主决策指南
自主运行时,使用以下启发式规则:
🟢 高容量(剩余 >50%)
- - 全功能运行
- 接受多步骤研究任务
- 根据需要生成子代理
- 启用详细推理
🟡 中等容量(剩余 25-50%)
- - 批量处理相似操作
- 优先使用简洁输出
- 谨慎使用子代理
- 禁用非必要推理
🔴 低容量(剩余 <25%)
- - 仅执行必要任务
- 单步操作
- 避免生成子代理
- 优先处理用户指定工作,而非主动任务
高强度操作前检查
在生成子代理或开始多步骤任务前,检查容量:
bash
检查操作是否应继续
python3 scripts/preflight_check.py [light|standard|intensive]
Light:单次查询,简单任务(需要 10%)
Standard:普通子代理,研究(需要 25%)
Intensive:多子代理,深度研究(需要 50%)
通过时返回退出码 0,被阻止时返回 1。在脚本中使用:
bash
if python3 scripts/preflight_check.py intensive; then
# 继续执行高强度操作
sessions_spawn 复杂研究任务...
fi
子代理守卫
在生成子代理前专门检查:
bash
python3 scripts/subagent_guard.py
返回包含 can_spawn 布尔值的 JSON:
json
{
can_spawn: true,
usage_percent: 45,
remaining_percent: 55,
resets_hours: 36
}
集成思路
每小时监控定时任务:
bash
添加到 crontab 或 OpenClaw 任务
0
cd /path/to/kimi-usage-monitor && python3 scripts/usage_logger.py
任务前验证:
python
import subprocess
result = subprocess.run(
[python3, scripts/preflight_check.py, intensive],
capture_output=True
)
if result.returncode == 0:
# 继续执行任务
pass
脚本参考
| 脚本 | 用途 |
|---|
| scripts/fetchusage.py | 主要用量抓取器(基于浏览器) |
| scripts/usagelogger.py |
自动记录 + 决策封装 |
| scripts/preflight_check.py | 操作前验证检查 |
| scripts/subagent_guard.py | 生成子代理前检查 |
| check_usage.sh | 快速 CLI 封装 |
注意: 针对非 OpenClaw 环境,提供基于 Playwright 的替代抓取器(fetchkimiusage.py)(需要系统依赖)。
故障排除
浏览器不可用
- - 确保已附加 Chrome 扩展(徽章显示 ON)
- 确认 Kimi 控制台标签页已打开
无法检测到用量
- - 确保已登录 Kimi
- 检查控制台页面是否已完全加载
认证错误
- - 在 https://www.kimi.com/code/console 重新认证
- 浏览器工具使用您现有的 Chrome 会话
输出格式
人类可读(默认)
📊 Kimi 用量监控器
========================================
🗓️ 周用量
已用:45%
剩余:55%
重置时间:36 小时后
状态:🟡 中等 — 请相应规划
⚡ 速率限制
已用:2%
重置时间:3 小时后
JSON(--json 标志)
json
{
weekly
usagepercent: 45,
weekly
resetshours: 36,
rate
limitpercent: 2,
rate
limitresets_hours: 3,
timestamp: 2026-02-12 21:15:00
}
许可证
MIT 许可证 — 可自由修改和分发。