profiling-llm-cost

Profile LLM application spend from trace logs with token counts and model pricing.

2|Updated May 23, 2026
One-click install
npx skills add https://github.com/rocklambros/rcs --skill profiling-llm-cost
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: profiling-llm-cost
Source: https://github.com/rocklambros/rcs/tree/main/skills/ml-datasci/profiling-llm-cost
Command: npx skills add https://github.com/rocklambros/rcs --skill profiling-llm-cost

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill finds where LLM application spend is coming from when bills spike, cache hit rates drop, or per-task economics are unknown. It replaces guesswork with a measured cost baseline so you can identify the real driver before changing prompts, models, or architecture.

Core Features & Use Cases

  • Builds per-call cost from logged token counts and model pricing, including cached versus uncached input tokens and output tokens.
  • Rolls costs up per task so agentic workflows can be evaluated by the economics a user actually experiences, not just by individual calls.
  • Measures cache-hit trends, slices spend by model, step, route, or cohort, and compares the current window against a prior baseline to localize cost spikes.
  • Produces ranked savings opportunities with the highest-leverage fix first, while refusing to recommend cost cuts without a measured baseline.
  • Use it when a production chatbot, RAG pipeline, or multi-step agent suddenly costs more, when prompt caching appears to be failing, or when a team needs a budget gate before scaling.

Quick Start

Ask Claude to profile your LLM trace log, compute per-call and per-task cost, measure cache-hit rate, and identify the highest-leverage savings opportunities.

Frequently Asked Questions about profiling-llm-cost

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

FAQPage Schema
How do I profile LLM application spend from trace logs?

To profile LLM spend, the Skill builds per-call costs from logged token counts and model pricing, distinguishing between cached and uncached input tokens. It rolls these costs up per task to evaluate agentic workflows by actual user economics.

Why does my RAG pipeline cost spike when prompt cache hit rates drop?

Cost spikes occur when prompt caching fails because systems process more uncached input tokens billed at higher rates. Measuring cache-hit trends and slicing spend by route isolates the failing component driving the increased LLM spend.

Can I measure per-task economics for multi-step agents?

Yes, you can measure per-task economics by rolling up individual LLM call costs into task groupings. This evaluates multi-step agents by the complete economics a user experiences, rather than isolated individual API calls.

What is the best way to identify high-leverage LLM cost savings opportunities?

The best way to identify savings is by establishing a measured cost baseline first, then slicing spend attribution by model, step, route, or cohort. This produces ranked savings opportunities, refusing cost cuts without a baseline.

Do I need token counts and model pricing to analyze LLM trace logs?

Yes, token counts and model pricing are required inputs to compute per-call costs. You also need task grouping, cache-hit analysis, and baseline comparison to accurately quantify savings opportunities within production chatbots or batch workflows.

When should I not use cost profiling to reduce LLM spend?

You should not use cost profiling to reduce LLM spend when you lack a measured baseline, as the Skill refuses to recommend cuts without one. It is also not suited for scenarios lacking trace logs with token counts and model pricing.