Claude calls go to Anthropic's own Messages API with prompt caching; the ledger prices cached tokens #120

Merged
time merged 4 commits from ceo/anthropic-messages-cache into main 2026-10-18 04:59:21 +00:00
4 Commits
Author SHA1 Message Date
teahubxyzandClaude Fable 5.1 f73d71be22 changelog: the compat switch needs no code change (also moves the head past a status from a cancelled heartbeat run)
ci / test (pull_request) Successful in 35s
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017K4vyY3yUD3GsvoZaAtKkD
2026-10-18 04:57:28 +00:00
teahubxyzandClaude Fable 5.1 5580804cf7 changelog: Claude calls on the Messages API with prompt caching
ci / test (pull_request) Successful in 34s
heartbeat / tick (pull_request_review) Canceled after 0s
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017K4vyY3yUD3GsvoZaAtKkD
2026-10-18 04:38:31 +00:00
teahubxyzandClaude Fable 5.1 854b3b3f67 tests: the fake Anthropic endpoint speaks the Messages API; caching breakpoints, cached-token pricing, the compat switch, the translation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017K4vyY3yUD3GsvoZaAtKkD
2026-10-18 04:38:07 +00:00
teahubxyzandClaude Fable 5.1 4d1ffd2fe4 Claude calls go to Anthropic's own Messages API with prompt caching; the ledger prices cached tokens
The OpenAI-compatible endpoint has no caching, so a 40-step worker run re-sent its whole context at full price on every
step (a failed 43-step run cost $2.80). anthropic_messages() speaks the engine's OpenAI shape on both sides: the tools and
system prompt are one cache breakpoint and the conversation so far the other, an assistant turn that issued tool calls
goes back exactly as the API gave it (thinking blocks included), and tool results of one turn travel in one user message.
book() prices cache reads at a tenth and cache writes at a quarter more, and the ledger line carries both counts.
TIME_ANTHROPIC_API=compat is the old endpoint.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017K4vyY3yUD3GsvoZaAtKkD
2026-10-18 04:36:52 +00:00