Repository navigation
v1.0.1
OpenCode Cache Engine release v1.0.1
Changes:
- Bugfix: fixed error with the OpenCode V2 TUI module contract
Detailed Changelog:
Full Changelog: v1.0.0...v1.0.1
Thank you to everyone for using the plugin and helping make this project successful!
Provider-aware prompt-cache optimization and observability for OpenCode.
opencode-cache-engine is an OpenCode npm plugin that exposes three targets required by OpenCode's installed plugin model:
./server— the V1 CacheEngine runtime, hooks, provider policies, and telemetry (verified on OpenCode 1.x)../tui— plugin-manager registration and enable/disable integration; it
has no CacheEngine-specific UI../v2— the OpenCode V2 adapter (preview): implemented and
offline-tested; isolated shim-based loading,setup, and hook
registration/dispatch are verified in an isolated OpenCode 2.0.26 runtime,
but managed-config discovery/registration remain unverified (and the direct
plugins: ["opencode-cache-engine/v2"]entry did not resolve in the tested
offline configuration)
CacheEngine is an OpenCode plugin designed for long-running agent sessions where prompt-cache efficiency affects both latency and cost. It keeps the harness conservative for providers whose cache behavior is already automatic, while applying provider-specific optimizations where the provider exposes useful cache controls or where prompt structure can be safely improved.
The plugin currently has eleven cache-policy families:
- DeepSeek — passive cache observability; request structure is preserved.
- GPT-5.6 and later — documented cache-key/options metadata, with prompt text unchanged. GPT-6 and future 5.6+/6+/7+ versions resolve through the same documented boundary.
- GLM-5.3 and later — GLM implicit-cache baseline and diagnostics; GLM-5.3 additionally uses a narrow, content-preserving
<env>relocation overlay. - MiMo V2.6 and later — MiMo implicit-cache baseline and diagnostics; MiMo V2.6 Flash/Pro additionally use a narrow content-preserving
<env>relocation overlay. - Kimi — passive Moonshot/Kimi implicit-cache observability; the request is left unchanged. The Anthropic-compatible
cache_controlroute is not implemented. - Claude (Anthropic) — passive classification and accounting; the request is left unchanged because OpenCode itself applies Anthropic
cache_controlbreakpoints. - Google Gemini — passive classification and accounting; Gemini 2.5+ provider-managed implicit caching is left untouched. CacheEngine creates no
CachedContentresources and injects no Gemini cache-control field. - Alibaba Qwen — passive classification and accounting; Qwen's provider-managed implicit caching is left untouched on every route. CacheEngine places no explicit block-level cache_control marker and adds no affinity, because the V1 hook cannot reach message content blocks and OpenCode already applies breakpoints on the Qwen Messages routes.
- xAI Grok — passive classification and accounting. Grok caching is automatic on all Grok language models, and direct xAI already receives a stable conversation affinity key from OpenCode itself, so CacheEngine injects no header or key and rewrites nothing.
- Meta Muse — passive classification and accounting. Muse caching is automatic positional prefix caching; Meta's
prompt_cache_keymust be an application-stable routing hint (never per-session) andprompt_cache_retentionis a request-level policy, so CacheEngine injects neither and rewrites nothing. - MiniMax — passive classification and accounting, route-aware. MiniMax caching is automatic; M2.x additionally supports explicit Anthropic
cache_control(M3 does not), but OpenCode already owns those breakpoints on the Anthropic-compatible routes, so CacheEngine injects nothing.
Initial models were personally chosen for their performance in max programming task completed per dollar. More models can be added based on newer releases or updates.
Future releases will be based on newer versions of models from the above providers, as well as any model that performs optimally over the Pareto distribution on OpenRouter as well as on personal discretion. Since cache stability policy doesn't change much for the providers, there's no need for a code rebase.
Installation
V1 (stable):
opencode plugin opencode-cache-engine # TUI/CLI installer
or set config:
"plugin": ["opencode-cache-engine"]
V2 (preview):
opencode plugin add opencode-cache-engine # TUI/CLI installer
or set config:
"plugins": ["opencode-cache-engine"]
Both install the package by name, and each runtime selects the interface it supports from the package's ./server export (V1 → server, V2 → setup). Do not pass opencode-cache-engine/v2 as the package specifier; use the bare name.
Best complemented with agents for the particular models configured at AlexJoaquimPereira/opencode-agent-config