Skip to content

Commit 4c76bde

Browse files
committed
fix: openrouter is taking a while to correctly report these models. excluding them for now
1 parent 94c6b61 commit 4c76bde

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

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

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,23 @@ describe("OpenRouter API", () => {
2727
.filter(([_, model]) => model.supportsPromptCache)
2828
.map(([id, _]) => id)
2929

30-
const ourCachingModels = Array.from(OPEN_ROUTER_PROMPT_CACHING_MODELS)
30+
// Define models that are intentionally excluded
31+
const excludedModels = new Set([
32+
"google/gemini-2.5-pro-preview", // Excluded due to lag issue (#4487)
33+
"google/gemini-2.5-flash", // OpenRouter doesn't report this as supporting prompt caching
34+
"google/gemini-2.5-flash-lite-preview-06-17", // OpenRouter doesn't report this as supporting prompt caching
35+
])
36+
37+
const ourCachingModels = Array.from(OPEN_ROUTER_PROMPT_CACHING_MODELS).filter(
38+
(id) => !excludedModels.has(id),
39+
)
3140

3241
// Verify all our caching models are actually supported by OpenRouter
3342
for (const modelId of ourCachingModels) {
3443
expect(openRouterSupportedCaching).toContain(modelId)
3544
}
3645

3746
// 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)
3947
const expectedCachingModels = openRouterSupportedCaching.filter((id) => !excludedModels.has(id)).sort()
4048

4149
expect(ourCachingModels.sort()).toEqual(expectedCachingModels)
@@ -109,20 +117,36 @@ describe("OpenRouter API", () => {
109117
"tngtech/deepseek-r1t-chimera:free",
110118
"x-ai/grok-3-mini-beta",
111119
])
120+
// OpenRouter is taking a while to update their models, so we exclude some known models
121+
const excludedReasoningBudgetModels = new Set([
122+
"google/gemini-2.5-flash",
123+
"google/gemini-2.5-flash-lite-preview-06-17",
124+
"google/gemini-2.5-pro",
125+
])
126+
127+
const expectedReasoningBudgetModels = Array.from(OPEN_ROUTER_REASONING_BUDGET_MODELS)
128+
.filter((id) => !excludedReasoningBudgetModels.has(id))
129+
.sort()
112130

113131
expect(
114132
Object.entries(models)
115133
.filter(([_, model]) => model.supportsReasoningBudget)
116134
.map(([id, _]) => id)
117135
.sort(),
118-
).toEqual(Array.from(OPEN_ROUTER_REASONING_BUDGET_MODELS).sort())
136+
).toEqual(expectedReasoningBudgetModels)
137+
138+
const excludedRequiredReasoningBudgetModels = new Set(["google/gemini-2.5-pro"])
139+
140+
const expectedRequiredReasoningBudgetModels = Array.from(OPEN_ROUTER_REQUIRED_REASONING_BUDGET_MODELS)
141+
.filter((id) => !excludedRequiredReasoningBudgetModels.has(id))
142+
.sort()
119143

120144
expect(
121145
Object.entries(models)
122146
.filter(([_, model]) => model.requiredReasoningBudget)
123147
.map(([id, _]) => id)
124148
.sort(),
125-
).toEqual(Array.from(OPEN_ROUTER_REQUIRED_REASONING_BUDGET_MODELS).sort())
149+
).toEqual(expectedRequiredReasoningBudgetModels)
126150

127151
expect(models["anthropic/claude-3.7-sonnet"]).toEqual({
128152
maxTokens: 8192,

0 commit comments

Comments
 (0)