#1H Caching for Custom Model Provider
1 messages · Page 1 of 1 (latest)
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 cachecacheRetention: "long"= 1 hour, only on direct Anthropic or Vertex routes
If you want, I can help check whether your custom provider route qualifies.
Is there a roadmap for implementing a one-hour cache for custom providers?
I don’t see a public roadmap item for 1 hour TTL on arbitrary custom providers right now.
What I do see:
- General prompt caching for custom
anthropic-messagesproviders was requested and later completed: https://github.com/openclaw/openclaw/issues/37325 - An older related issue was closed as not planned: https://github.com/openclaw/openclaw/issues/19279
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-messagesproviders 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 quiver Is this pull request live now? https://github.com/openclaw/openclaw/pull/59049
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.
Current version 2026.4.20
Yep, 2026.4.20 definitely includes that PR. You have the fix.
So on your version:
- custom
anthropic-messagesproviders should honor explicitcacheRetention - but a true Anthropic-style
1hTTL 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.