onlyterp/prompt-cache-skills/opencode-mistral-cache-key
Claude Code and agent skill by onlyterp/prompt-cache-skills
- community
Checking that the SKILL.md file is still in the repository.
OpenCode doesn't set prompt_cache_key for Mistral models, missing the documented 10% cached-token discount.
Install
npx vskill@latest install onlyterp/prompt-cache-skills/opencode-mistral-cache-keySKILL.md
OpenCode: enable Mistral prompt caching (#27556)
Target
packages/opencode/src/provider/transform.ts → ProviderTransform.options() in sst/opencode.
Open feature request: #27556.
Symptom
Mistral's API supports prompt caching with a 10% pricing on cached tokens (similar to OpenAI's Responses API). The mechanism is a prompt_cache_key field on the request that Mistral uses as a routing hint, plus prefix stability.
OpenCode does not set prompt_cache_key for Mistral models. Even though Mistral supports caching server-side, OpenCode-routed Mistral calls never hit the cache.
Fix
Add Mistral to the providers that get an auto-set prompt_cache_key:
Where stableHashFor(input) returns a stable per-session hash — typically the session ID, or a sha256 of the system prompt if no session ID is available. NEVER use a per-request UUID (see docs/gotchas.md #9b).
Verify
- Configure OpenCode with
mistral-large-latestor similar. - Send two identical prompts.
- Capture wire to Mistral.
- Before fix: request body has no
prompt_cache_keyfield. - After fix:
prompt_cache_keyfield present and identical
across both requests.
- Inspect response usage for cached-token indicators (Mistral
reports these similarly to OpenAI).
Background
The Responses-API-style prompt_cache_key pattern is industry standard for explicit cache routing — Mistral, OpenAI, and several other providers all use the same field name. OpenCode wires it for OpenAI but missed Mistral.
See `docs/concepts/openai.md` "The prompt_cache_key trick" — same pattern applies to Mistral.
Full audit: `audits/opencode.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/opencode-mistral-cache-key/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/opencode-mistral-cache-key)