Reference 导读

缓存省多少,全看这三个旋钮

Prompt caching 让重复的系统指令不再每次都付全价。先调 `cacheRetention` 决定缓存时长(none/short/long),再配 `contextPruning.mode: "cache-ttl"` 防止过期上下文占坑,最后用 heartbeat 保活。最容易翻车的是 Anthropic 的 long 只在直连 api.anthropic.com 时才生效,走代理或第三方网关时 long 可能退化成 short。

先讲这一页到底在解决什么

缓存省多少,全看这三个旋钮

Prompt caching 让重复的系统指令不再每次都付全价。先调 `cacheRetention` 决定缓存时长(none/short/long),再配 `contextPruning.mode: "cache-ttl"` 防止过期上下文占坑,最后用 heartbeat 保活。最容易翻车的是 Anthropic 的 long 只在直连 api.anthropic.com 时才生效,走代理或第三方网关时 long 可能退化成 short。

原文共 25 节,先看 Start Here 路径:/reference/prompt-caching 查看官方原文