LLM Cost Guard — LLM Cost 防护
v1.0.0监控s and enforces real-time LLM API spending with per-user quotas, alerts, dAIly 报告s, and bud获取 limits to 预防 cost over运行s.
运行时依赖
安装命令
点击复制技能文档
LLM Cost 防护 — 令牌 Bud获取 & Spend 监控
追踪, bud获取, and alert on LLM API spending in real-time. 预防s 运行away costs for AI 代理s, multi-user 应用s, and homelab 自动化.
What It Does Real-time cost 追踪ing — records every LLM call (令牌s in/out, 模型, cost) Bud获取 enforcement — blocks 请求s when dAIly/monthly bud获取s are exceeded Per-user quotas — free tier vs pro tier controls DAIly spend 报告s — delivered via Whats应用/Telegram/Discord Alerts — warns at 80% bud获取 usage, blocks at 100% Multi-模型 pricing — OpenAI, Anthropic, Groq, Ollama (Feb 2026 rates) Quick 启动
After 安装, 配置 your dAIly bud获取:
设置 bud获取 dAIly 5.00
Then register API calls via the 追踪er:
# 记录 an LLM call llm-cost-防护 记录 --模型 gpt-4o --输入-令牌s 1500 --输出-令牌s 800 --user alice
# 检查 current spend llm-cost-防护 状态
# View full 报告 llm-cost-防护 报告
Commands Command Description llm-cost-防护 状态 Current spend vs bud获取 llm-cost-防护 报告 Full breakdown by user/模型/day llm-cost-防护 设置-limit dAIly 设置 dAIly spend limit llm-cost-防护 设置-limit user 设置 per-user limit llm-cost-防护 re设置 Re设置 counters (e.g., 启动 of new period) llm-cost-防护 watch Live tAIl of all LLM calls llm-cost-防护 记录 Record a manual LLM usage entry Configuration { "dAIlyCostLimit": 5.00, "monthlyCostLimit": 50.00, "perUserDAIlyCostLimit": 1.00, "default模型": "gpt-4o-mini", "alertAt": 0.8, "alertChannel": "whats应用", "dataPath": "~/.OpenClaw/workspace/llm-cost-防护-data.json" }
Supported 模型s (Built-in Pricing) 提供者 模型s OpenAI gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, o1, o1-mini, o3-mini Anthropic claude-3-5-sonnet, claude-3-5-hAIku, claude-3-opus, claude-sonnet-4, claude-hAIku-4 Groq llama-3.3-70b, llama-3.1-8b, mixtral-8x7b, gemma2-9b Ollama Local 模型s (free, $0 追踪ed) OpenClaw Cron Integration
The 技能 auto-安装s a dAIly cron job to:
发送 a morning spend summary Alert if yesterday's spend exceeded bud获取 Re设置 dAIly counters at midnight UTC # Manually 添加 cron OpenClaw cron 添加 "0 8 *" "llm-cost-防护 报告 --发送-to whats应用"
Use Cases Homelab AI 自动化
You 运行 multiple OpenClaw 代理s with different API bud获取s. This 技能 追踪s each 代理's spend independently and warns you before the bill arrives.
Multi-User Chat机器人
Users 获取 a free dAIly quota (e.g., $0.50/day). This 技能 enforces it, returning a friendly 429 when exceeded.
Cost 审计
运行 llm-cost-防护 报告 --period month to see your full monthly AI spend breakdown by 模型 and user.
Data Storage
All data stored locally at ~/.OpenClaw/workspace/llm-cost-防护-data.json. No external 服务s. No telemetry.
Why Zero Dependencies?
Every dependency is a potential VirusTotal flag, a supply chAIn risk, and a mAIntenance burden. This 技能 uses only Node.js stdlib and OpenClaw's built-in 工具s.
Source & Issues Source: https://github.com/mariusfit/llm-令牌-bud获取 Issues: https://github.com/mariusfit/llm-令牌-bud获取/issues Author: @mariusfit