Pi extension that fixes prompt caching for Qwen models served through OpenCode Go.
OpenCode Go's Qwen backend expects Anthropic-style cache_control markers, even though the endpoint is OpenAI Chat Completions compatible. Pi's built-in OpenCode Go Qwen model definitions did not emit those markers, causing cache misses.
This extension re-registers the built-in opencode-go provider and patches only Qwen models with:
compat: {
cacheControlFormat: "anthropic"
}It also adds debug/status commands:
/opencode-cache-status— show how many OpenCode Go Qwen models are patched/opencode-cache-debug— inspect the next OpenCode Go Qwen provider payload forcache_controlmarkers
pi install git:github.com/TreptowerPark/opencode-go-qwen-cache-fixOr test without installing:
pi -e git:github.com/TreptowerPark/opencode-go-qwen-cache-fixThen reload pi or run:
/reload
You need OpenCode Go credentials configured in pi:
export OPENCODE_API_KEY="..."Or via /login / ~/.pi/agent/auth.json with provider key opencode-go.
In pi, select an OpenCode Go Qwen model such as opencode-go/qwen3.6-plus, then run:
/opencode-cache-status
/opencode-cache-debug
The next provider request should report one or more cache_control markers.
- Only patches provider
opencode-go - Only patches models whose id contains
qwen - Does not modify non-Qwen OpenCode Go models
- Does not store or read API keys
MIT