360 Secure SkillHub
360 安全技能中心

Cost Tracker

通过 OpenRouter 接口拉取用量数据并存入本地 SQLite,提供日/周/月花费报表、按模型费用明细、月度预算告警和省费建议,支持 JSON、CSV 导出。以命令行方式调用,需要 OpenRouter API key。

分类:数据
aiwithabidi
aiwithabidi
热度 23.55
最近更新 2026-05-10 17:38:28

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add aiwithabidi/cost-tracker
兼容性
通用兼容
联网要求
需要联网
数据出网
可选出网
Metadata
name
cost-tracker
description
AI spending monitor — track costs across OpenRouter models with daily, weekly, and monthly reports. Budget limits with alerts, per-model analysis, savings recommendations, and historical tracking via SQLite. Use for controlling AI costs and optimizing model selection.
homepage
https://www.agxntsix.ai
license
MIT
compatibility
Python 3.10+, OpenRouter API key
metadata
{"openclaw":{"emoji":"💰","requires":{"env":["OPENROUTER_API_KEY"]},"primaryEnv":"OPENROUTER_API_KEY","homepage":"https://www.agxntsix.ai"}}

💰 Cost Tracker

AI spending monitor for OpenRouter. Track per-model costs, get daily/weekly/monthly reports, set budget alerts, and get savings recommendations.

Usage

# Fetch and store current usage from OpenRouter
python3 {baseDir}/scripts/cost_tracker.py fetch

# Show spending reports
python3 {baseDir}/scripts/cost_tracker.py report --period daily
python3 {baseDir}/scripts/cost_tracker.py report --period weekly
python3 {baseDir}/scripts/cost_tracker.py report --period monthly

# Per-model breakdown
python3 {baseDir}/scripts/cost_tracker.py models

# Set monthly budget + check status
python3 {baseDir}/scripts/cost_tracker.py budget --set 25.00
python3 {baseDir}/scripts/cost_tracker.py budget --check

# Savings recommendations
python3 {baseDir}/scripts/cost_tracker.py savings

# Export data as JSON
python3 {baseDir}/scripts/cost_tracker.py export --format json
python3 {baseDir}/scripts/cost_tracker.py export --format csv

Features

  • Live Usage Fetch — Pulls real spending data from OpenRouter's /api/v1/auth/key endpoint
  • Per-Model Tracking — See which models cost you the most
  • Period Reports — Daily, weekly, monthly summaries with trends
  • Budget Alerts — Set limits and get warned at 80% threshold
  • Savings Tips — Identifies cheaper models that could handle the same workload
  • Historical Data — SQLite storage for long-term trend analysis
  • Export — JSON or CSV export for spreadsheets

Data Storage

All data stored in {baseDir}/data/cost_tracker.db (SQLite).

Credits

Built by M. Abidi | agxntsix.ai YouTube | GitHub Part of the AgxntSix Skill Suite for OpenClaw agents.

📅 Need help setting up OpenClaw for your business? Book a free consultation