---
title: "Coding Agent Cost: Why Sessions Get Expensive"
subtitle: "Keep the project on disk, treat lunch as a bill, and score the first finished tasks rather than dollars per million tokens"
url: "https://alphasignal.ai/news/coding-agent-cost-why-sessions-get-expensive"
author: "Adham Khaled"
author_url: "https://alphasignal.ai/author/adham__khaled__"
published: "2026-09-03T16:04:00.000Z"
updated: "2026-09-03T17:07:12.906Z"
type: "Deep Dive"
topics:
  - "Agents"
  - "Llms"
subtopics:
  - "Code Agents"
  - "Memory"
  - "Long Context"
upvotes: 2
comments: 0
truncated: true
---

# Coding Agent Cost: Why Sessions Get Expensive

> Keep the project on disk, treat lunch as a bill, and score the first finished tasks rather than dollars per million tokens

You left a long coding-agent thread over lunch.

Then the stored copy of that history is already gone which was cheap, so the first message you send when you come back re-sends every prior turn at full input price, which is why you run coding work as session, task, and project, and why walking away is a bill.

The models you call via API are **stateless** and do not keep the conversation in memory between calls, so every turn re-sends the whole thread, and a one-token tool result still pays that whole history.

**Arena AI's recent lecture** [**"The Real Cost of Agentic AI: Tokens, Caching & Context Costs Explained"**](https://www.youtube.com/watch?v=dC7T8Fb4Vbo) is the 26-minute walkthrough of that bill.

It walks through:

* Why the model re-sends the whole thread every turn,
* Why the bill still grows even when most of that thread is stored cheaply (cached),
* Why walking away can make one message cost more than the afternoon (cache-miss),
* How coding apps shorten the thread when it gets huge (compaction),
* Why the first finished jobs beat dollars per million tokens.

The worked example is a one-word "hi" after a 1 million token session. So if the model costs $1 per 1M input tokens, that "hi" is priced at $1.

**Opus 5** bills that same input million at $5 when the stored copy is gone, and $0.50 when the provider still has it, on Anthropic's [pricing page](https://platform.claude.com/docs/en/about-claude/pricing).

**Pin** the model and the provider so that stored copy stays cheap to re-read, because the project does not live in the thread.

What follows is the session lifetime and the lunch bill, how to score a finished task, where the project lives, four cache prices, and how to mix cheap models without paying twice.

## What happens when you leave a long agent session

Coming back after the cheap stored copy dies bills the whole prefix at full input price. The session is scratch paper with a lifetime, so pin the model and the provider.

Providers store a cheap copy of the prefix, the start of the prompt that is everything already in the thread, for a short window.

A hit is a later turn that still finds that copy. A miss is a later turn that does not find it, so you pay the full input price to send the whole history again.

If you pinned Opus 5 on Anthropic in the morning and started a failing test, then left for lunch, the default 5-minute cache is already dead when you sit back down.

![](https://imagedelivery.net/kokADdxuw1FCXyR2p8D2CQ/9fdc5592-cd51-45b1-066c-34a70d138900/public)

### Why a cache miss can cost more than an afternoon of hits

Miss spikes can beat the rest of an afternoon of cheap hits. Those dollars are arithmetic on Anthropic's pricing page, not a session I sat through.

On that page, 200,000 uncached Opus 5 input tokens are $1.00 and a hit is $0.10\. One million uncached is $5.00, and a hit is $0.50.

By default, Anthropic keeps the cache for five minutes and drops it if you do not use it. Storing a copy with a 5-minute life costs **1.25x** the base input price, and a 1-hour life costs **2x**.

I ran these tests in [Model Routing Layers and the Prompt Cache Tax](https://alphasignal.ai/news/model-routing-layers-and-the-prompt-cache-tax): 12-turn coding sessions through OpenRouter on the same synthetic prefix, and the cache died mid-run.

Grok 4.5 (not 4.6), at a 30,000-token prefix, paid a full-price re-read twice (turns 2 and 10) after the 5-minute cache expired, which is shorter than lunch. The expensive turn is the first one after you walk back in.

_Preview only. Full text requires an AlphaSignal Pro account._

## Sources

- [Arena AI, The Real Cost of Agentic AI: Tokens, Caching & Context Costs Explained](https://www.youtube.com/watch?v=dC7T8Fb4Vbo)
- [Anthropic pricing (prompt cache)](https://platform.claude.com/docs/en/about-claude/pricing)
- [a16z Charts of the Week (cached agentic tokens)](https://www.a16z.news/p/charts-of-the-week-winds-of-thematic)
- [Artificial Analysis, Grok 4.6](https://artificialanalysis.ai/models/grok-4-6)
- [Robot Ventures, The Souq](https://robvc.com/research/the-souq)
