How we reduced our Claude Code bill by 62% (without cutting usage) | Claude Code Toolkit
Case study

How we reduced our Claude Code bill by 62% (without cutting usage)

A specific breakdown of where our tokens were going, what we changed, and the six optimizations that produced most of the savings — without asking anyone to use Claude less.

MK
Mateo K. August 23, 2026 · 13 min read

For six months our Claude Code bill grew faster than our team. We'd gone from three people occasionally trying Claude Code to fifteen people using it as core infrastructure — and the invoice showed it. When it crossed a threshold that made finance ask questions, we spent a week actually looking at where the tokens were going. This post is what we found and what we changed. Net result: 62% cost reduction, same usage patterns, no one had to be told to use Claude less.

The starting point matters: our bill was mostly Sonnet with some Opus. The team was averaging 8-10 Claude Code sessions per person per day. Most sessions were short (5-30 minutes); a handful were long refactoring or investigation sessions. Nothing exotic — a normal engineering team using Claude Code the way a normal engineering team uses it.

Step 0: Actually measure

The single most important step was the boring one — turning on billing observability so we could see where the tokens were going. Not just "we spent $X this month" but "which workflows, which people, which files consumed which fraction." This was mostly a matter of enabling per-user attribution in the console and setting up a simple weekly dashboard.

Once we had the data, the picture was clearer than expected: three specific patterns were consuming disproportionate share. Fixing those three moved the needle more than everything else combined.

You can't optimize what you can't see. We spent a week measuring before we changed anything, and it was the highest-leverage week of the whole project.

Optimization 1: Model routing (biggest win)

Our largest single win: routing to the right model for the task. Most of our sessions had been defaulting to Opus because someone set it as the team default early on and nobody had reason to change it. But most of the tasks (formatting fixes, boilerplate generation, simple refactoring, log analysis) don't need Opus.

We built a routing layer using the pattern in Routing between Claude models. Rough rules:

  • Haiku: log analysis, simple lookups, formatting-only changes, extraction tasks
  • Sonnet: default. Everything not specifically routed elsewhere.
  • Opus: multi-file refactoring, hard debugging, architectural design

Estimated impact: ~35 percentage points of the 62% savings. Alone, this was the biggest lever. It cost us nothing in quality because we were previously using Opus on tasks it was overqualified for.

Optimization 2: CLAUDE.md hygiene

Our root CLAUDE.md was 800 lines. Every session loaded all of it. When we audited the file, at least 60% of it was either aspirational, redundant, or so specific to individual packages that it didn't belong at the root.

We restructured following the layered pattern in CLAUDE.md at scale. Root got trimmed to ~110 lines. Package-specific content moved to package CLAUDE.mds. Stale sections got deleted.

Sneaky detail

CLAUDE.md is loaded on every session, so the savings compound. Cutting 500 lines of CLAUDE.md doesn't just save 500 lines of tokens once — it saves them across every session that would have loaded them.

Estimated impact: ~12 percentage points. Also produced a secondary win: sessions with better-scoped CLAUDE.md produced better output, which reduced retry rates.

Optimization 3: Prompt caching (bigger than expected)

We hadn't been using prompt caching. This turned out to be silly. Most of our Claude Code sessions load largely the same CLAUDE.md and largely the same top-level file structure at the start; that's exactly what caching is for.

Enabling caching for the stable prefix of each session (CLAUDE.md, system prompts, tool definitions) meant that the second and subsequent turns in a session paid a fraction of the input cost. And most sessions have many turns.

Estimated impact: ~8 percentage points. Would have been more except our sessions are often short — teams with longer average sessions see more from this.

Optimization 4: Subagent scope discipline

Our early subagents had access to too many tools (we made this mistake extensively — see Subagent design principles). Every subagent that could touch the whole codebase was loading tool definitions for tools it didn't need. Multiply by dozens of subagent invocations per day.

We audited all subagents. Any tool that hadn't been used in a subagent's last 20 runs got removed. Tools that were used but almost never for that specific subagent got moved to be composed on-demand rather than always-loaded.

Estimated impact: ~4 percentage points. Smaller than expected because tool definitions are actually cheap; the bigger win was that the more focused subagents produced better output and required fewer retries.

Optimization 5: The "batch it overnight" pattern

Not every workflow needs interactive Claude Code. Docs sweeps, coverage reports, dependency analyses — these could all run overnight via GitHub Actions (see Claude Code in GitHub Actions) and produce a report in the morning.

The cost per run was similar to interactive. The saving came from being able to use the Batch API for these (50% discount), and from the workflows being carefully engineered rather than exploratory (fewer tokens per useful output).

Estimated impact: ~3 percentage points. Modest but easy.

Optimization 6: Killing sessions that ran too long

A small number of sessions were running for hours accidentally — someone would start a Claude Code session, walk away, come back the next day, and the session had been idle-but-accumulating-context for 16 hours. On average this was a few sessions per week but they were expensive.

A hook that auto-suspends idle sessions after 30 minutes solved this without anyone noticing except the person who used to accidentally leave sessions running. The hook is trivial (see the hooks catalog); the savings are direct.

Estimated impact: ~1 percentage point. Small on average but caught the pathological cases.

What we didn't do

Some things we considered and rejected:

  • Quota per user. Considered it; rejected because usage was legitimate — reducing it would have reduced value. If usage were abusive, quota would be the right lever; ours wasn't.
  • Switching some workflows off Claude entirely. Also considered; also rejected. The workflows that were expensive were also the highest-value.
  • Custom fine-tuning to a smaller model. The engineering cost would have taken 6+ months to pay back. Not a bad idea in principle; too expensive up front for our savings target.
  • Aggressive prompt compression. The prompts weren't bloated. What was bloated was CLAUDE.md, which we did fix.

Where the savings actually came from

The full breakdown

35pp model routing + 12pp CLAUDE.md trim + 8pp prompt caching + 4pp subagent scope + 3pp batch API + 1pp idle timeout = ~63 percentage points of savings from prior baseline. Some overlap; net was 62% off the previous month's bill.

The lesson wasn't about any specific optimization. It was that once we started measuring, the interventions were obvious and mostly cheap. The team spent about 40 person-hours total across all six optimizations. The savings show up every month, indefinitely.

What happened to usage

Sessions per person per day: unchanged (still 8-10). Number of tasks Claude helped with: slightly up, actually — we started adding it to more workflows because the marginal cost was lower. Team sentiment on Claude usefulness: unchanged. The 62% savings genuinely came from waste, not from cutting value.

The version of this post I couldn't write is "we cut usage and saved money" — that would have been a shorter and less useful post. The interesting story is that most of the cost was from things we weren't doing on purpose, and once we saw them, they were fixable.

If you're where we were

The simple version, in order:

  1. Turn on billing observability. Per-user, per-workflow if possible. Two weeks of data before you touch anything else.
  2. Look at your model distribution. If Opus is more than 30% of your usage, routing is probably your biggest lever.
  3. Audit CLAUDE.md. Every line that isn't genuinely useful is being paid for on every session.
  4. Enable prompt caching. Free-ish. Compounds over long sessions.
  5. Audit subagent tool scope. Any tool a subagent doesn't use should be removed.
  6. Consider moving async workflows to CI. Batch API is 50% off.
  7. Add an idle-session timeout. Catches the pathological cases.

None of this is exotic. It's just the boring work of looking at your bill, tracing tokens to their sources, and cutting the ones that weren't producing value. Which is exactly the shape of every other cost optimization exercise, and would probably surprise no one if the tool weren't new enough that most teams haven't done this yet.

MK

Written by

Mateo K.

Mateo focuses on platform engineering, agentic workflows, and turning experimental patterns into infrastructure that scales.

Get cctk running in one command

85 slash commands, 12 subagents, 12 MCP integrations, 12 hooks. All the patterns from this post are shipped in cctk.

npx cctk@latest init Get cctk v1.5.2 →