cache-cost-tracking
LLM cost tracking with Langfuse for cached responses. Use when monitoring cache effectiveness, tracking cost savings, or attributing costs to agents in multi-agent systems.
npx skills add majiayu000/claude-skill-registry --skill cache-cost-tracking --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Cache Cost Tracking Monitor LLM costs and cache effectiveness. ## When to Use - Cost attribution by agent - Cache hit rate monitoring - ROI analysis for caching - Multi-agent cost rollup ## Langfuse Automatic Tracking ```python from langfuse.decorators import observe, langfuse_context @observe(as_type="generation") async def call_llm_with_cache( prompt: str, agent_type: str, analysis_id: UUID ) -> str: """LLM call with automatic cost tracking.""" # Link to parent trace langfuse_context.update_current_trace( name=f"{agent_type}_generation", session_id=str(analysis_id) ) # Check caches if cache_key in lru_cache: langfuse_context.update_current_observation( metadata={"cache_layer": "L1", "cache_hit": True} ) return lru_cache[cache_key] similar = await semantic_cache.get(prompt, agent_type) if similar: langfuse_context.update_current_observation( metadata={"cache_layer": "L2", "cache_hit": True} ) return similar # LLM call - Langfuse tracks tokens/cost automatically response = await llm.generate(prompt) langfuse_context.update_current_observation( metadata={ "cache_layer": "L4", "cache_hit": False, "prompt_cache_hit": response.usage.cache_read_input_tokens > 0 } ) return response.con
- When to Use
- Langfuse Automatic Tracking
- Hierarchical Cost Rollup
- Cost Queries
- Cache Effectiveness
- Key Decisions
- Common Mistakes
- Related Skills
- Capability Details
- prompt-caching
- response-caching
- cost-calculation
- usage-tracking
- cache-invalidation
What does the cache-cost-tracking skill do?
LLM cost tracking with Langfuse for cached responses. Use when monitoring cache effectiveness, tracking cost savings, or attributing costs to agents in multi-agent systems.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill cache-cost-tracking --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
