Skill: qiaotucodes/openclaw-skill-minimax-tracker (version 0.1.0)

# SKILL.md - MiniMax Usage Tracker ## Skill Information - **Skill Name**: openclaw-skill-minimax-tracker - **Version**: 1.0.0 - **Author**: QiaoTuCodes (Weiran), Yanyan - **Description**: Track and monitor MiniMax API usage with progress bars and reminders for OpenClaw - **Repository**: https://github.com/QiaoTuCodes/openclaw-skill-minimax-tracker ## Overview This skill provides real-time tracking for MiniMax API usage. It calculates usage based on prompts consumed, tracks remaining quota, and displays progress in a compact bar format. Designed for OpenClaw agents to monitor API usage between resets. ## Features - Real-time prompts usage tracking - Visual progress bar with key metrics (RST/TTL/PKG/USE/REM/NXT) - Automatic reset time calculation (15:00-20:00 UTC+8) - JSON-based persistent storage - Cron-ready for scheduled reminders ## Usage ### Commands ```bash # Add usage (after API call) python3 minimax_tracker.py add [n] # View detailed status python3 minimax_tracker.py status # View compact progress bar python3 minimax_tracker.py compact ``` ### Output Format ``` [████████████████████] 98% RST:18:00 TTL:1h40m PKG:Starter USE:2/40 REM:38 NXT:19:19 ``` ### Integration with OpenClaw ```python # In your skill or agent code import subprocess # Track usage after each API call result = subprocess.run( ["python3", "path/to/minimax_tracker.py", "add", "1"], capture_output=True, text=True ) ``` ### Cron Setup (Every 3 Hours) ```json { "name": "minimax-usage-check", "schedule": "0 */3 * * *", "payload": { "kind": "agentTurn", "message": "Run: python3 ~/openclaw-workspace/skills/openclaw-skill-minimax-tracker/minimax_tracker.py compact" } } ``` ## Configuration Edit the CONFIG dict in minimax_tracker.py: | Parameter | Default | Description | |-----------|---------|-------------| | max_prompts | 40 | Monthly prompts limit | | reset_hour_start | 15 | Reset window start (UTC+8) | | reset_hour_end | 20 | Reset window end (UTC+8) | | check_interval_hours | 3 | Reminder interval | ## Data Storage Usage data is stored in: ``` ~/.openclaw/workspace/minimax_usage_data.json ``` Format: ```json { "usage_records": [ {"time": "2026-02-27T16:19:00", "prompts": 1} ], "current_usage": 2, "last_reset": "2026-02-27T18:00:00", "last_check": "2026-02-27T16:23:00" } ``` ## Dependencies - Python 3.8+ (standard library only, no pip packages needed) ## Installation ```bash # Copy to OpenClaw skills folder cp -r openclaw-skill-minimax-tracker ~/openclaw-workspace/skills/ ``` ## License MIT License - See LICENSE file

path: README-CN.md
content: # openclaw-skill-minimax-tracker

<p align="center">
  <img src="https://raw.githubusercontent.com/QiaoTuCodes/openclaw-skill-whisper-stt/main/assets/openclaw-skill-logo.png" alt="MiniMax Tracker" width="500" style="visibility: visible; max-width: 100%;">
</p>

<p align="center">
  <strong>📊 MiniMax API 用量追踪技能 for OpenClaw</strong>
</p>

<p align="center">
  <a href="https://github.com/QiaoTuCodes/openclaw-skill-minimax-tracker/releases"><img src="https://img.shields.io/github/v/release/QiaoTuCodes/openclaw-skill-minimax-tracker?include_prereleases&style=for-the-badge" alt="GitHub release"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" alt="MIT License"></a>
</p>

> 实时追踪和监控 MiniMax API 用量，带有进度条显示和自动提醒功能，专为 OpenClaw agents 设计。

## ✨ 功能特性

- 📊 **实时用量追踪** - 实时追踪 prompts 使用情况
- 📈 **进度条显示** - 可视化进度条 + 关键指标
- ⏰ **自动重置计算** - 基于 MiniMax 规则计算重置时间
- 🔔 **定时提醒** - Cron 定时用量检查提醒
- 💾 **持久化存储** - JSON 用量历史记录
- 🔄 **Agent 集成** - 轻松集成到 OpenClaw agents

## 📦 安装

```bash
# 克隆到你的 OpenClaw 工作区
cd ~/openclaw-workspace/skills
git clone https://github.com/QiaoTuCodes/openclaw-skill-minimax-tracker.git

# 或手动复制
cp -r openclaw-skill-minimax-tracker ~/openclaw-workspace/skills/
```

## 🚀 快速开始

```bash
# 查看当前状态
python3 openclaw-skill-minimax-tracker/minimax_tracker.py status

# 记录用量（每次 API 调用后）
python3 openclaw-skill-minimax-tracker/minimax_tracker.py add

# 查看简洁进度条
python3 openclaw-skill-minimax-tracker/minimax_tracker.py compact
```

## 📊 进度条格式

```
[████████████████████] 98% RST:18:00 TTL:1h40m PKG:Starter USE:2/40 REM:38 NXT:19:19
```

**图例：**
| 缩写 | 含义 |
|------|------|
| RST | 重置时间 |
| TTL | 距重置时间 |
| PKG | 套餐名称 |
| USE | 已用 prompts |
| REM | 剩余 prompts |
| NXT | 下次提醒时间 |

## ⚙️ 配置

修改 `minimax_tracker.py` 中的配置：

```python
CONFIG = {
    "max_prompts": 40,           # 每月最大 prompts 数
    "reset_hour_start": 15,      # 重置窗口开始 (15:00 UTC+8)
    "reset_hour_end": 20,        # 重置窗口结束 (20:00 UTC+8)
    "check_interval_hours": 3,  # 提醒间隔
}
```

## 🤖 OpenClaw 集成

### Agent 代码集成

```python
import subprocess

# API 调用后追踪用量
result = subprocess.run(
    ["python3", "~/openclaw-workspace/skills/openclaw-skill-minimax-tracker/minimax_tracker.py", "add", "1"],
    capture_output=True, text=True
)
print(result.stdout)
```

### Cron 设置（每3小时）

```json
{
  "name": "minimax-usage-check",
  "schedule": "0 */3 * * *",
  "payload": {
    "kind": "agentTurn",
    "message": "Run: python3 ~/openclaw-workspace/skills/openclaw-skill-minimax-tracker/minimax_tracker.py compact"
  }
}
```

## 📖 文档

- [English README](README.md)
- [中文文档](README-CN.md)
- [技能定义](SKILL.md)

## 🔨 环境要求

- Python 3.8+
- 无需外部依赖（纯标准库）

## 📂 项目结构

```
openclaw-skill-minimax-tracker/
├── SKILL.md                    # OpenClaw 技能定义
├── minimax_tracker.py          # Python 主脚本
├── README.md                   # 英文文档
├── README-CN.md               # 中文文档
├── LICENSE                    # MIT 许可证
├── .gitignore                 # Git 忽略规则
└── assets/                    # 图标和资源
    └── icon.png
```

## 🤝 贡献

欢迎提交 Pull Request！

## 📜 许可证

MIT License - 详见 [LICENSE](LICENSE)

## 👥 作者

- **魏然 (Weiran)** - [GitHub](https://github.com/QiaoTuCodes)
- **焱焱 (Yanyan)** - AI 助手

## 🔗 相关链接

- [OpenClaw 文档](https://docs.openclaw.ai)
- [技能市场](https://clawhub.com)
- [MiniMax 平台](https://platform.minimaxi.com)

---

<p align="center">
  <sub>用 ❤️ 为 OpenClaw 社区打造</sub>
</p>


path: README.md
content: # openclaw-skill-minimax-tracker

<p align="center">
  <img src="https://raw.githubusercontent.com/QiaoTuCodes/openclaw-skill-whisper-stt/main/assets/openclaw-skill-logo.png" alt="MiniMax Tracker" width="500" style="visibility: visible; max-width: 100%;">
</p>

<p align="center">
  <strong>📊 MiniMax API Usage Tracker Skill for OpenClaw</strong>
</p>

<p align="center">
  <a href="https://github.com/QiaoTuCodes/openclaw-skill-minimax-tracker/releases"><img src="https://img.shields.io/github/v/release/QiaoTuCodes/openclaw-skill-minimax-tracker?include_prereleases&style=for-the-badge" alt="GitHub release"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" alt="MIT License"></a>
  <a href="https://github.com/QiaoTuCodes/openclaw-skill-minimax-tracker/stargazers"><img src="https://img.shields.io/github/stars/QiaoTuCodes/openclaw-skill-minimax-tracker?style=for-the-badge" alt="Stars"></a>
</p>

> Track and monitor MiniMax API usage with real-time progress bars and automated reminders for OpenClaw agents.

## ✨ Features

- 📊 **Real-time Usage Tracking** - Track prompts usage in real-time
- 📈 **Progress Bar Display** - Visual progress bar with key metrics
- ⏰ **Auto Reset Calculation** - Calculate reset time based on MiniMax rules
- 🔔 **Scheduled Reminders** - Cron-based usage check reminders
- 💾 **Persistent Storage** - JSON-based usage history
- 🔄 **Agent Integration** - Easy integration with OpenClaw agents

## 📦 Installation

```bash
# Clone to your OpenClaw workspace
cd ~/openclaw-workspace/skills
git clone https://github.com/QiaoTuCodes/openclaw-skill-minimax-tracker.git

# Or copy manually
cp -r openclaw-skill-minimax-tracker ~/openclaw-workspace/skills/
```

## 🚀 Quick Start

```bash
# View current status
python3 openclaw-skill-minimax-tracker/minimax_tracker.py status

# Add usage (after each API call)
python3 openclaw-skill-minimax-tracker/minimax_tracker.py add

# View compact progress bar
python3 openclaw-skill-minimax-tracker/minimax_tracker.py compact
```

## 📊 Progress Bar Format

```
[████████████████████] 98% RST:18:00 TTL:1h40m PKG:Starter USE:2/40 REM:38 NXT:19:19
```

**Legend:**
| Abbr | Meaning |
|------|---------|
| RST | Reset time |
| TTL | Time until reset |
| PKG | Package name |
| USE | Used prompts |
| REM | Remaining prompts |
| NXT | Next reminder time |

## 🔧 Configuration

Edit `minimax_tracker.py` to customize:

```python
CONFIG = {
    "max_prompts": 40,           # Max prompts per month
    "reset_hour_start": 15,      # Reset window start (15:00 UTC+8)
    "reset_hour_end": 20,        # Reset window end (20:00 UTC+8)
    "check_interval_hours": 3,   # Reminder interval
}
```

## 🤖 OpenClaw Integration

### Agent Code Integration

```python
import subprocess

# Track usage after API call
result = subprocess.run(
    ["python3", "~/openclaw-workspace/skills/openclaw-skill-minimax-tracker/minimax_tracker.py", "add", "1"],
    capture_output=True, text=True
)
print(result.stdout)
```

### Cron Setup (Every 3 Hours)

```json
{
  "name": "minimax-usage-check",
  "schedule": "0 */3 * * *",
  "payload": {
    "kind": "agentTurn",
    "message": "Run: python3 ~/openclaw-workspace/skills/openclaw-skill-minimax-tracker/minimax_tracker.py compact"
  }
}
```

## 📖 Documentation

- [English README](README.md)
- [中文文档](README-CN.md)
- [Skill Definition](SKILL.md)

## 🔨 Requirements

- Python 3.8+
- No external dependencies (uses standard library only)

## 📂 Project Structure

```
openclaw-skill-minimax-tracker/
├── SKILL.md                    # OpenClaw skill definition
├── minimax_tracker.py          # Main Python script
├── README.md                   # English documentation
├── README-CN.md                # Chinese documentation
├── LICENSE                     # MIT License
├── .gitignore                  # Git ignore rules
└── assets/                     # Logo and assets
    └── icon.png
```

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## 📜 License

MIT License - see [LICENSE](LICENSE) for details.

## 👥 Authors

- **魏然 (Weiran)** - [GitHub](https://github.com/QiaoTuCodes)
- **焱焱 (Yanyan)** - AI Assistant

## 🔗 Related Links

- [OpenClaw Docs](https://docs.openclaw.ai)
- [Skill Marketplace](https://clawhub.com)
- [MiniMax Platform](https://platform.minimaxi.com)

---

<p align="center">
  <sub>Built with ❤️ for the OpenClaw community</sub>
</p>


path: minimax_tracker.py
content: #!/usr/bin/env python3
"""
MiniMax Usage Tracker
- Track API usage in real-time
- Calculate reset time based on rules
- Display progress bar status
"""

import json
import os
from datetime import datetime, timedelta
from pathlib import Path

# Config
CONFIG = {
    "max_prompts": 40,           # 40 prompts per month
    "reset_hour_start": 15,       # 15:00 UTC+8
    "reset_hour_end": 20,        # 20:00 UTC+8
    "check_interval_hours": 3,    # Check every 3 hours
}

DATA_FILE = os.path.expanduser("~/.openclaw/workspace/minimax_usage_data.json")

def load_data():
    """Load usage data from file"""
    if os.path.exists(DATA_FILE):
        with open(DATA_FILE, 'r') as f:
            return json.load(f)
    return {
        "usage_records": [],
        "current_usage": 0,
        "last_reset": None,
        "last_check": None
    }

def save_data(data):
    """Save usage data to file"""
    with open(DATA_FILE, 'w') as f:
        json.dump(data, f, indent=2)

def get_next_reset_time():
    """Calculate next reset time"""
    now = datetime.now()
    
    # Reset time is between 15:00-20:00 UTC+8
    # For simplicity, use 18:00 as average reset time
    reset_hour = 18
    reset_minute = 0
    
    today_reset = now.replace(hour=reset_hour, minute=reset_minute, second=0, microsecond=0)
    
    if now < today_reset:
        return today_reset
    else:
        # Next day
        return today_reset + timedelta(days=1)

def time_until_reset():
    """Calculate time until next reset"""
    now = datetime.now()
    next_reset = get_next_reset_time()
    delta = next_reset - now
    
    hours = int(delta.total_seconds() // 3600)
    minutes = int((delta.total_seconds() % 3600) // 60)
    
    return f"{hours}h{minutes}m"

def format_progress_bar(percentage, length=20):
    """Format progress bar"""
    filled = int(length * percentage / 100)
    bar = "█" * filled + "░" * (length - filled)
    return f"[{bar}]"

def add_usage(prompts_used=1):
    """Record a new usage"""
    data = load_data()
    
    now = datetime.now().isoformat()
    data["usage_records"].append({
        "time": now,
        "prompts": prompts_used
    })
    
    data["current_usage"] += prompts_used
    data["last_check"] = now
    
    # Check if reset needed
    next_reset = get_next_reset_time()
    if data.get("last_reset"):
        last_reset = datetime.fromisoformat(data["last_reset"])
        if datetime.now() > last_reset + timedelta(hours=24):
            # More than 24h since last reset, auto reset
            data["current_usage"] = 0
            data["last_reset"] = next_reset.isoformat()
    else:
        data["last_reset"] = next_reset.isoformat()
    
    save_data(data)
    return data["current_usage"]

def get_status():
    """Get current status"""
    data = load_data()
    
    used = data.get("current_usage", 0)
    max_prompts = CONFIG["max_prompts"]
    remaining = max_prompts - used
    
    # Calculate percentage
    used_pct = min(100, (used / max_prompts) * 100)
    remaining_pct = 100 - used_pct
    
    # Time info
    next_reset = get_next_reset_time()
    time_left = time_until_reset()
    
    # Next reminder time (3 hours from now)
    next_reminder = datetime.now() + timedelta(hours=CONFIG["check_interval_hours"])
    
    return {
        "used": used,
        "remaining": remaining,
        "max": max_prompts,
        "used_pct": used_pct,
        "remaining_pct": remaining_pct,
        "reset_time": next_reset.strftime("%H:%M"),
        "time_left": time_left,
        "next_reminder": next_reminder.strftime("%H:%M"),
        "package": "Starter",
        "last_reset": data.get("last_reset", "N/A"),
    }

def display_status():
    """Display status in compact format"""
    status = get_status()
    
    # Compact single-line format
    bar = format_progress_bar(status["remaining_pct"])
    
    output = (
        f"📊 MiniMax Usage: {bar} {status['remaining_pct']:.0f}% "
        f"RST:{status['reset_time']} "
        f"TTL:{status['time_left']} "
        f"PKG:{status['package']} "
        f"USE:{status['used']}/{status['max']} "
        f"REM:{status['remaining']} "
        f"NXT:{status['next_reminder']}"
    )
    
    print(output)
    return output

def display_detailed():
    """Display detailed status"""
    status = get_status()
    
    print("=" * 60)
    print("📊 MiniMax Usage Status")
    print("=" * 60)
    print(f"Package: {status['package']} ({status['max']} prompts/month)")
    print(f"Used: {status['used']} prompts")
    print(f"Remaining: {status['remaining']} prompts")
    print(f"Progress: {format_progress_bar(status['remaining_pct'])} {status['remaining_pct']:.1f}%")
    print(f"Reset Time: {status['reset_time']} (UTC+8)")
    print(f"Time Until Reset: {status['time_left']}")
    print(f"Next Reminder: {status['next_reminder']}")
    print("=" * 60)
    
    return status

# Command line interface
if __name__ == "__main__":
    import sys
    
    if len(sys.argv) > 1:
        if sys.argv[1] == "add":
            # Add usage
            prompts = int(sys.argv[2]) if len(sys.argv) > 2 else 1
            used = add_usage(prompts)
            print(f"Added {prompts} prompts. Total used: {used}")
            display_status()
        elif sys.argv[1] == "status":
            display_detailed()
        elif sys.argv[1] == "compact":
            display_status()
        else:
            print("Usage: minimax_tracker.py [add|status|compact]")
    else:
        display_status()


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)