---
title: "What a Claude Code session costs"
description: "A plain-language guide for managers: the four levers that set a Claude Code bill, how prompt caching works, and how a team caps its spend."
url: https://theclosedgap.com/guides/claude-code/
author: Madina Umbetova
---

[Guides](https://theclosedgap.com/guides) Guide · Running costs

# What a Claude Code session costs

Every message re-sends the whole conversation. Once you know that, every cost decision in the tool follows from four numbers and a handful of habits.

13 September 2026 14 min read

This guide is for people running Claude Code in a business who want to know what they are paying for. It assumes no programming background. It is built from the Anthropic training _Maximizing the value of your Claude Code sessions_ by Lydia Hallie, 14 August 2026, and the slides that go with it. There is a [German version](https://theclosedgap.com/guides/claude-code-kosten) alongside it.

## The four things that set the bill

Lever

What it covers

**Tokens in**

What is loaded, what gets pulled in, and how long the session runs

**Tokens out**

How far the model reaches. Controlled by the effort setting.

**How many are cached**

Keep the front of the request identical, and the cache warm

**Which model**

The price per token. It multiplies the other three.

Everything else in this guide is one of those four.

## Why a bigger model costs more

A larger model has more weights. More weights means more computation for every single token, in and out. The price per token goes up in both directions.

A smaller model is a different tool, and for many jobs it is the right one.

Model

Role

Reach for it when

**Haiku**

Quick assistant

Small scoped jobs, subagents

**Sonnet**

Generalist

Precise edits, mechanical changes, code in context

**Opus**

Expert

Subtle bugs, unfamiliar territory, problems hard to spell out

**Fable**

Specialist

The problems nobody else has seen

## What is already loaded before you type anything

Run `/context`. It shows each of these with its token count, before you have typed a word. All of it is charged on every message for the whole session.

**Claude Code's part:** system prompt, built-in tool definitions, environment and git snapshot.

**Your part:** CLAUDE.md, skill descriptions, MCP tool names, subagent descriptions.

## Prompt caching

Claude has no memory between messages. Every time you press enter, the whole conversation is sent again from the start.

The cache is the server keeping what it already computed. When the front of your request is identical to the previous one, that part is read back at a fraction of the price. This is the single biggest saving available, and most of this guide is about protecting it.

Operation

Rate

When

Cache read

**0.1×**

The input price, on every request while it stays warm

Cache write, 5-minute

**1.25×**

Paid once, when new content enters

Cache write, 1-hour

**2×**

The longer window costs more to fill

## The cache expires

Where

Window

Plans, within usage

about 1 hour

API and cloud

about 5 minutes

Subagents

5 minutes

Every cache hit resets the timer. It expires when you step away, not while you are working.

The longer window is a setting, in `~/.claude/settings.json` or in managed settings for a team:

```
{
  "promptCacheTtl": "1h",
  "subagentPromptCacheTtl": "1h"
}
```

A 1-hour write costs 2× input against 1.25× for the 5-minute one. It pays off when you step away and come back. It does not pay off when you work straight through.

## What breaks the cache, and what does not

**Breaks it:**

-   `/model`. A different model keeps its own cache, and nothing of yours is in it yet. All of it is read fresh by the new model.
-   `/effort`. The effort setting sits inside the front of the request on most models. Fable 5.1 is the exception. Everything after it is read fresh at full price.

Both commands ask you to confirm while the cache is still warm.

**Safe mid-session**, because these append at the end and leave the front untouched:

-   Editing files
-   Switching permission mode
-   Editing CLAUDE.md, which is read next session
-   Connecting an MCP server

## /compact, /rewind, /clear

Command

What happens

`/compact`

The whole conversation is replaced by a short summary, and you can tell it what to keep. From there nothing matches the old cache, so it is computed once. The summary is small, so the cost is small.

`/rewind`

The last few turns are dropped. The cache in front of them survives.

`/clear`

A fresh conversation. Only the loaded-at-start part is left. Run `/rename` first if you want to come back to the old one with `--resume`.

## Session length is the biggest lever

Three tasks in one long session, against three tasks with `/clear` between them.

With `/clear`, every task starts small again. In one long session, task 3 still carries all of tasks 1 and 2. **About double the tokens for the same work.**

## Command output stays in the conversation

Whatever a command prints goes into the conversation and is re-sent on every request after it.

-   **400 lines printed:** those 400 lines ride along in every later request.
-   **Only the failures printed:** a few lines.
-   **Huge output:** it is written to a file, and only a short preview goes in.

The fix is to make the quiet version the default, written into CLAUDE.md so it is used every time:

```
# CLAUDE.md
Run one test file: npx vitest run <file> --reporter=dot
```

## Connected apps switch off

`/mcp` switches off what you are not using this session. An idle server is cheap, and it is not free.

A plain command-line tool loads nothing up front. Claude runs it when it needs it. The examples given are `gh`, `aws` and `gcloud`.

## CLAUDE.md is for what every task needs

Two questions for every block in the file:

1.  **Is it task-specific?** Then it should be a skill. A migration recipe sitting in CLAUDE.md rides along on every single request. As a skill it loads only when the model needs it.
2.  **Is it still needed at all?** Instructions accumulate. A line that solved a problem three months ago is still being paid for on every message today.

## @-mention the file you already know

`fix the failing test in utils.test.ts` costs **two requests**. Claude has to go and read the file first.

`fix the failing test in @utils.test.ts` costs **one**. The file is already in the request.

Mention a file once per conversation. It stays in the conversation after that.

## Subagents

Say "do that in a subagent". It gets its own context, its own model and its own effort. It does the noisy work, everything it read is dropped when it finishes, and only its report comes back into your session.

Two costs to know. It may re-read files your main session already has, and it runs on your main session's model unless you set a different one. For a repeated noisy job, give it a smaller model.

## When the answer misses, ask which one it was

It didn't know enough

It didn't try hard enough

Wrong approach, missed how the pieces fit together. That is the **model**: `/model`.

Skipped a file, did not run the tests, stopped halfway. That is the **effort**: `/effort`.

## In practice

1.  Choose model and effort at the start, or right after `/clear`.
2.  Switching mid-task? `/compact` first, then `/model`.
3.  `/compact` before you step away, while the cache is still warm.
4.  Back tomorrow? `/compact` before you leave. A cold `--resume` re-reads everything at full price.

## For a team: managed settings

One file at `claude.ai/admin-settings/claude-code`. Every install picks it up at startup, and users cannot override it.

Key

What it sets

`model`

What everyone starts on

`availableModels`

What they can switch to

`effortLevel` · `maxEffortLevel`

The starting effort, and a ceiling

`promptCacheTtl`

The long cache window, for API and cloud

`allowedMcpServers`

Which servers people can add

`env`

Telemetry for every install

## For a team: measuring it

Turn on telemetry in the same settings file, then read three numbers. Each one has a one-message fix.

```
"env": {
  "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
  "OTEL_METRICS_EXPORTER": "otlp",
  "OTEL_EXPORTER_OTLP_ENDPOINT": "https://collector:4317"
}
```

**Cache reads as a share of each person's input.** This should be by far the biggest chunk. A low share means the cache keeps breaking: model or effort switches, or long gaps. The slides show three developers at 92%, 88% and 41%.

**Input per request across a session.** It should drop at every `/clear`. A line that only climbs is one endless session, or a resume after the cache had already expired.

**Cost by model, per person.** This shows who has the biggest model switched on for everything.

## Three things to take home

1.  **Decide at the start, then leave it.** Model, effort, MCP servers.
2.  **Be deliberate about what goes in.** @ the files you know. A lean CLAUDE.md. Task-specific steps in skills. Noisy work in a subagent.
3.  **Don't let one session run forever.** `/clear` for a new task. `/compact` before you step away.

The model multiplies all of it. For a team, the same choices go in as managed settings.

## What will age, and what will not

The command names and settings keys in this guide belong to a product that ships changes often. Check them against the current documentation before working from them.

The arithmetic underneath holds. Words in are cheap. Words out cost about five times more. Every message re-sends the whole conversation. An identical front is read back at a tenth of the price. That is how the billing works, and it will still be true when the commands have moved.

* * *

Source: Anthropic, _Maximizing the value of your Claude Code sessions_, Lydia Hallie, 14 August 2026, and the training slides. Assembled for managers who have to decide what a tool costs without a developer background.

The Closed Gap

## One method _every week._

Written by an operator running a $0.8bn global portfolio, for operators. Subscribe free and the next one lands in your inbox.

The Closed Gap on Substack. No spam, unsubscribe in one click.
