The idea is:
Give the Prompt Caching option on the Anthropic Chat Model (v1.6) and on the Anthropic node’s Message operation a choice of where the cache breakpoint goes: on the system prompt (and the last tool definition), not only at the end of the request.
Both nodes send a single top-level cache_control: { type: "ephemeral", ttl }. Anthropic treats that as automatic caching and places the breakpoint on the last block of the request, the user message. That pays off for chats and tool loops, where each call repeats the previous prompt. It does not pay off for the most common workflow pattern: the same long system prompt on every call, with a different user message each time. Every call then writes its whole prompt to the cache (at twice the input price on the 1 hour TTL) and nothing is ever read back.
My use case:
A content workflow calls Claude Sonnet 5.5 once per chapter with the same 9,067-token system prompt and a new user message of about 2,500 tokens. Through an HTTP Request node with cache_control on the system block, the system prompt is written once per night and read on every later call, across three workflows that share it.
Tested on n8n 2.45.4 with AI Agent 3.1 and Anthropic Chat Model 1.6 (Claude Sonnet 5.5, Prompt Caching: 1 Hour), two chapters in a row, then two direct requests to read the cache state:
- The exact prompt of chapter 2 read 11,731 tokens from the cache: the node had cached the whole prompt, ending after the chapter’s own data.
- The system prompt alone, marked the way the HTTP node marks it, read nothing and wrote 9,068 tokens: no reusable entry for the system prompt existed, so chapter 2 could not reuse anything from chapter 1.
So with the option on, each call costs more than with caching off.
I think it would be beneficial to add this because:
- A setting such as “Cache breakpoint: end of request (automatic) / system prompt / system prompt and tools” would make caching pay off for single-call agents and chains with a long fixed system prompt, which is where most of the savings are.
- Related, for Claude Sonnet 5.5: the Chat Model cannot turn thinking off. Thinking Mode “Disabled” sends
thinking: { type: "disabled" }, which Sonnet 5.5 rejects with a 400, and the lowest setting it accepts,{ type: "between_tools" }, is not offered. The Anthropic node’s Message operation has no thinking option, so it always runs Sonnet 5.5’s default (adaptive, high effort). - The run data adds cache writes and cache reads into prompt tokens, so there is no way to see from n8n whether caching works. Showing
cache_creation_input_tokensandcache_read_input_tokenswould help.
Any resources to support this?
- Anthropic docs on automatic and explicit breakpoints: Prompt caching - Claude Platform Docs
- Current implementation: PR #34482 (Chat Model,
invocationKwargs.cache_control) and PR #35804 (Anthropic node, top-levelcache_controlin the request body).
Are you willing to work on this?
Happy to test a build.