cost-export
它能做什么
这项技能把你记录的 AI 成本数据保存为其他监控工具可以展示的形式。适合希望把 AI 支出显示在共享仪表盘上的人。
适用场景
- ✓当你希望 AI 支出显示在 Grafana 或类似的仪表盘上时。
- ✓当你想把成本快照发送到某个网址以便汇报时。
- ✓当你希望成本数据按计划定期刷新时。
技能链接
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-export/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请导出我的 AI 成本数据,让我能在仪表盘上查看。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能读取已保存的成本记录,并把它们写成供 Prometheus 使用的文本文件,或作为 JSON 消息发送到你指定的网址。不加任何参数时,它会在屏幕上显示 JSON。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Cost Export
Pulls every session-* and budget-config-* record from cost-tracking and emits in formats consumable by external observability systems. Without this, cost data lives only inside the AgentDB namespace; with it, the same data lights up dashboards.
When to use
- After any cost-track run, to refresh metrics for Grafana / Datadog / Prometheus.
- Cron-friendly via
/loop 5mto keep external dashboards near-real-time. - One-shot to a webhook for ad-hoc reporting (Slack, custom endpoint).
Steps
Pick a format — textfile collector for Prometheus / Grafana, or webhook POST for everything else:
# Prometheus node_exporter textfile collector node plugins/ruflo-cost-tracker/scripts/export.mjs --prometheus /var/lib/node_exporter/textfile_collector/cost_tracker.prom # Webhook (POSTs JSON; add auth via env) EXPORT_WEBHOOK_HEADER='Authorization: Bearer $TOKEN' \ node plugins/ruflo-cost-tracker/scripts/export.mjs --webhook https://hooks.example.com/cost-tracker # Stdout JSON (default if no flag) node plugins/ruflo-cost-tracker/scripts/export.mjsInspect what's emitted — Prometheus output includes:
cost_tracker_total_usd <gauge> cost_tracker_tier_total_usd{tier="opus|sonnet|haiku"} <gauge> cost_tracker_session_total_usd{session="<8-char>"} <gauge> cost_tracker_session_messages{session="<8-char>"} <counter> cost_tracker_budget_usd <gauge> (if budget configured) cost_tracker_budget_utilization <gauge> (spent / budget)Webhook payload shape — the JSON the webhook receives matches the stdout JSON:
{ exportedAt, sessions: [...], budget, totalUsd, byTier }. Headers may be added viaEXPORT_WEBHOOK_HEADER='K1: V1, K2: V2'(comma-separated).
Env overrides
| Env | Default | Purpose |
|---|---|---|
EXPORT_NAMESPACE |
cost-tracking |
Override target namespace |
EXPORT_WEBHOOK_HEADER |
unset | Comma-separated K: V pairs for webhook auth |
EXPORT_QUIET=1 |
unset | Suppress non-error confirmation output |
Cross-references
cost-track— produces the data this skill exportscost-budget-check— the samecost_tracker_budget_*metrics are alertable in Prometheus- node_exporter textfile collector docs (Prometheus convention) — drop the
.promfile in the collector directory and Prometheus picks it up
常见问题
什么是 Prometheus 文本文件?
这是一种普通文件,内含指标行,节点导出器的收集器可以读取并在仪表盘上显示。
我能给 webhook 加上登录验证吗?
可以。一个环境变量设置可以在请求中附带请求头,例如授权令牌。
默认会把数据发送到别处吗?
不会。除非你选择文件或 webhook 选项,否则它只会在屏幕上显示 JSON。
详情
作者的原始描述
Export cost-tracking telemetry in Prometheus textfile or webhook JSON formats — for external observability (Grafana, Datadog, custom dashboards)
repo: ruvnet/ruflo
热度
- GitHub 星标
- 81k
- 排名
- #1600
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-adaptive-coordinator
81k帮你的智能体在工作量变化时拆分和重新平衡一组 AI 智能体,并选择适合任务的分工方式。
agent-agent
81k教你的智能体把一个大目标拆成有顺序的行动计划,并在情况变化时重新规划。
agent-agentic-payments
81k帮你的智能体管理 AI 购物的消费授权,包括消费上限、时间窗口、商户规则和签名审批。
agent-analyze-code-quality
81k帮你的智能体检查代码质量,找出代码异味、技术债务和重构建议,且不改动文件。