You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prompt Caching Not Working for Xiaomi/MiMo Models #26460
When using OpenCode with Xiaomi's MiMo API directly, prompt caching (cache_control headers) is never applied, resulting in 0% cache hit rate and significantly higher token costs. In contrast, using the same models through OpenRouter achieves 90-95% cache hit rates because OpenRouter handles the caching headers correctly.
Root Cause: In opencode's source code (node-Bpcfl-9_.js:314466-314468), the applyCaching() function is only called for specific providers:
if ((model.providerID === "anthropic" ||
model.providerID === "google-vertex-anthropic" ||
model.api.id.includes("anthropic") ||
model.api.id.includes("claude") ||
model.id.includes("anthropic") ||
model.id.includes("claude") ||
model.api.npm === "@ai-sdk/anthropic" ||
model.api.npm === "@ai-sdk/alibaba") && ...)
MiMo uses @ai-sdk/openai-compatible which is NOT included in this condition.
The fix: opencode needs to add @ai-sdk/openai-compatible to the caching condition. This is a bug/missing feature in opencode.
Activity
github-actions commentedon May 9, 2026
Thanks for updating the issue! It now meets our contributing guidelines. We'll take a look.
github-actions commentedon Jul 9, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.