Answer principles round 1: 0 🔴, 3 🟡 (0 misread); name Spent, derive cache-write prices, say a missing subagent's cost lands on the held messages

This commit is contained in:
2026-10-28 11:26:12 +01:00
parent e83ed096c4
commit 0c1e92943a
2 changed files with 31 additions and 17 deletions
+14 -8
View File
@@ -6,20 +6,26 @@ from claude_code.entries import usage_count
@dataclasses.dataclass(frozen=True)
class Price:
"""Dollars per million tokens."""
"""Dollars per million tokens. A cache write costs 1.25 times the input for five minutes and 2 times for an hour, as Opus 5.5's $5 and $8 show."""
input: float
write_5m: float
write_1h: float
read: float
output: float
@property
def write_5m(self) -> float:
return self.input * 1.25
# Anthropic's list prices as the claude-api skill lists them (cached 2026-10-06), with Opus 5.5's cache prices from `docs/decisions.md` → `loop-claude: the worker's claude compacts…`. A cache write costs 1.25 times the input for five minutes and 2 times for an hour, as Opus 5.5's $5 and $8 show. Haiku 5.5's cache read is assumed at a tenth of its input, and its dearer prompts over 100k tokens are left out. Only the proportions between one model's messages matter, since a chunk's recorded cost sets the amounts, so these may be a little off.
@property
def write_1h(self) -> float:
return self.input * 2
# Anthropic's list prices as the claude-api skill lists them (cached 2026-10-06), with Opus 5.5's cache prices from `docs/decisions.md` → `loop-claude: the worker's claude compacts…`. Haiku 5.5's cache read is assumed at a tenth of its input, and its dearer prompts over 100k tokens are left out. Only the proportions between one model's messages matter, since a chunk's recorded cost sets the amounts, so these may be a little off.
PRICES = {
"claude-opus-5-5": Price(4, 5, 8, 0.2, 20),
"claude-sonnet-5-5": Price(2, 2.5, 4, 0.2, 10),
"claude-fable-5-1": Price(10, 12.5, 20, 0.25, 50),
"claude-haiku-5-5": Price(0.1, 0.125, 0.2, 0.01, 0.5),
"claude-fable-5-1": Price(10, 0.25, 50),
"claude-haiku-5-5": Price(0.1, 0.01, 0.5),
"claude-opus-5-5": Price(4, 0.2, 20),
"claude-sonnet-5-5": Price(2, 0.2, 10),
}