Skip to content

TreptowerPark/opencode-go-qwen-cache-fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenCode Go Qwen Cache Fix

Pi extension that fixes prompt caching for Qwen models served through OpenCode Go.

What it does

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 for cache_control markers

Install

pi install git:github.com/TreptowerPark/opencode-go-qwen-cache-fix

Or test without installing:

pi -e git:github.com/TreptowerPark/opencode-go-qwen-cache-fix

Then reload pi or run:

/reload

Requirements

You need OpenCode Go credentials configured in pi:

export OPENCODE_API_KEY="..."

Or via /login / ~/.pi/agent/auth.json with provider key opencode-go.

Verify

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.

Notes

  • 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

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages