← 返回
开发者工具

Lemnos Cost Guard

Real-time API cost tracking, context bloat detection, and budget enforcement for OpenClaw agents. Use when setting up cost guardrails, checking daily spend,...
实时 API 费用追踪、上下文膨胀检测与预算强制执行,用于 OpenClaw代理。适用于设置费用护栏、检查每日支出等。
getlemnos32
开发者工具 clawhub v1.2.2 3 版本 100000 Key: 无需
★ 0
Stars
📥 843
下载
💾 4
安装
3
版本
#ai-agent#api-cost-monitor#budget#budget-management#business-automation#cost-control#cost-guard#latest#lobster-tool#open-source-ai#openclaw#solo-operator

概述

Lemnos Cost Guard

Track token usage, enforce budgets, detect context bloat, and route to cheaper models.

Quick Reference

ScriptPurpose
-----------------
scripts/track_cost.pyLog a cost entry after a task
scripts/cost_report.pyGenerate cost summary
scripts/context_analyzer.pyScan workspace for bloat

Pricing and model routing rules: references/model_pricing.md

Workflow

After Every Significant Task

Log cost immediately using session delta (session_status before vs after):

python3 skills/lemnos-cost-guard/scripts/track_cost.py \
  --task "email batch" \
  --input 45000 \
  --output 1200 \
  --model claude-sonnet-4-6

Logs to: logs/cost-YYYY-MM-DD.jsonl

Daily Briefing — Cost Summary Block

Run before sending the morning briefing:

python3 skills/lemnos-cost-guard/scripts/cost_report.py --days 1 --budget 5.00 --format brief

Include output verbatim in briefing. Flag anything over 80% of budget.

Budget Alerts

  • ≥80% of $5/day → warn user, pause non-revenue tasks
  • ≥100% of $5/day → hard stop, notify user immediately
  • Single call >500K input tokens → immediate alert
  • I/O ratio >50:1 → context bloat warning, recommend compaction

Context Bloat Check (run weekly or when costs spike)

python3 skills/lemnos-cost-guard/scripts/context_analyzer.py \
  --workspace /root/.openclaw/workspace

Context Loading Rules (enforce on every session)

Load ONLY what the current task requires:

TaskLoad
------------
Morning briefingSOUL.md, USER.md, MEMORY.md, HEARTBEAT.md, today's memory
Email outreachMEMORY.md (Lemnos rules only), sent-log.md
LinkedIn researchsent-log.md only
Crypto/marketMEMORY.md (crypto section only)
Heartbeat (nothing to do)HEARTBEAT.md only

Do NOT load full MEMORY.md + all skills + all reference files unless the task requires it.

Model Routing

See references/model_pricing.md for full table. Quick rules:

  • Simple tasks (format, classify, status check) → Haiku ($0.80/M input)
  • Default → Sonnet ($3/M input)
  • Opus → never, unless explicitly requested

Cost Log Format

Each entry in logs/cost-YYYY-MM-DD.jsonl:

{
  "ts": "2026-02-24T18:00:00Z",
  "task": "email batch send",
  "model": "claude-sonnet-4-6",
  "input_tokens": 45000,
  "output_tokens": 1200,
  "ratio": 37.5,
  "cost_usd": 0.153,
  "notes": "batch 1 + batch 2"
}

⭐ If This Saves You Money

Star it on ClawHub — it helps others find it: https://clawhub.ai/skills/lemnos-cost-guard

Source Code

GitHub: https://github.com/getlemnos32/cost-guard

ClawHub Distribution

Free tier: daily cost tracking + budget alerts

Premium ($40-60/mo): full dashboards, model routing automation, context optimization reports, weekly/monthly rollups

Skill file: lemnos-cost-guard.skill

版本历史

共 3 个版本

  • v1.2.2 当前
    2026-05-03 03:35 安全 安全
  • v1.0.2
    2026-03-29 10:13 安全 安全
  • v1.0.1
    2026-03-26 21:38

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,927
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,534

B2B Outbound Sniper

getlemnos32
自主 B2B 外呼引擎,将招聘平台招聘信息转化为合格渠道。6 个 LLM。使用您自己的邮箱。送达率 10/10。已在 30...
★ 0 📥 501