Agent cost dashboard
@agentcosts/agent-cost-dashboard
Turn LLM usage logs into one self-contained HTML cost dashboard for an agentic product: cost per customer, per task, per successful outcome, model mix, cache hit rate, and gross margin when you add revenue by customer. Prices blank costs from an editable price table.
- Activity
- New: be the first to try it
- Installs
- 0 installs
- Likes
- 0 likes
- Clones
- 0 clones
- 1{
- 2 "name": "agent-cost-dashboard",
- 3 "owner": "agentcosts",
- 4 "version": "1.0.0",
- 5 "type": "skill",
- 6 "description": "Turn LLM usage logs into one self-contained HTML cost dashboard for an agentic product: cost per customer, per task, per successful outcome, model mix, cache hit rate, and gross margin when you add revenue by customer. Prices blank costs from an editable price table.",
- 7 "category": "data",
- 8 "license": "MIT",
- 9 "compat": ["claude-code"],
- 10 "permissions": {
- 11 "shell": ["node scripts/cost-dashboard.mjs"],
- 12 "files": { "read": ["./data/**"], "write": ["./out/agent-costs*"] }
- 13 },
- 14 "tests": {
- 15 "cases": [
- 16 {
- 17 "name": "builds the dashboard with margins from the example usage",
- 18 "inputs": {},
- 19 "checks": [
- 20 { "type": "command_exits_zero", "command": "node scripts/cost-dashboard.mjs examples/usage.csv --prices examples/prices.csv --revenue examples/revenue.csv --out out/agent-costs.html" },
- 21 { "type": "file_contains", "path": "out/agent-costs.html", "text": "Cost per successful outcome" },
- 22 { "type": "file_not_contains", "path": "out/agent-costs.html", "text": "<script" },
- 23 {
- 24 "type": "output_matches_schema",
- 25 "path": "out/agent-costs.json",
- 26 "schema": {
- 27 "type": "object",
- 28 "required": ["total_cost", "cost_per_success", "cache_hit_rate", "customers", "tasks", "models"],
- 29 "properties": {
- 30 "runs": { "const": 573 },
- 31 "total_cost": { "const": 147.08 },
- 32 "cost_per_success": { "const": 0.2989 },
- 33 "cache_hit_rate": { "const": 0.7724 },
- 34 "gross_margin_after_llm": { "const": 0.8028 },
- 35 "unpriced_rows": { "const": 0 },
- 36 "customers": {
- 37 "type": "array",
- 38 "minItems": 6,
- 39 "maxItems": 6,
- 40 "items": { "type": "object", "required": ["customer", "cost", "gross_margin"] }
- 41 },
- 42 "models": { "type": "array", "minItems": 4, "maxItems": 4 }
- 43 }
- 44 }
- 45 }
- 46 ]
- 47 },
- 48 {
- 49 "name": "uses cost_usd when present and prices the rest",
- 50 "inputs": {
- 51 "data/usage.csv": "timestamp,customer,task,run_id,model,input_tokens,output_tokens,cache_read_tokens,cache_write_tokens,cost_usd,outcome\n2026-10-01T10:00:00Z,a,t1,r1,claude-sonnet-5-5,1000000,0,0,0,,\n2026-10-01T10:01:00Z,a,t1,r1,claude-sonnet-5-5,0,0,0,0,1.50,success\n2026-10-02T10:00:00Z,b,t1,r2,mystery-model,1000,1000,0,0,,failure\n"
- 52 },
- 53 "checks": [
- 54 { "type": "command_exits_zero", "command": "node scripts/cost-dashboard.mjs data/usage.csv --prices examples/prices.csv --out out/agent-costs.html" },
- 55 {
- 56 "type": "output_matches_schema",
- 57 "path": "out/agent-costs.json",
- 58 "schema": {
- 59 "type": "object",
- 60 "properties": {
- 61 "total_cost": { "const": 3.5 },
- 62 "runs": { "const": 2 },
- 63 "success_rate": { "const": 0.5 },
- 64 "cost_per_success": { "const": 3.5 },
- 65 "unpriced_rows": { "const": 1 },
- 66 "unpriced_models": { "const": ["mystery-model"] }
- 67 }
- 68 }
- 69 }
- 70 ]
- 71 }
- 72 ]
- 73 }
- 74}
