Monoize
Transforms

Auto-cache: Anthropic request

Enable top-level automatic caching for Anthropic Messages requests.

What it does

This transform adds cache_control to the request JSON. The upstream moves the cache point to the last eligible content block as the conversation grows. Existing cache_control values remain unchanged.

Reference

PropertyValue
Type IDcache_anthropic_auto
Phaserequest
ScopesProvider, API key

When to use

Use it when a Channel accepts Anthropic automatic caching. Keep cache_anthropic_system enabled for the stable system prefix. Confirm that any relay accepts the top-level field.

Configuration

OptionTypeRequiredDefaultDescription
ttlstringNo"5m"5m or 1h. Cache lifetime of the inserted breakpoint. 5m sends {"type": "ephemeral"}. 1h adds "ttl": "1h".

A 1-hour cache write costs 2x the base input price. A 5-minute cache write costs 1.25x.

Anthropic rejects a request when a 1h breakpoint follows a 5m breakpoint. Use the same ttl in all Anthropic cache_* rules, or use 1h only on earlier breakpoints. Anthropic also rejects a request when the last block has an explicit cache_control with a different TTL.

Provider rules run before API key rules. A later rule retunes the TTL of a breakpoint that Monoize inserted, so an API key rule overrides a Provider rule. Monoize never changes a cache_control that the client sent.

{
  "transform": "cache_anthropic_auto",
  "enabled": true,
  "phase": "request",
  "models": ["claude-*"],
  "config": {}
}

On this page