Cut Your Claude Code Costs: How Token Caching and Smart Habits Save You Money

Maximizing the value of your Claude Code sessions

Cut Your Claude Code Costs: How Token Caching and Smart Habits Save You Money

Claude Code's token usage and costs are driven by input/output token pricing, prompt caching, and how much context accumulates in a session. Output tokens cost ~5x input, and thinking tokens are controlled by effort level. Prompt caching automatically stores conversation prefixes, making re-reads cheap (0.1x), but changes to model, effort, fast mode, or timeouts invalidate the cache, causing expensive re-prefills. To minimize costs, keep context short and relevant: @-mention files, use quiet command flags, /clear between tasks, /compact when done, and /rewind instead of /compact for recent mistakes. Also, start fresh sessions for loops and avoid switching models mid-conversation.

A typical turn is lopsided: tens of thousands of tokens going in, a few hundred coming out.
  1. superasn

    Recently I came across the /handoff skill, which I've been using a lot. I find it much better than /compact.

    Basically:

    - /handoff file creates a short document with the important context from your current session and maybe next steps as checklist.

    - You can then start a fresh session with /continue file

    - You can also hand the work from Claude to ChatGPT, or the other way around. Very useful at time of session limits.

    - Plus your handoff files becomes a useful piece of project memory that you can reference later.

    I find this much more useful than /compact or /clear because the context is saved in something portable instead of being tied to one session and i've seen better results doing this every 20 messages or so than running long sessions.

  2. rhaksw

    > @-mention files instead of naming them

    Love Claude, but the @ mention is broken in the desktop app. For the same project if I type the same query "@ephem" I get:

    CLI: https://imgur.com/a/VZMUCOa (good, relevant results)

    Desktop: https://imgur.com/a/QLSo4Ms (bad, irrelevant)

    Opened issue for this and it was automatically closed:

    https://github.com/anthropics/claude-code/issues/71421

    I could have written the issue better (using CLI as comparison instead of VS Code). But, no doubt in my mind Claude could fix this itself in a minute.

  3. jnwatson

    Can anyone explain why the prefix cache is tied to effort?

    I frequently run Fable at xhigh effort to run statistical modeling way above my undergraduate understanding. Claude Fable produces Masters-degree level output, and then I spend lots of round trips asking it to explain different parts to me.

    The first part absolutely uses the extra effort, but the interrogation exercise is something a much simpler model, or the same model with much less effort, could answer.

  4. Glyptodon

    What I see is that I have to read a bunch of stuff and go through a bunch of hassle to save money when the root of it is that if I tell an AI to do work on a task while I'm busy with something else and come back later I've doubled my cost because the cache expires too quickly?

  5. zmmmmm

    What I want is a version of `/clear` that keeps the conversation but drops out things like bloated logs, error traces, etc that were only relevant in the immediate local context.

    I guess compacting somewhat does that but I want something more explicitly that trims out these extremely bloated artefacts while maintaining in full the actual conversation history.

  6. BeetleB

    > @-mention files instead of naming them. The file gets attached to your message directly, which saves a Read call, or a search if Claude has to go find it.

    I've heard it argued that this is an antipattern. If the file is large, it will read the whole file. With Read or something similar, it can do a targeted search and read only the relevant portion.

    Is this still not the case?

    Also, since they mention /context: Can anyone explain why /context takes so long to run? It usually takes several seconds, and I've had cases of it taking over a minute.

    And why don't they just show the basics in a status line somewhere? Just a plain: "120K/200K tokens" I hate having to type /context just to get this. And I shouldn't need to install an extension.

  7. nathanyz

    This feels like the Anthropic version of "You're holding it wrong" (1)

    1) https://www.wired.com/2010/06/iphone-4-holding-it-wrong/

  8. apt-apt-apt-apt

    I'm finding that unexpected cache rewrites cost me huge.

    I have 1h cache TTL set, and do nothing to cause rewrite (response in time, no model/effort/tool changes).

    At 400K tokens in, I'll write a message, and /usage shows only a small increase in cache write. On the next message, cache writes shows 800K, and by the end, I often hit 2M cache writes with no explanation.

    This seems to happen when: using /btw, asking it to review code, other random times. Anyone know what's going on?

More from this day

2026-08-14