ワンクリックで
opencode-mistral-cache-key
OpenCode doesn't set prompt_cache_key for Mistral models, missing the documented 10% cached-token discount.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
OpenCode doesn't set prompt_cache_key for Mistral models, missing the documented 10% cached-token discount.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Aider uses 5min TTL by default and works around long pauses with keepalive pings. Wire up the 1h TTL beta instead.
Aider's --cache-prompts is off by default. Flip it on for supported models.
Stop Cline from burning a cache breakpoint on the volatile current user message every turn.
Cline OpenAI native provider sends no prompt_cache_key. Add a stable per-task key so cached_tokens stops being zero.
Cline's system prompt includes a timestamp that may be recomputed per request, invalidating the system-prompt cache.
Continue's prompt caching is opt-in via config and off by default. Flip the default to systemAndTools.
| name | opencode-mistral-cache-key |
| description | OpenCode doesn't set prompt_cache_key for Mistral models, missing the documented 10% cached-token discount. |
| target_harness | OpenCode |
| target_repo | sst/opencode |
| target_files | ["packages/opencode/src/provider/transform.ts"] |
| target_commit | dev branch @ a9ef5a0f |
| estimated_savings | 90% input discount on Mistral cached tokens (currently 0%) |
packages/opencode/src/provider/transform.ts →
ProviderTransform.options() in sst/opencode.
Open feature request: #27556.
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.
Add Mistral to the providers that get an auto-set prompt_cache_key:
--- a/packages/opencode/src/provider/transform.ts
+++ b/packages/opencode/src/provider/transform.ts
@@ ProviderTransform.options(input, model)
// OpenAI Responses
if (/* model uses OpenAI responses */) {
result["promptCacheKey"] = stableHashFor(input);
}
+
+ // Mistral
+ if (model.providerID === "mistral" ||
+ model.api.npm === "@ai-sdk/mistral") {
+ result["prompt_cache_key"] = stableHashFor(input);
+ }
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).
mistral-large-latest or similar.prompt_cache_key field.prompt_cache_key field present and identical
across both requests.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.