onlyterp/prompt-cache-skills/continue-gemini-explicit
Claude Code and agent skill by onlyterp/prompt-cache-skills
- community
Checking that the SKILL.md file is still in the repository.
Continue's Gemini provider doesn't use the cachedContents API at all. Add explicit caching for sessions over the minimum token threshold.
Install
npx vskill@latest install onlyterp/prompt-cache-skills/continue-gemini-explicitSKILL.md
Continue: implement Gemini explicit caching
Target
packages/openai-adapters/src/apis/Gemini.ts in continuedev/continue.
Symptom
The Gemini provider class does not use the cachedContents API at all. Gemini 2.5+ has implicit caching that fires automatically for byte-stable prefixes (free, best-effort), but explicit cachedContents gives guaranteed cost reduction (0.25x input price on Pro) and controllable TTL. Continue leaves this entire mechanism unused.
Result: long-running Gemini sessions with the same system prompt + tools (the exact use case caching is for) get only implicit-cache luck, not the guaranteed 75% discount.
Fix
Add a _maybeCreateCache helper and reuse the cached content across calls within a session:
Then in the generateContent call path:
Verify
- Start a Continue chat with
gemini-2.5-proorgemini-3-pro-preview
and a system prompt over 4096 tokens (or load a big AGENTS.md).
- Capture wire.
- First call: should see a
POST /v1beta/cachedContentscreate call
followed by a generateContent call referencing the cache name.
- Second call: only
generateContent, reusing the same
cachedContent reference.
- Inspect response
usageMetadata.cachedContentTokenCount—
should be > 0 on both calls.
Background
Gemini has two caching paths: implicit (automatic, free, best-effort) and explicit (cachedContents API, guaranteed discount, configurable TTL, costs storage per hour). For agent loops with a stable large system prompt, explicit is strictly better — you trade pennies of storage for dollars of discount.
Minimums:
- Gemini 3.5 Flash / 2.5 Flash: 1024 tokens
- Gemini 3 Pro Preview / 2.5 Pro: 4096 tokens
Below threshold, caches.create() returns 400 — the fallback to implicit (return null) handles this gracefully.
See docs/concepts/gemini.md. Full audit: audits/continue.md.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/continue-gemini-explicit/SKILL.md
Popularity
- Repository stars
- 114
- Repository forks
- 9
- 7-day trend score
- 24
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/onlyterp/prompt-cache-skills/continue-gemini-explicit)