Cc Cost Analysis logo

Cc Cost Analysis

Organization
intercom
cc-cost-analysis

Analyze Claude Code usage costs from OpenTelemetry data — per-user spend, expensive sessions, context bloat, and model/token cost breakdowns — with a structured framework, ready-to-use query shapes, and cost-model formulas. Triggers on "analyze Claude Code costs", "break down the Claude Code bill", "find expensive sessions", "identify context bloat".

Overview

Publisherintercom
Repository2x-skills
Skill namecc-cost-analysis
Stars
251
Forks
14
Bundled files
6
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 6 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by intercom on GitHub. Read the source before you install it.

Installation

Install the Cc Cost Analysis AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/intercom/2x-skills/tree/main/plugins/claude-code-tools/skills/cc-cost-analysis
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/intercom/2x-skills.git /tmp/2x-skills
mkdir -p .claude/skills
cp -r /tmp/2x-skills/plugins/claude-code-tools/skills/cc-cost-analysis .claude/skills/cc-cost-analysis
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Cc Cost Analysis in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Cc Cost Analysis on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Cc Cost Analysis is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Claude Code Cost Analysis

A framework and ready-to-use query shapes for analyzing Claude Code usage costs across a team or org.

Prerequisites: you need Claude Code telemetry

Claude Code can export usage as OpenTelemetry metrics and events (CLAUDE_CODE_ENABLE_TELEMETRY=1 plus an OTLP endpoint — see the Claude Code monitoring docs). Point that export at an observability backend (Honeycomb, Datadog, an OTLP collector into a warehouse, etc.). This skill analyzes that data.

The example queries in references/queries.md are written for Honeycomb (environment/dataset names are placeholders — substitute wherever you send telemetry). The analysis dimensions and cost formulas are backend-agnostic — the same shapes translate to any store that has per-api_request rows with token counts, cost_usd, model, and session.id.

A few attribute names in the examples (user.email, speed, skill.name, normalized_file_path) are enrichments that depend on your telemetry pipeline and Claude Code version — verify column names against your own data (get_dataset_columns or the equivalent) before relying on them. Numeric fields are sometimes stored as strings; cast with FLOAT(...) before aggregating (see the query examples).

Analysis Dimensions

Each dimension answers a different question. Run whichever are relevant — there is no required order, though broader dimensions provide context for narrower ones.

DimensionQuestion AnsweredQuery Section
Model mixWhich models account for what cost?references/queries.md Section 1
Session economicsWhere in sessions does cost accumulate?Section 2
Token typesCache writes vs reads vs output share?Section 3
Tool result sizesWhich tools bloat the context?Section 4
CompactionAre sessions hitting context limits?Section 5
Per-user profilesWho are the heaviest users and why?Section 6
Instructions & skillsHow much do CLAUDE.md/rules/skills cost?Section 7
Command-level wasteWhich specific commands are wasteful vs bundled with real work?references/command-attribution.md

Apply cost formulas from references/cost-model.md when computing dollar estimates from token counts.

Illustrative Findings

These are shape-of-the-problem findings from one large deployment — useful to calibrate expectations, not ground truth for your org. Always verify against fresh queries against your own data.

Cost distribution

DimensionTypical finding
Model dominanceThe most capable model tends to dominate cost far out of proportion to its share of calls
Session lengthA minority of long sessions (turns 100+) can account for the majority of that model's cost
Token type sharesCache write ~47%, cache read ~44%, output ~9% of weighted cost
Caching savingsPrompt caching typically cuts the bill ~80% vs fully uncached input
Instruction overheadCLAUDE.md, rules, and skills are collectively a small fraction (~1%) of total spend

Session turn phases

PhaseTurnsDriver
Cache creation0-3System prompt + instructions written to cache
Steady state4-50Caching working well — lowest per-call cost
Context growth50-99Cache reads climbing as context accumulates
Long-session tail100+Large accumulated context re-read every turn

Tool result sizes (typical ranges)

CategoryAvg/callExamples
Screenshots100-500 KBbrowser/screenshot tools
Search results10-30 KBsearch MCP tools
Database results5-10 KBSQL / log query tools
File reads3-7 KBRead tool (very high volume)

Context window behavior

  • A small fraction of sessions trigger auto compaction.
  • The most expensive sessions rarely compact — they grow to a large context and stay just below the window limit.
  • Sessions on smaller context windows compact more often and cost far less per call than sessions on the largest window with equivalent workloads.

Key Analysis Patterns

Matched session comparison

The most compelling way to demonstrate context-size impact on cost is finding two sessions with similar API-call counts but different context behaviors — one with high average cache_read (bloated, likely on the largest window) and one low (lean, compacting or on a smaller window). The per-session query (Section 6a adapted to break down by session.id) surfaces these pairs.

User segmentation by context usage

Classify users by what % of their calls exceed a large cache_read threshold (Section 6a, calls_over_200k field):

  • 0% over threshold — never needs the largest context, would work on a smaller window
  • 1-10% — rarely needs it, benefits most from proactive compaction
  • 60%+ — genuinely needs the largest context (investigate what tools drive it via Section 6b)

Important Caveats

Quality vs cost tradeoff: Cost optimizations (model downshift, aggressive compaction, smaller context windows) may degrade output quality. Measure quality objectively before changing configuration. Cost savings mean nothing if the tool becomes less useful.

Caching IS helping: Prompt caching reduces the bill substantially vs uncached input. The remaining cost is driven by the volume of cached tokens, not by caching being inefficient.

Instructions are a small share: CLAUDE.md files, rules, and skills are a small fraction of total spend. The real cost drivers are session length and context accumulation from tool results.

Turn-counts overcount command-level waste: a wasteful command (polling, re-auth, a bare sleep, a no-op) bundled into a turn that also does real work bills cache-read for that turn regardless — the marginal waste is close to zero. Classifying "turns containing pattern X" as waste massively overcounts. Separate standalone waste from bundled work by inspecting the actual command strings, and always back a dollar figure with atoms → examples → a reproducible query → an independent cross-check. See references/command-attribution.md.

Automated eval/test traffic pollutes usage totals: if you (or your telemetry pipeline) run automated eval or regression suites through Claude Code, that traffic is not real engineer usage. Tag or otherwise identify it in your export and exclude it from normal cost/context/compaction analysis; run a separate, intentionally-scoped query when you want to measure what the eval suite itself costs.

Generating Reports

Capture findings in markdown reports. See references/report-templates.md for standard structures. Name files {report-type}-{YYYY-MM-DD}.md.

Reference Files

  • references/queries.md — Example Honeycomb queries organized by analysis dimension. Load when composing a query for a specific analysis dimension.
  • references/cost-model.md — Token pricing ratios, per-call/per-session cost formulas, caching economics. Load when a finding needs a dollar estimate, not just a raw count.
  • references/report-templates.md — Standard report structures for each analysis type. Load before writing up findings.
  • references/column-gotchas.md — Data-quality gotchas specific to cost analysis. Load before trusting a cost or sequence column you haven't queried before.
  • references/command-attribution.md — Attributing cost to specific command patterns (waste vs bundled with real work). Load when classifying whether a costly command is standalone waste or bundled with real work.

Scripts

  • scripts/compute_percentiles.py — Compute p10/p25/p50/p75/p90/p99 from per-user query result sets

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Cc Cost Analysis AI skill do?

Analyze Claude Code usage costs from OpenTelemetry data — per-user spend, expensive sessions, context bloat, and model/token cost breakdowns — with a structured framework, ready-to-use query shapes, and cost-model formulas. Triggers on "analyze Claude Code costs", "break down the Claude Code bill", "find expensive sessions", "identify context bloat".

Why use Cc Cost Analysis on TypingMind?

Because you install it once and use it with any model. Cc Cost Analysis is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Cc Cost Analysis in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/intercom/2x-skills/tree/main/plugins/claude-code-tools/skills/cc-cost-analysis. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Cc Cost Analysis?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Cc Cost Analysis?

As many as you like. As long as a model supports skills, you can use Cc Cost Analysis with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Cc Cost Analysis AI skill free?

Yes. It is published on GitHub by intercom under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇