SWE-bench Verified, live, four arms: 13% cheaper than no compaction, and the highest reward. See the numbers

Choose a cache TTL

The provider sells two prompt-cache lifetimes: five minutes (1.25x base input to create, 0.1x to read) or one hour (2.0x to create, 0.1x to read). Both refresh for free on every hit. Picking between them is a real cost decision, not a default to leave alone.

The short version

How to set it

Configure the TTL on the cacheinject component:

components:
  cacheinject:
    ttl: "5m"   # default; also accepts "1h"

Set per pipeline/preset, not per request — this is a fleet-level policy, not something to flip turn by turn.

Which one should I pick?

Your traffic looks like Pick
Short, rapid-fire turns (most agent sessions) 5m (default) — cheapest, and hits almost as often as 1h
Long-running sessions with multi-hour idle gaps and large prefixes 1h, or 5m + keep-alive pings
You don't know / mixed traffic Leave the default and turn on keep-alive (below) rather than switching the tier

One important caveat: not every provider/model combination actually honors a requested one-hour TTL — some silently downgrade it to five minutes. Check cache_write_1h in your /stats output; if it's consistently zero on a model you're paying the 1-hour premium for, you're not getting what you paid for.

Or, just keep it warm

Instead of paying the 1-hour creation premium up front, you can keep a 5-minute entry alive with periodic keep-alive pings while the session is idle — see Keep an idle prompt cache warm for how to turn that on and what it costs. For most traffic this is cheaper than committing to the 1-hour tier, because you only pay the (cheap) read rate, and only while something might still come back.

The research behind this

This page gives the practical recommendation. The full cost model, the offline TTL predictor, and the measured breakdown of exactly where the savings headroom comes from (and why hit rate alone is a misleading metric) live in Results: