I have a workflow in where I recently switched to claude and the model sonnet 4.5 with prompt caching, I am using anthropic API via a http node in n8n with 5 records those need to be processed against a static instructions file that I already uploaded to anthropic files and using that asset id as you see in the 2nd picture and I also set a cache policy with default 5 minutes.
I am just testing this setup with 5 example records, hoping that the file data will cache only for the first record but actually getting cached for all the 5 records as you see in the results picture. Do i need to put all those subsequent records into the same message array? any help or suggestions appreciated. Thanks!
Thanks for your reply. Figured out the problem actually n8n performing all 5 requests at once and they all hitting the claude’s server in similar times, and claude treating each request along with cache instruction as an individual call!
I initially thought the requests go in sequence! The solutions I tried including a code node with http request, but it didn’t perfectly worked for my case!
My current solution involved using a dedicated webserver with this POST message and I am using that API in n8n!