You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would be a great addition, especially it it could work for the parallel_chat_* functions, which I typically call on a vector of input texts all being processed by the same prompt, often a very long prompt.
Docs at https://docs.claude.com/en/docs/build-with-claude/prompt-caching — need to add "cache_control": {"type": "ephemeral"} to appropriate blocks. Probably also want to cache tools. I think this looks straightforward to implement. Also need to double check that cached values are read. Need to caveat that we don't track cache writes so that cost is lost.
Activity
alvarojpf commentedon Jul 22, 2025
I believe this feature is important for production environments and would be a valuable addition.
kbenoit commentedon Jul 22, 2025
This would be a great addition, especially it it could work for the
parallel_chat_*functions, which I typically call on a vector of input texts all being processed by the same prompt, often a very long prompt.hadley commentedon Oct 27, 2025
Docs at https://docs.claude.com/en/docs/build-with-claude/prompt-caching — need to add
"cache_control": {"type": "ephemeral"}to appropriate blocks. Probably also want to cache tools. I think this looks straightforward to implement. Also need to double check that cached values are read. Need to caveat that we don't track cache writes so that cost is lost.hadley commentedon Oct 27, 2025
Actually based on https://docs.claude.com/en/docs/build-with-claude/prompt-caching#how-automatic-prefix-checking-works, looks like I can just turn it on for all conversations and it will always save you money if there's an additional turn. So just need an enum like
cache = c("5min", "off").Add caching support for Claude
Add caching support for Claude (#810)
1beb commentedon Mar 14, 2026
Noting that this doesn't work for AWS Bedrock. I'm going to submit a PR.