#1H Caching for Custom Model Provider

1 messages · Page 1 of 1 (latest)

mental ridge
#

Is 1-hour caching available for the Anthropic message API model?

barren hazelBOT
bright ruinBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

barren hazelBOT
ruby quiverBOT
#

Yes, with an important caveat.

For Anthropic Messages, cacheRetention: "long" becomes a real 1 hour TTL only when the request goes to a direct Anthropic host, api.anthropic.com, or Anthropic Vertex.

If you are using a custom/proxy host for an anthropic-messages model, OpenClaw will not upgrade it to 1 hour. It stays on the normal ephemeral cache behavior instead.

Docs:
https://docs.openclaw.ai/reference/prompt-caching

Relevant bit from the docs:

  • cacheRetention: "short" = default 5 minute ephemeral cache
  • cacheRetention: "long" = 1 hour, only on direct Anthropic or Vertex routes

If you want, I can help check whether your custom provider route qualifies.

mental ridge
ruby quiverBOT
#

I don’t see a public roadmap item for 1 hour TTL on arbitrary custom providers right now.

What I do see:

But for the specific 1 hour part, the current docs and code still intentionally gate that to known endpoints only:

  • direct Anthropic, api.anthropic.com
  • Anthropic Vertex

Docs: https://docs.openclaw.ai/reference/prompt-caching

So current state looks like:

  • custom anthropic-messages providers can get prompt caching support
  • cacheRetention: "long" does not currently become a real 1 hour TTL on arbitrary custom hosts
#

If your provider really supports 1 hour Anthropic-style cache TTL, the best next step is probably a GitHub feature request with the provider docs linked as evidence.

ruby quiverBOT
#

Yes, that PR is merged and live on main, and it shipped in v2026.4.2 and later.

So if you’re on any recent 2026.4.x build, you should have it.

Small caveat though: PR #59049 makes custom anthropic-messages providers honor explicit cacheRetention values. It does not mean arbitrary custom hosts now get an automatic real 1 hour Anthropic TTL. Current docs/code still only guarantee that for direct Anthropic and Anthropic Vertex.

If you want, paste your openclaw --version and I can sanity check whether your install definitely includes it.

ruby quiverBOT
#

Yep, 2026.4.20 definitely includes that PR. You have the fix.

So on your version:

  • custom anthropic-messages providers should honor explicit cacheRetention
  • but a true Anthropic-style 1h TTL is still only guaranteed on direct Anthropic / Vertex, not arbitrary custom hosts

If you want, paste the relevant models.providers block and I can sanity check whether your config is set up correctly.