Repository navigation
fix(ai): select OpenRouter auto cache markers by model - #52119
Closed
opencode-agent[bot] wants to merge 1 commit into
Closed
opencode-agent[bot] wants to merge 1 commit into
opencode-agent[bot] wants to merge 1 commit into
Conversation
opencode-agent
Bot
force-pushed
the
openrouter-model-cache
branch
from
September 29, 2026 17:41
d337ffc to
09b9e4f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
autois selected by the OpenRouter route using model prefixes:anthropic/places tool/system/tail breakpoints;qwen/places system/tail content breakpoints (Alibaba ignores tool-definition markers); all other prefixes add none and retain implicit caching.prompt_cache_keystill flows normally.Why
Live OpenRouter streamed usage showed multi-turn Qwen Plus saving ~36% with explicit markers and a stable
prompt_cache_key; the previous auto tail marker made Gemini 2.5 Flash cost more than its unmarked implicit caching. A Qwen snapshot that does not support explicit caching accepted the markers and reported the same billed cost as the unmarked request in a compatibility probe. This replaces the blanket OpenRouter enablement in #52110; the two PRs overlap and should not be merged independently.Verification
bun test test/provider/openrouter.test.ts test/cache-policy.test.tsinpackages/ai: 47 pass.bun typecheckinpackages/ai: pass.bun run check: lint passes; monorepo typecheck stops in unrelated@opencode/postsbecause this host's Node 18.19.1 is below Astro's required >=22.12.0.Requested by: @rekram1-node (Aiden via Slack)