Monoize
Transforms

Auto-cache: Anthropic system prompt

Insert an Anthropic cache_control breakpoint after the system prompt.

What it does

This transform inserts an Anthropic ephemeral cache_control breakpoint on the last system or developer node of the request. The upstream then caches the stable system prefix and reads it from cache on later requests.

The transform changes nothing when the request has no system or developer node.

Reference

PropertyValue
Type IDcache_anthropic_system
Phaserequest
ScopesProvider, API key

When to use

  • The upstream is Anthropic-compatible and bills cache writes and reads at reduced rates.
  • Your clients send a long, stable system prompt on every request.

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.

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.

Example rule

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

Combine with cache_anthropic_tool_use to also cache the conversation prefix during tool loops.

On this page