cost-export

Exports cost-tracking telemetry to Prometheus textfile or webhook JSON formats.

70.1k|8.4k|Updated Jun 2, 2025
One-click install
npx skills add https://github.com/ruvnet/claude-flow --skill cost-export
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cost-export
Source: https://github.com/ruvnet/claude-flow/tree/main/plugins/ruflo-cost-tracker/skills/cost-export
Command: npx skills add https://github.com/ruvnet/claude-flow --skill cost-export

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cost data recorded by the cost-track skill stays locked inside the AgentDB namespace, making it invisible to external observability stacks. This Skill pulls every session and budget record and emits them in formats that Grafana, Datadog, Prometheus, or any webhook consumer can ingest.

Core Features & Use Cases

  • Prometheus textfile export: Writes a .prom file with gauges for total spend, per-tier spend, per-session totals, and budget utilization, ready for the node_exporter textfile collector.
  • Webhook JSON delivery: POSTs the full cost payload (sessions, budget, totals, per-tier breakdown) to any HTTP endpoint, with custom auth headers via environment variables.
  • Use Case: After running cost tracking across agent sessions, schedule a recurring export every 5 minutes so a Grafana dashboard always shows near-real-time LLM spend and budget utilization.

Quick Start

Ask the AI to export the current cost-tracking data to a Prometheus textfile at your node_exporter collector path, or to POST it as JSON to your webhook URL.

Frequently Asked Questions about cost-export

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I export cost tracking data to Prometheus?

Run the export script with the --prometheus flag pointing at your node_exporter textfile collector directory. It writes a .prom file containing gauges like cost_tracker_total_usd and cost_tracker_budget_utilization, which Prometheus scrapes automatically.

How do I send cost metrics to a webhook or Slack endpoint?

Use the --webhook flag with your endpoint URL to POST the full JSON payload containing sessions, budget, totalUsd, and byTier. Add authentication by setting EXPORT_WEBHOOK_HEADER with comma-separated header pairs such as an Authorization bearer token.

What metrics does the Prometheus export include?

The export includes cost_tracker_total_usd, per-tier gauges labeled by opus/sonnet/haiku, per-session totals and message counters, plus budget and budget utilization gauges when a budget is configured. All are standard gauges or counters.

Can I keep Grafana dashboards updated automatically?

Yes, the export is cron-friendly and can run on a recurring schedule such as every 5 minutes via the /loop command. Each run refreshes the .prom file or re-POSTs the webhook payload so dashboards stay near-real-time.

Why is my webhook export missing authentication headers?

Headers are only sent when EXPORT_WEBHOOK_HEADER is set with comma-separated 'Key: Value' pairs. If unset, the POST goes out with no custom headers, which causes authenticated endpoints to reject the request.