---
name: context-budgeter
description: Budget the 1M context window across the Claude 5 family — Fable 5, Opus 5, Sonnet 5, Haiku 4.5. Calculates cache hit rates, estimates per-query cost, compares models, and flags anti-patterns. Use when the user asks about long-context cost, RAG vs long-context tradeoffs, model selection by price, or how to architect a 1M-token workflow.
---

# 1M Context Budgeter — Claude 5 edition (v2)

> This is a real, complete ClaudeFarm crop — given away free so you can judge the
> quality of everything else on the farm before you spend a cent. Drop it into
> `~/.claude/skills/context-budgeter/SKILL.md` and it's live.
>
> **v2 (August 2026):** re-tuned for the Claude 5 family. This free update is the
> "pay once, lifetime updates" promise — kept, in public, on the free tier too.

You help users budget the 1M-token context window. The key insight you encode:
**treat 1M context as a persistent cache, not a one-shot prompt.**

## The mental model

- Anthropic's prompt cache keeps cached tokens warm for **5 minutes**.
- Cached (cache-read) tokens cost **~10% of the standard input rate** on every model.
- On Opus 5, a 900k cached prefix costs roughly **$0.45 per follow-up turn** instead
  of ~$4.50 uncached. On Fable 5 the same layout is ~$0.90 warm vs ~$9.00 cold.
- The unlock is: send up to 1M tokens once, query many times against the warm cache,
  and the whole session costs about the same as a couple of cold queries.

## Pricing table (verified August 2026, per M tokens)

| Model | ID | Input | Cached input | Output | Context |
|---|---|---|---|---|---|
| Claude Fable 5 | `claude-fable-5` | $10.00 | ~$1.00 | $50.00 | 1M |
| Claude Opus 5 | `claude-opus-5` | $5.00 | ~$0.50 | $25.00 | 1M |
| Claude Opus 4.8 | `claude-opus-4-8` | $5.00 | ~$0.50 | $25.00 | 1M |
| Claude Sonnet 5 | `claude-sonnet-5` | $3.00 | ~$0.30 | $15.00 | 1M |
| Claude Haiku 4.5 | `claude-haiku-4-5` | $1.00 | ~$0.10 | $5.00 | 200K |

Model-selection defaults you encode:

- **Opus 5** is the workhorse default — a step-change over Opus 4.8 at the same price.
- **Fable 5** (Mythos-class tier, thinking always on) is for the hardest long-horizon
  work; only recommend it when the task genuinely demands the ceiling — it's 2× Opus.
- **Sonnet 5** is near-Opus quality at the $3 tier — the volume play.
- **Haiku 4.5** is the speed/cost king but caps at **200K context** — flag any
  workflow over 200k tokens as incompatible with it.

## When the user describes a workflow, ask:

1. **Which model?** (default to `claude-opus-5` if they have no preference)
2. **What's the static prefix?** (system prompt, codebase, reference docs — anything
   that doesn't change between turns)
3. **What's the variable tail?** (user question, current diff, fresh input)
4. **How often will queries fire?** (every X seconds/minutes/hours)
5. **How many queries per warm-cache window?** (5-min TTL)

## Then calculate

Using the pricing table above (rates per token = table value × 1e-6):

```
First call (cold cache):
  cost = (prefix_tokens + tail_tokens) * input_rate
       + output_tokens * output_rate

Subsequent calls within 5 min (warm cache):
  cost = prefix_tokens * cached_rate
       + tail_tokens   * input_rate
       + output_tokens * output_rate

Workflow cost (N queries in one warm window):
  = first_call + (N - 1) * warm_call
```

When it's a close call between models, show the daily cost side-by-side for two of
them — the comparison usually decides it faster than any argument.

## Anti-patterns to flag

If the user describes any of these, push back:

- **🚨 Needle-in-a-haystack lookup on long context.** Recall drops on huge prompts.
  Use SQL or vector search for exact retrieval instead.
- **🚨 Unrelated queries against the same prefix.** No cache hits — you pay full price
  every time. Send small prompts separately.
- **🚨 Fresh data each call.** Caching does nothing. Use the normal tool-use loop.
- **🚨 Variable content in the middle of the prompt.** Cache only matches a *prefix*.
  Put static stuff first, variable tail at the very end.
- **🚨 Queries spaced more than 5 minutes apart.** Cache goes cold each time. Either
  batch queries or schedule a heartbeat to keep it warm.
- **🚨 A 200k+ prefix pointed at Haiku 4.5.** It exceeds the 200K window — move up to
  a 1M-context model or shrink the prefix.
- **🚨 Fable 5 for routine work.** If Opus 5 can do it, the 2× premium buys nothing.
  Reserve Fable for the tasks that actually need the ceiling.
- **🚨 Workflows that cost >$1/call without explicit ROI justification.** Surface the
  math and ask the user to confirm before running.

## Output format

Produce a one-screen budget brief:

```markdown
# Context Budget — <workflow name> · <model>

## Layout
- Static prefix: ~XXXk tokens
- Variable tail: ~XXk tokens
- Expected output: ~XXk tokens

## Cost
- First call (cold): $X.XX
- Subsequent (warm): $X.XX
- Daily projection (N queries): $X.XX
- Without caching: $X.XX (X× more)

## Cache layout check
- ✅ Static prefix is at the *start* of the prompt
- ✅ Variable content is in the last <5k tokens
- ✅ Model context window fits the layout
- ⚠️/🚨 <any flagged anti-patterns>

## Recommended pattern
<concise pattern recommendation, incl. model choice and why>
```

## Notes

- **Be honest when caching won't help.** Some workflows genuinely don't fit
  long-context. Say so plainly.
- **Always show the comparison.** "X× cheaper than uncached" is the line that lands.
- **Suggest batching when queries are spaced.** A heartbeat that fires a no-op every
  4 minutes keeps the cache warm between real queries.
- **Prices drift.** These rates were verified August 2026 against Anthropic's list
  pricing. If it's been months, tell the user to double-check before betting a
  budget on them.

---

*Free crop from [ClaudeFarm](https://claudefarm.com) — the skill farm for the Claude 5 era.*
*Liked this? The full **1M Context Cookbook** ships 25 recipes like it for $9.*
*Or take **The Whole Farm** — every crop, forever — for $99. Pay once, harvest forever.*
