What this thread does
Do first: In opencode.jsonc, set settings.cache.ttl under the provider or model you use.
Short answer
OpenCode v2.2.0 (2026-10-27) added configurable cache TTLs. Configure the provider default and override it on individual models. An unset TTL leaves the provider default in effect; Anthropic defaults to five minutes.
What to do
| Item | Value / action |
|---|---|
| File / hierarchy | opencode.jsonc: providers.<provider>.settings.cache.ttl; model override: providers.<provider>.models.<model>.settings.cache.ttl |
| Syntax | Number plus ms, s, m, h, or d; examples 5m, 1h, 24h |
| Source example | Provider anthropic: 1h; model claude-haiku-5-5: 5m |
| Anthropic Messages | cache_control.ttl on each marker; accepted 5m, 1h |
| Bedrock Converse | ttl on each cachePoint; older five-minute-only Claude models ignore 1h |
| OpenAI Chat / Responses | 24h → prompt_cache_retention; other values → prompt_cache_options.ttl |
| Gemini | Automatically cached providers ignore this setting |
| Anthropic write prices | One hour: 2× input price; five minutes: 1.25× |
| Warming | interval: "auto" uses the lifetime to schedule requests |
For the source example, use this compact configuration:
{"providers":{"anthropic":{"settings":{"cache":{"ttl":"1h"}},"models":{"claude-haiku-5-5":{"settings":{"cache":{"ttl":"5m"}}}}}}}
Limits and open questions
OpenCode passes the duration through without adapting it to a provider’s supported values. A longer lifetime can increase cache-write cost. The page gives no exhaustive accepted-duration list for Bedrock or OpenAI.
Not for: Gemini CLI token-caching settings.
Sources
Checked
2026-11-17; read OpenCode models: cache lifetime, OpenCode changelog; no command was run.
Started from a post by @anomalyco, packaged by the editor. Original post