Auto-cache: Anthropic tool results
Insert a cache_control breakpoint on the final tool result.
What it does
When the request submits tool results, this transform inserts an Anthropic ephemeral cache_control breakpoint on the final tool result. The cache point moves forward with each tool-result submission.
Requests without tool results pass through unchanged.
Reference
| Property | Value |
|---|---|
| Type ID | cache_anthropic_tool_use |
| Phase | request |
| Scopes | Provider, API key |
When to use
- Agent clients run long tool loops against an Anthropic-compatible upstream.
- You want each loop iteration to re-read the conversation prefix from cache instead of paying full input price.
Configuration
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
ttl | string | No | "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_tool_use",
"enabled": true,
"phase": "request",
"models": [
"claude-*"
],
"config": {}
}