OpenCode Cache Warming: What v2.2.7 Changed and When to Turn It On

TL;DR
OpenCode v2.2.7 makes cache warming time its pings from the model cache TTL. The config, the cost of idle pings, and when warming is a bad trade.
Last updated: November 10, 2026
OpenCode cache warming got a quiet but real change in v2.2.7: the default interval is now "auto", so pings are timed from each model's cache.ttl instead of a flat four minutes. If you were wondering whether to switch warming on, the question is no longer "what interval" but "does my idle gap justify paying for keep-alive requests at all". Warming is still off by default, and for many sessions it should stay off.
What the v2.2.7 release and the PR say#
The v2.2.7 release notes list the change under Core: prompt cache warming "times its pings from the model's cache.ttl by default (interval: "auto"), or every 4 minutes without a TTL," and models whose cache outlasts the warming duration are no longer pinged. The same release fixes several warming edge cases: warming stops for a session when a ping rebuilds the cache instead of reading it, the interval is counted from when a request was sent, and pings no longer fire during compaction or after a session is deleted. Tokens and cost from warming pings now count toward the session totals.
The pull request behind it (#62831) has a table of before and after behavior that is worth reading, because it shows what actually moved:
interval | cache.ttl | Before | After |
|---|---|---|---|
| unset | none | every 4 min | every 4 min |
| unset | "5m" | every 4 min | every 4.5 min |
| unset | "1h" | every 4 min for 30 min | not warmed - the cache outlives the 30 min window |
"auto" | none | not warmed | every 4 min |
The one behavior change the author calls out: anyone who set interval: "auto" on purpose and has a model with no cache.ttl will now get that model warmed. To keep a model unwarmed, set cache.warming: false on it. Both the PR and the docs say no config stops parsing.
How warming works#
Straight from the warming docs:
{
"$schema": "https://opencode.ai/config.json",
"warming": true
}
With that, OpenCode warms a recently active session at 90% of the model's cache.ttl, or every four minutes when there is none, until 30 minutes have passed since the latest non-warming request. The object form exposes prompt, interval and duration. A warming request reuses the session's model, agent, instructions and context, appends a transient keep-alive prompt, makes one call and discards the response. It does not add messages to history, and subagent sessions are not warmed.
Details that matter when you read your bill:
- Each interval counts from when the previous request was sent, not when its response finished, because the provider's cache clock starts when the request arrives.
- A warming request does not extend the active window. Only real activity (including a compaction) resets it.
- If a warming ping reads less from the cache than it writes, warming stops for that session until your next real request. Providers that do not report cache usage never count as a miss.
- Per-model control lives under
settings.cache.warming, and a model setting beats a provider setting.
The docs' own cost example: on a model with no cache.ttl, the defaults allow up to seven warming attempts in one uninterrupted 30-minute window (minutes 4, 8, 12, 16, 20, 24 and 28).
When it pays and when it does not#
This section is analysis, not a vendor claim. A warming ping is a full-context request. It is only worth sending if a cached read of your context costs less than the cache rebuild you avoid, and only if you actually come back inside the window.
- Worth it: you work in bursts with gaps of a few minutes (reading a diff, running tests, answering a Slack message), your context is large, and the provider's cache TTL is short. One avoided rebuild on a big prefix can cover several pings.
- Not worth it: you step away for an hour. Warming stops at 30 minutes by default, so you pay for up to seven pings and then the cache expires anyway. If your provider offers a longer cache lifetime, setting
cache.ttlto it is the cleaner fix, and v2.2.7 will then correctly skip warming it. - Check before trusting it: read your provider's cache-read versus cache-write pricing yourself. Our prompt caching comparison across providers covers how the multipliers differ, and our Claude Code cache TTL guide shows the 5m versus 1h trade in the other big harness.
A minimal setup that warms only the provider you pay cache-write premiums on, and exempts a cheap model:
{
"warming": false,
"providers": {
"anthropic": {
"settings": { "cache": { "ttl": "5m", "warming": true } },
"models": {
"claude-haiku-5-5": { "settings": { "cache": { "warming": false } } }
}
}
}
}
That shape comes from the docs' per-provider example. Verify the keys against the docs for the version you run, since the config schema moved between OpenCode 1 and 2 (see our OpenCode 2 upgrade guide).
What people are actually saying#
I could not read Hacker News or Reddit from this run, so there is no fresh thread to quote. The closest community signal I opened is an older proposal in another agent project, openclaw issue #62475, which asked for the same idea: keep-warm pings at roughly 80% of the TTL with a hard hourly cost cap and a cache-hit check on each ping. The reporter's cost figures were their own estimates for Anthropic pricing at the time, so treat them as illustrative. The counter-case is in the thread itself: it was closed as not planned after going stale, which says maintainers elsewhere did not see keep-warm as a must-have. OpenCode shipped the feature opt-in with a duration cap and a cache-miss kill switch, which is the cautious version of the same bet.
For how OpenCode's request prefixes compare to other harnesses when a cache expires, see our token overhead comparison. The wider harness picture is in the OpenCode developer guide.
What else is in v2.2.7#
Worth a line each, all from the release notes:
- GitHub Copilot Auto: pick Auto in the model picker when your Copilot account has an Auto pool and Copilot's router chooses the model per session at the Auto discount, with fallback to the account's default chat model.
- MCP logins stay signed in: remote MCP servers that rotate refresh tokens no longer sign you out when several clients refresh at once or the token endpoint hiccups.
- Breaking, SDK only:
ImageResponse.imageis removed in@opencode/ai; readresponse.images[0]. readimprovements: a negativeoffsetreads from the end of a file, and missing-file errors suggest close names.
Monday checklist#
- Run
opencode --versionand confirm you are on 2.2.7 or later before relying on the new default. - Decide per provider whether your idle gaps are shorter than the cache TTL. If not, leave warming off.
- If you enable it, set
durationdeliberately and exempt cheap models withsettings.cache.warming: false. - Compare session cost before and after for a few days. v2.2.7 now counts warming pings in session totals, so the number you see includes them.
Continue Reading#
- Prompt caching across AI providers - how cache lifetimes and read/write pricing differ by provider
- Claude Code prompt cache TTL controls - 5m versus 1h and reading the hit ratio
- Claude Code token overhead vs OpenCode - prefix stability and cache economics
- OpenCode 2 upgrade guide - config and plugin changes from v1
- OpenCode developer guide - setup, agents and MCP in one place
Sources#
Get the next deep dive like this in your inbox
One email a week on OpenCode and the rest of the AI dev stack. Free.
Read next on AI coding tools
Prompt Caching Across AI Providers: Prices, TTLs and Setup
Prompt caching across OpenAI, Anthropic, Gemini, DeepSeek, Mistral, xAI and Qwen: prices, TTLs, setup code. A reused 100K prefix costs 71-93% less.
13 min readClaude Code Prompt Cache: Read the Hit Ratio, Set 5m or 1h TTLs
Claude Code now reports prompt cache hit ratio and miss causes in /usage. How to read it, script a status line, and set 5m or 1h TTLs.
9 min readClaude Code Sends 33k Tokens Before Your Prompt - OpenCode Sends 7k
Claude Code sends about 33k tokens before your prompt, OpenCode about 7k. The methodology, cache economics and the HN debate over whether the overhead pays off.
7 min readNew here? Start with
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.




