Explicit prompt-cache TTL for fractal requests.
Anthropic dropped the implicit ephemeral cache default from 1h to 5m on 2026-03-06. The SDK's 5m marker carries no explicit ttl field, so it inherits whatever the server default is — which means fractal's caching silently went from 1h to 5m on that date, independent of any engine change. A recursive run whose root steps are separated by long leaf fan-outs or child recursion routinely gaps past 5m and loses its whole root-transcript cache between steps.
We pin an explicit 1h ttl so the root transcript survives those gaps. (Leaves never clear Anthropic's 1024-token cache minimum, so this only ever creates cache on the root surface; the leaf marker is a harmless no-op.) No beta header is required for 1h as of 2026 — the ttl in cache_control is sufficient.
Explicit prompt-cache TTL for fractal requests. Anthropic dropped the *implicit* ephemeral cache default from 1h to 5m on 2026-03-06. The SDK's 5m marker carries no explicit ttl field, so it inherits whatever the server default is — which means fractal's caching silently went from 1h to 5m on that date, independent of any engine change. A recursive run whose root steps are separated by long leaf fan-outs or child recursion routinely gaps past 5m and loses its whole root-transcript cache between steps. We pin an explicit 1h ttl so the root transcript survives those gaps. (Leaves never clear Anthropic's 1024-token cache minimum, so this only ever creates cache on the root surface; the leaf marker is a harmless no-op.) No beta header is required for 1h as of 2026 — the ttl in cache_control is sufficient.
(normalize-ttl ttl)Coerce a caller-supplied ttl to a valid Anthropic ttl, or default-ttl when absent. Throws on an unrecognized value rather than silently degrading to the server default.
Coerce a caller-supplied ttl to a valid Anthropic ttl, or default-ttl when absent. Throws on an unrecognized value rather than silently degrading to the server default.
TTL strings Anthropic accepts. Anything else falls back to the implicit server default in the SDK marker, so we reject unknown values loudly.
TTL strings Anthropic accepts. Anything else falls back to the implicit server default in the SDK marker, so we reject unknown values loudly.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |