← 返回
未分类 中文

Clawhub Skill Llm Cost Guard

Monitors and enforces daily/monthly LLM API budgets per user/model, tracks token usage, and sends alerts to prevent overspending.
监控并执行每日/每月 LLM API 预算,按用户/模型追踪 token 使用,超支时发送警报。
mariusfit mariusfit 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 165
下载
💾 0
安装
1
版本
#latest

概述

LLM Cost Guard — Token Budget & Spend Monitor

Track, budget, and alert on LLM API spending in real-time. Prevents runaway costs for AI agents, multi-user apps, and homelab automation.

What It Does

  • Real-time cost tracking — records every LLM call (tokens in/out, model, cost)
  • Budget enforcement — blocks requests when daily/monthly budgets are exceeded
  • Per-user quotas — free tier vs pro tier controls
  • Daily spend reports — delivered via WhatsApp/Telegram/Discord
  • Alerts — warns at 80% budget usage, blocks at 100%
  • Multi-model pricing — OpenAI, Anthropic, Groq, Ollama (Feb 2026 rates)

Quick Start

After install, configure your daily budget:

set budget daily 5.00

Then register API calls via the tracker:

# Log an LLM call
llm-cost-guard log --model gpt-4o --input-tokens 1500 --output-tokens 800 --user alice

# Check current spend
llm-cost-guard status

# View full report
llm-cost-guard report

Commands

CommandDescription
----------------------
llm-cost-guard statusCurrent spend vs budget
llm-cost-guard reportFull breakdown by user/model/day
llm-cost-guard set-limit daily Set daily spend limit
llm-cost-guard set-limit user Set per-user limit
llm-cost-guard resetReset counters (e.g., start of new period)
llm-cost-guard watchLive tail of all LLM calls
llm-cost-guard logRecord a manual LLM usage entry

Configuration

{
  "dailyCostLimit": 5.00,
  "monthlyCostLimit": 50.00,
  "perUserDailyCostLimit": 1.00,
  "defaultModel": "gpt-4o-mini",
  "alertAt": 0.8,
  "alertChannel": "whatsapp",
  "dataPath": "~/.openclaw/workspace/llm-cost-guard-data.json"
}

Supported Models (Built-in Pricing)

ProviderModels
------------------
OpenAIgpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, o1, o1-mini, o3-mini
Anthropicclaude-3-5-sonnet, claude-3-5-haiku, claude-3-opus, claude-sonnet-4, claude-haiku-4
Groqllama-3.3-70b, llama-3.1-8b, mixtral-8x7b, gemma2-9b
OllamaLocal models (free, $0 tracked)

OpenClaw Cron Integration

The skill auto-installs a daily cron job to:

  1. Send a morning spend summary
  2. Alert if yesterday's spend exceeded budget
  3. Reset daily counters at midnight UTC
# Manually add cron
openclaw cron add "0 8 * * *" "llm-cost-guard report --send-to whatsapp"

Use Cases

Homelab AI Automation

You run multiple OpenClaw agents with different API budgets. This skill tracks each agent's spend independently and warns you before the bill arrives.

Multi-User Chatbot

Users get a free daily quota (e.g., $0.50/day). This skill enforces it, returning a friendly 429 when exceeded.

Cost Audit

Run llm-cost-guard report --period month to see your full monthly AI spend breakdown by model and user.

Data Storage

All data stored locally at ~/.openclaw/workspace/llm-cost-guard-data.json. No external services. No telemetry.

Why Zero Dependencies?

Every dependency is a potential VirusTotal flag, a supply chain risk, and a maintenance burden. This skill uses only Node.js stdlib and OpenClaw's built-in tools.

Source & Issues

  • Source: https://github.com/mariusfit/llm-token-budget
  • Issues: https://github.com/mariusfit/llm-token-budget/issues
  • Author: @mariusfit

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-12 06:21 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

Security Hardener

mariusfit
审计并加固 OpenClaw 配置的安全性。扫描 openclaw.json 以查找漏洞、暴露的凭据、不安全的网关设置以及过度权限...
★ 1 📥 2,570
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 216 📥 71,428
data-analysis

Tavily 搜索

jacky1n7
通过 Tavily API 进行网页搜索(Brave 替代方案)。当用户要求搜索网页、查找来源或链接,且 Brave 网页搜索不可用时使用。
★ 278 📥 101,492