Skip to content

Commit aa14636

Browse files
committed
remove explicit cache_control for Google models in OpenRouter (cherry pick from RooCodeInc/Roo-Code#4488)
1 parent 793cfdd commit aa14636

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

packages/types/src/providers/openrouter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export const OPEN_ROUTER_PROMPT_CACHING_MODELS = new Set([
3939
"anthropic/claude-3.7-sonnet:thinking",
4040
"anthropic/claude-sonnet-4",
4141
"anthropic/claude-opus-4",
42-
"google/gemini-2.5-pro-preview",
4342
"google/gemini-2.5-flash-preview",
4443
"google/gemini-2.5-flash-preview:thinking",
4544
"google/gemini-2.5-flash-preview-05-20",

src/api/providers/fetchers/__tests__/openrouter.spec.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,22 @@ describe("OpenRouter API", () => {
2323

2424
const models = await getOpenRouterModels()
2525

26-
expect(
27-
Object.entries(models)
28-
.filter(([_, model]) => model.supportsPromptCache)
29-
.map(([id, _]) => id)
30-
.sort(),
31-
).toEqual(Array.from(OPEN_ROUTER_PROMPT_CACHING_MODELS).sort())
26+
const openRouterSupportedCaching = Object.entries(models)
27+
.filter(([_, model]) => model.supportsPromptCache)
28+
.map(([id, _]) => id)
29+
30+
const ourCachingModels = Array.from(OPEN_ROUTER_PROMPT_CACHING_MODELS)
31+
32+
// Verify all our caching models are actually supported by OpenRouter
33+
for (const modelId of ourCachingModels) {
34+
expect(openRouterSupportedCaching).toContain(modelId)
35+
}
36+
37+
// Verify we have all supported models except intentionally excluded ones
38+
const excludedModels = new Set(["google/gemini-2.5-pro-preview"]) // Excluded due to lag issue (#4487)
39+
const expectedCachingModels = openRouterSupportedCaching.filter((id) => !excludedModels.has(id)).sort()
40+
41+
expect(ourCachingModels.sort()).toEqual(expectedCachingModels)
3242

3343
expect(
3444
Object.entries(models)

0 commit comments

Comments
 (0)