onlyterp/prompt-cache-skills/opencode-detect-openai-compat
Claude Code and agent skill by onlyterp/prompt-cache-skills
- community
Checking that the SKILL.md file is still in the repository.
OpenCode's caching detection misses OpenAI-compatible proxies routing to Anthropic/Bedrock. Broaden the predicate.
Install
npx vskill@latest install onlyterp/prompt-cache-skills/opencode-detect-openai-compatSKILL.md
OpenCode: detect OpenAI-compatible Anthropic proxies (#25984, #26460)
Target
packages/opencode/src/provider/transform.ts → applyCaching() in sst/opencode.
Open issues: #25984 (Bifrost/LiteLLM → Bedrock), #26460 (Xiaomi MiMo).
Symptom
When the user routes Anthropic-shaped models through an OpenAI-compatible proxy (LiteLLM, Bifrost, or any @ai-sdk/openai-compatible adapter), OpenCode falls through to the OpenAI caching path and sets promptCacheKey (OpenAI shape). The proxy forwards this verbatim to the Anthropic backend, which ignores it. Result: 0% cache hit rate on what is otherwise the canonical "long agent loop on Claude" use case.
Affected routes:
- LiteLLM proxy → Bedrock Anthropic
- Bifrost → Bedrock Anthropic
- Xiaomi MiMo (Anthropic-shaped, marketed as OpenAI-compatible)
- Any custom
@ai-sdk/openai-compatibleendpoint with Claude backend
Fix
Broaden the detection predicate so OpenAI-compatible adapters with Anthropic-shaped models get Anthropic-style caching:
Optionally factor the predicate into a named helper (isAnthropicShapedRoute(model)) so the same check can be reused elsewhere in OpenCode.
Verify
- Configure OpenCode with a LiteLLM endpoint pointing at a Bedrock
Claude model: ```yaml provider: openai-compatible: baseURL: http://localhost:4000/v1 models:
- claude-3-5-sonnet-bedrock
```
- Run two identical prompts.
- Capture wire to the LiteLLM endpoint.
- Before fix: request body contains
prompt_cache_key, no
cache_control markers; response cache_read_input_tokens always 0.
- After fix: request body has
cache_controlon system + last
stable message; response shows cache_read_input_tokens > 0 on turn 2.
Background
This is a routing-layer detection bug, not a caching-logic bug. The caching CODE is fine; it just never runs for these models because the predicate didn't anticipate proxy-shaped routes.
Related skills:
(#17300) for the DocumentBlock case
(#27556) for Mistral support
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-detect-openai-compat/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-detect-openai-compat)