Token导航 LogoToken导航

Agent Skill · 研究检索

llm-cost-watchdog(LLM cost watchdog 搜索)

llm-cost-watchdog 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

llm-cost-watchdog 是研究检索类 Agent Skill,可用宿主为 OpenClaw,通过ClawHub获取,权限为调用外部服务;许可证为 MIT-0,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 30,414。

总安装 2,888周安装 132GitHub Stars 公开资料未说明下载 1,045核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT-0
版本
1.0.0

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:llm-cost-watchdog(LLM cost watchdog 搜索)
来源仓库:https://github.com/nimaansari/llm-cost-watchdog
安装命令:
openclaw skills install llm-cost-watchdog
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install llm-cost-watchdog

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

监控实时 LLM API 成本、检测失控循环、执行预算、审核代码风险并报告多个提供商和模型的使用情况。

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 OpenClaw;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 openclaw skills install llm-cost-watchdog;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

llm-cost-watchdog 怎么安装?

在终端执行 openclaw skills install llm-cost-watchdog。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

llm-cost-watchdog 支持哪些 AI 工具?

公开资料标注支持 OpenClaw。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

llm-cost-watchdog 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

llm-cost-watchdog 是免费的吗?

来源标注的许可证是 MIT-0。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

llm-cost-watchdog 用的人多吗?

公开数据是累计安装 2,888 次,近一周安装 132 次,下载 1,045 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

llm-cost-watchdog 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 专注 OpenClaw 一种宿主,触发方式和使用习惯不用来回切换。
  • 许可证明确为 MIT-0,商用和分发边界好判断。

先想清楚的地方

  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 OpenClaw,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
llm-cost-watchdog

LLM cost watchdog 搜索 · 本页

2,888—调用外部服务MIT-0有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

name
cost-watchdog
description
Tracks LLM spend across providers live, detects runaway loops, enforces budgets. Triggers on: cost/budget/token mentions, LLM API calls, agent workflows, batch processing.
when_to_use
TRIGGER when: cost/budget/token mentions, LLM API calls in code, agent loops, batch processing, or /cost-watchdog commands.
argument-hint
[command] — session, tail, detect, audit, price, estimate, alternatives, report, errors, validate-tokens, reset
metadata
{"openclaw": {"emoji": "💰"}}

Cost Watchdog 💰

Real-time cost tracking layer for LLM-based agents. Prices every call live, detects runaway loops in code, enforces budget ceilings mid-execution.

1. Identity

Observes LLM spend without disturbing the agent. Prevents $2,400-overnight-loop disasters by making cost a first-class concern: priced at write time, budgeted at check time, surfaced in reports.

2. Triggers

Activate when:

  • User mentions cost, budget, tokens, billing.
  • Code contains LLM API calls (Anthropic, OpenAI, OpenRouter, Google, Groq, ...).
  • Agent loops or recursive workflows.
  • Batch / streaming processing with unclear bounds.
  • /cost-watchdog [command] is invoked.

3. Commands

Run via python3 scripts/cost_watchdog.py <cmd> (or hook into your own CLI).

CommandWhat it does
sessionSpend totals from usage.jsonl — calls, tokens, cost, top models.
report24h / 7d / 30d windows with top model per window.
tail [--once]Watch OpenClaw session JSONL and log every assistant turn.
detect [--json]Identify which model the agent is currently using (5 probes).
audit <file.py>AST-based code risk scan: unbounded loops, recursion, missing max_tokens.
price <model>Live pricing for one model, with source + cache age.
estimate <model>Project cost for n iterations of a given call.
alternatives <model>Cheaper same-unit models.
errors [--limit N]Recent swallowed exceptions (silent failures made visible).
validate-tokens <model>Compare our heuristic against provider's authoritative count.
reset [--all]Clear current-day log (--all also clears rolled files).

4. Pricing layer

Source chain

openrouter/*            → OpenRouter API (live)           → static fallback
anything else           → LiteLLM JSON (live, cached 24h) → OpenRouter (permissive) → static fallback
  • 2600+ models indexed across chat, completion, embedding, image, audio,

video, rerank, OCR, search modes.

  • 30+ providers in the static fallback: Anthropic, OpenAI, Google,

Groq, Mistral, Cohere, DeepSeek, Perplexity, xAI, Bedrock, Azure, and more.

  • Unit-aware: token, image, second, query, page, character,

pixel. Alternatives never compare across units.

  • Circuit breaker opens after 3 consecutive network failures for a host;

falls through to cache/static until the cool-down ends (60s).

Tuning

Env varDefaultEffect
CW_PRICE_TTL_SECONDS86400 (24h)Cache lifetime. 0 = hit network every call.
CW_OFFLINEunsetIf 1, never touch the network.
CW_STATIC_ONLYunsetIf 1, skip live sources entirely. Used by tests.
CW_LOG_DIR~/.cost-watchdogWhere usage/errors/cache files live.
CW_BUDGET_USDunsetCeiling; wrappers raise BudgetExceeded when crossed.

Refresh static pricing

python3 scripts/refresh_pricing.py

Regenerates references/pricing.md from the live sources so the offline fallback is fresh. Aborts if fewer than 100 rows came back (protects against clobbering on a network outage).

5. Tracking layer — how we know what was spent

Four independent paths, all write to ~/.cost-watchdog/usage.jsonl:

PathWhen to useCovers streams?
openclaw_tailer.py --watchRunning OpenClaw. Zero code changes.yes (reads completed turns)
track_openai(client)You call OpenAI-compatible SDK (covers OpenRouter, Groq, DeepSeek, Mistral, Together, Fireworks, Cerebras, Anyscale, ...).yes (tee'd iterator, auto-injects stream_options={"include_usage": True})
track_anthropic(client)Direct Anthropic SDK.yes (wraps messages.stream())
track_gemini(model) / track_cohere(client) / track_bedrock(client)Direct provider SDKs.no (add wrappers if you need streams)
install_global_capture() (httpx)Any modern Python SDK using httpx.no — streams are flagged into errors.jsonl so the gap is visible. Use the SDK wrappers for stream coverage.

Usage log rotates daily: usage.YYYY-MM-DD.jsonl. session_total(since=...) skips files outside the window before scanning.

Aggregation uses canonical_family() so claude-haiku-4-5-20251001, claude-haiku-4-5, and claude-haiku-4.5 are one row in reports.

6. Budget enforcement

Two mechanisms:

  1. Write-time check (race-safe): append_usage(entry, budget_ceiling=X)

takes an fcntl.flock on a sidecar, sums the current session, and refuses the write (raises BudgetExceeded) if the call would cross X.

  1. Post-write check: wrappers compare cumulative spend to CW_BUDGET_USD

after logging and raise if over. Used when the wrapper doesn't know the ceiling at call time.

Either path stops the agent mid-loop; the LLM call still returns to the caller, but the next one blocks.

7. Code audit (AST)

python3 scripts/cost_watchdog.py audit path/to/agent.py

Walks the AST and reports:

  • CRITICAL — while True with an LLM call and no max_iterations-style bound.
  • CRITICAL — function that recurses and calls an LLM API with no depth argument.
  • HIGH — plain while that calls an API with no retry/iteration counter.
  • MEDIUM — LLM call missing max_tokens / max_completion_tokens.
  • MEDIUM — function with ≥5 sequential LLM calls (batching candidate).

Every finding has a file line number. No more count('def ') > 3 and count('self.') > 5 → "recursion detected" false positives.

8. Detection — "what model is the agent using?"

python3 scripts/cost_watchdog.py detect

Five probe layers, ranked by confidence:

ProbeConfidence
OpenClaw session JSONLhigh
Claude Code session JSONLhigh
Most recent usage-log entryhigh
Claude Code settings.jsonmedium
Env vars (ANTHROPIC_MODEL, OPENAI_MODEL, ...)medium

Emits a table or --json.

9. Files

PathPurpose
scripts/_pricing.pyRouter: picks LiteLLM / OpenRouter / static per query.
scripts/_sources.pyThree PricingSource classes + disk cache + circuit breaker.
scripts/tokenizer.pyProvider-aware token counting (tiktoken for OpenAI; calibrated heuristics for others).
scripts/model_canon.pycanonical_family() — collapses model variants.
scripts/code_audit.pyAST cost-risk walker.
scripts/usage_log.pyJSONL writer + rotation + aggregation.
scripts/tracker.pySDK wrappers + streaming + budget enforcement.
scripts/http_capture.pyinstall_global_capture() — httpx transport hook.
scripts/openclaw_tailer.pyWatches OpenClaw sessions.
scripts/detect_model.pyMulti-layer detector.
scripts/errors.pyerrors.jsonl writer + reader.
scripts/io_utils.pywrite_json_atomic / read_json.
scripts/refresh_pricing.pyRegenerates static pricing.md from live sources.
scripts/cost_watchdog.pyUnified CLI dispatcher.
references/pricing.mdStatic fallback (regenerated; ~2600 models).
tests/test_cost_watchdog.py73 tests: router, cache, AST, tokenizer, rotation, cassettes, circuit breaker, canonicalization.

10. Quality checklist

  • [x] Live pricing from LiteLLM + OpenRouter, 24h-cached, with static fallback.
  • [x] Exact-match model lookup (no substring conflation).
  • [x] Multi-modal (token / image / second / query / page / character).
  • [x] Unit-aware alternatives (never compares tokens to images).
  • [x] AST-based code audit with line numbers.
  • [x] Provider-aware tokenization (no more tiktoken-for-Claude).
  • [x] Variance-based confidence (no += 0.05 theater).
  • [x] Atomic writes to all shared state files.
  • [x] fcntl.flock-guarded budget check-and-log (no race).
  • [x] Circuit breaker on flaky networks (no 5s hang per call).
  • [x] Streaming capture via SDK wrappers; streams flagged in errors.jsonl via HTTP capture.
  • [x] Daily log rotation + date-scoped aggregation.
  • [x] Canonical model families (variants collapse in reports).
  • [x] errors.jsonl surfaces silent failures; cost_watchdog errors shows them.
  • [x] Cassette tests for LiteLLM + OpenRouter parse paths (schema-drift safety net).
  • [x] 73 logic tests passing.

11. Known limits (be honest)

  • Tokenizer heuristics for Claude/Gemini/etc. are calibrated from docs,

not measured. Run cost_watchdog validate-tokens <model> to check drift against the provider's authoritative count when you have an API key.

  • install_global_capture() can't see streaming responses — httpx exposes

an empty body until the user reads the stream. Use track_openai / track_anthropic for stream coverage; http_capture logs skipped streams to errors.jsonl so the gap is visible.

  • Non-httpx SDKs (older Cohere, boto3 with custom transport) need the

per-SDK wrappers — HTTP capture won't see them.

  • LiteLLM community data can lag 24-48h on brand-new models. OpenRouter's

API is truly live for anything it routes.

12. Testing

python3 -m unittest tests.test_cost_watchdog     # 73 tests
python3 scripts/code_audit.py test_risky_code.py # sample risks
python3 scripts/cost_watchdog.py report          # current spend summary

适合场景

01

调用多模型

02

代码和文本生成

03

Agent 推理流程

04

OpenRouter 模型接入

能力概览

能力 1

统一调用多种 LLM

能力 2

支持 Claude、Gemini、Kimi 等模型

能力 3

适合聊天、代码和推理任务

能力 4

可作为 Agent 模型调用入口

平台分布

OpenClaw

98.04%
按下载量换算1,025

安全审计

VirusTotal

可疑

ClawScan

可疑

Static analysis

通过

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills