Skip to content
SlashClone

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.

SkillDatav1.0.0 (latest)Tested
Activity
New: be the first to try it
  1. 1{
  2. 2 "name": "agent-cost-dashboard",
  3. 3 "owner": "agentcosts",
  4. 4 "version": "1.0.0",
  5. 5 "type": "skill",
  6. 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. 7 "category": "data",
  8. 8 "license": "MIT",
  9. 9 "compat": ["claude-code"],
  10. 10 "permissions": {
  11. 11 "shell": ["node scripts/cost-dashboard.mjs"],
  12. 12 "files": { "read": ["./data/**"], "write": ["./out/agent-costs*"] }
  13. 13 },
  14. 14 "tests": {
  15. 15 "cases": [
  16. 16 {
  17. 17 "name": "builds the dashboard with margins from the example usage",
  18. 18 "inputs": {},
  19. 19 "checks": [
  20. 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. 21 { "type": "file_contains", "path": "out/agent-costs.html", "text": "Cost per successful outcome" },
  22. 22 { "type": "file_not_contains", "path": "out/agent-costs.html", "text": "<script" },
  23. 23 {
  24. 24 "type": "output_matches_schema",
  25. 25 "path": "out/agent-costs.json",
  26. 26 "schema": {
  27. 27 "type": "object",
  28. 28 "required": ["total_cost", "cost_per_success", "cache_hit_rate", "customers", "tasks", "models"],
  29. 29 "properties": {
  30. 30 "runs": { "const": 573 },
  31. 31 "total_cost": { "const": 147.08 },
  32. 32 "cost_per_success": { "const": 0.2989 },
  33. 33 "cache_hit_rate": { "const": 0.7724 },
  34. 34 "gross_margin_after_llm": { "const": 0.8028 },
  35. 35 "unpriced_rows": { "const": 0 },
  36. 36 "customers": {
  37. 37 "type": "array",
  38. 38 "minItems": 6,
  39. 39 "maxItems": 6,
  40. 40 "items": { "type": "object", "required": ["customer", "cost", "gross_margin"] }
  41. 41 },
  42. 42 "models": { "type": "array", "minItems": 4, "maxItems": 4 }
  43. 43 }
  44. 44 }
  45. 45 }
  46. 46 ]
  47. 47 },
  48. 48 {
  49. 49 "name": "uses cost_usd when present and prices the rest",
  50. 50 "inputs": {
  51. 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. 52 },
  53. 53 "checks": [
  54. 54 { "type": "command_exits_zero", "command": "node scripts/cost-dashboard.mjs data/usage.csv --prices examples/prices.csv --out out/agent-costs.html" },
  55. 55 {
  56. 56 "type": "output_matches_schema",
  57. 57 "path": "out/agent-costs.json",
  58. 58 "schema": {
  59. 59 "type": "object",
  60. 60 "properties": {
  61. 61 "total_cost": { "const": 3.5 },
  62. 62 "runs": { "const": 2 },
  63. 63 "success_rate": { "const": 0.5 },
  64. 64 "cost_per_success": { "const": 3.5 },
  65. 65 "unpriced_rows": { "const": 1 },
  66. 66 "unpriced_models": { "const": ["mystery-model"] }
  67. 67 }
  68. 68 }
  69. 69 }
  70. 70 ]
  71. 71 }
  72. 72 ]
  73. 73 }