Developers who use Google’s Antigravity with large Gemini 4 models keep watching their weekly quota vanish. New measurements point to a cause: the Antigravity quota is spent fast because the prompt cache expires after roughly five minutes of silence, and the next message then pays full price for the whole conversation.
The same tests found that Google has already written a fix. It just isn’t switched on for Gemini.
What the cache does
Each turn in an agentic coding session carries a large prefix: the system prompt, tool schemas, connected MCP servers, skill definitions and every earlier turn. On Gemini 4 models, Antigravity relies only on implicit caching, an automatic, best-effort prefix match on Google’s backend.
A cache hit bills cached tokens at a 90% discount. A miss bills the full prefix at full price. Google doesn’t publish a fixed lifetime for implicit caching, and coding sessions are full of pauses: reading a diff, running a test, thinking for five minutes.
Where the cliff sits
Telemetry code inside the 193 MB Go agent binary groups turn gaps into two buckets, under five minutes and five minutes or more. That was the first hint. The developer then ran the Antigravity CLI and read the cache_read_tokens figure it reports after each turn.
A binary search over idle times placed the expiry between 4 minutes 45 seconds and 5 minutes. In an 8-minute idle test, a turn after no activity paid for 16,921 tokens in full. With a single keep-alive ping at the 4-minute mark, the cache stayed warm through minute 8.
Two other findings:
- Even a five-word prompt starts with 16,816 tokens of system instructions, tool declarations, MCP servers and skills.
- Separate one-shot CLI runs never share a cache, because each restarts the step timestamp at zero.
The dormant keep-alive engine
Inside the binary, a file named keepalive.go implements a background ping. When a turn ends, a timer fires every 4 minutes 30 seconds, copies the last request, swaps the final block for a single period, caps output at one token and discards the reply. The conversation history stays clean.
It is held back by two gates. Server-side experiment flags control whether pings run at all, and a provider check currently limits them to explicit-cache providers such as Claude, which skips Gemini entirely.
After the developer unlocked it locally, the built-in engine kept a Gemini cache warm across a live six-minute run.
What a ping costs
Weighting cached tokens at 0.1, a cold turn on the 16.8k-token test prefix costs about 16,900 effective tokens. A warm turn costs about 3,640. One well-timed ping saves 29 to 36% even on that small prefix.
In a realistic coding session with a 150,000-token context, a five-minute pause adds about 133,065 effective tokens to the next message.
Pinging forever is not free, though. The break-even is three idle pings at 16.8k context, about 18 minutes of coverage. At 150k context it rises to seven pings, roughly 31.5 minutes of pings. Past that, letting the cache lapse once is cheaper.
The /btw shortcut costs more
Antigravity’s /btw command opens a side question in a forked thread. It did keep the main cache warm, since a turn at 6 minutes 41 seconds still hit. But the fork has its own conversation ID, so it paid 17,697 uncached tokens. That makes it about 4.9 times the cost of a normal ping and roughly 26% worse than accepting a miss.
What you can do now
The developer’s practical advice is to trim the baseline. Disabling unused MCP servers and plugins shrinks every cold turn. Caveats apply: the math uses Google’s published 90% discount, internal quota weights may differ, and implicit caching can shift under load. Because keepalive.go sits behind internal flags, Google could change or remove it in a later release.
If Google turns the engine on for Gemini, the Antigravity quota complaints may ease on their own. Until then, long thinking pauses stay expensive. Two open issues in the Antigravity CLI tracker, #1072 and #1291, already cover unexpected weekly quota depletion on large models.
Source: asubedi.com.np