@@ -4,12 +4,6 @@ import * as path from "path"
44
55import { back as nockBack } from "nock"
66
7- import {
8- OPEN_ROUTER_PROMPT_CACHING_MODELS ,
9- OPEN_ROUTER_REASONING_BUDGET_MODELS ,
10- OPEN_ROUTER_REQUIRED_REASONING_BUDGET_MODELS ,
11- } from "@roo-code/types"
12-
137import { getOpenRouterModelEndpoints , getOpenRouterModels , parseOpenRouterModel } from "../openrouter"
148
159nockBack . fixtures = path . join ( __dirname , "fixtures" )
@@ -22,131 +16,6 @@ describe("OpenRouter API", () => {
2216
2317 const models = await getOpenRouterModels ( )
2418
25- const openRouterSupportedCaching = Object . entries ( models )
26- . filter ( ( [ id , _ ] ) => id . startsWith ( "anthropic/claude" ) || id . startsWith ( "google/gemini" ) ) // only these support cache_control breakpoints (https://openrouter.ai/docs/features/prompt-caching)
27- . filter ( ( [ _ , model ] ) => model . supportsPromptCache )
28- . map ( ( [ id , _ ] ) => id )
29-
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- "anthropic/claude-opus-4.1" , // Not yet available in OpenRouter API
36- "anthropic/claude-sonnet-4.5" , // Not yet available in OpenRouter API
37- ] )
38-
39- const ourCachingModels = Array . from ( OPEN_ROUTER_PROMPT_CACHING_MODELS ) . filter (
40- ( id ) => ! excludedModels . has ( id ) ,
41- )
42-
43- // Verify all our caching models are actually supported by OpenRouter
44- for ( const modelId of ourCachingModels ) {
45- expect ( openRouterSupportedCaching ) . toContain ( modelId )
46- }
47-
48- // Verify we have all supported models except intentionally excluded ones
49- const expectedCachingModels = openRouterSupportedCaching . filter ( ( id ) => ! excludedModels . has ( id ) ) . sort ( )
50-
51- expect ( ourCachingModels . sort ( ) ) . toEqual ( expectedCachingModels )
52-
53- expect (
54- Object . entries ( models )
55- . filter ( ( [ _ , model ] ) => model . supportsReasoningEffort )
56- . map ( ( [ id , _ ] ) => id )
57- . sort ( ) ,
58- ) . toEqual ( [
59- "agentica-org/deepcoder-14b-preview:free" ,
60- "aion-labs/aion-1.0" ,
61- "aion-labs/aion-1.0-mini" ,
62- "anthropic/claude-3.7-sonnet:beta" ,
63- "anthropic/claude-3.7-sonnet:thinking" ,
64- "anthropic/claude-opus-4" ,
65- // "anthropic/claude-opus-4.1", // Not yet available in OpenRouter API
66- "anthropic/claude-sonnet-4" ,
67- "arliai/qwq-32b-arliai-rpr-v1:free" ,
68- "cognitivecomputations/dolphin3.0-r1-mistral-24b:free" ,
69- "deepseek/deepseek-r1" ,
70- "deepseek/deepseek-r1-distill-llama-70b" ,
71- "deepseek/deepseek-r1-distill-llama-70b:free" ,
72- "deepseek/deepseek-r1-distill-llama-8b" ,
73- "deepseek/deepseek-r1-distill-qwen-1.5b" ,
74- "deepseek/deepseek-r1-distill-qwen-14b" ,
75- "deepseek/deepseek-r1-distill-qwen-14b:free" ,
76- "deepseek/deepseek-r1-distill-qwen-32b" ,
77- "deepseek/deepseek-r1-distill-qwen-32b:free" ,
78- "deepseek/deepseek-r1-zero:free" ,
79- "deepseek/deepseek-r1:free" ,
80- "google/gemini-2.5-flash-preview-05-20" ,
81- "google/gemini-2.5-flash-preview-05-20:thinking" ,
82- "microsoft/mai-ds-r1:free" ,
83- "microsoft/phi-4-reasoning-plus" ,
84- "microsoft/phi-4-reasoning-plus:free" ,
85- "microsoft/phi-4-reasoning:free" ,
86- "moonshotai/kimi-vl-a3b-thinking:free" ,
87- "nousresearch/deephermes-3-mistral-24b-preview:free" ,
88- "open-r1/olympiccoder-32b:free" ,
89- "openai/codex-mini" ,
90- "openai/o1-pro" ,
91- "perplexity/r1-1776" ,
92- "perplexity/sonar-deep-research" ,
93- "perplexity/sonar-reasoning" ,
94- "perplexity/sonar-reasoning-pro" ,
95- "qwen/qwen3-14b" ,
96- "qwen/qwen3-14b:free" ,
97- "qwen/qwen3-235b-a22b" ,
98- "qwen/qwen3-235b-a22b:free" ,
99- "qwen/qwen3-30b-a3b" ,
100- "qwen/qwen3-30b-a3b:free" ,
101- "qwen/qwen3-32b" ,
102- "qwen/qwen3-32b:free" ,
103- "qwen/qwen3-4b:free" ,
104- "qwen/qwen3-8b" ,
105- "qwen/qwen3-8b:free" ,
106- "qwen/qwq-32b" ,
107- "qwen/qwq-32b:free" ,
108- "rekaai/reka-flash-3:free" ,
109- "thudm/glm-z1-32b" ,
110- "thudm/glm-z1-32b:free" ,
111- "thudm/glm-z1-9b:free" ,
112- "thudm/glm-z1-rumination-32b" ,
113- "tngtech/deepseek-r1t-chimera:free" ,
114- "x-ai/grok-3-mini-beta" ,
115- ] )
116- // OpenRouter is taking a while to update their models, so we exclude some known models
117- const excludedReasoningBudgetModels = new Set ( [
118- "google/gemini-2.5-flash" ,
119- "google/gemini-2.5-flash-lite-preview-06-17" ,
120- "google/gemini-2.5-pro" ,
121- "anthropic/claude-opus-4.1" , // Not yet available in OpenRouter API
122- "anthropic/claude-sonnet-4.5" , // Not yet available in OpenRouter API
123- "anthropic/claude-haiku-4.5" , // Not yet available in OpenRouter API
124- ] )
125-
126- const expectedReasoningBudgetModels = Array . from ( OPEN_ROUTER_REASONING_BUDGET_MODELS )
127- . filter ( ( id ) => ! excludedReasoningBudgetModels . has ( id ) )
128- . sort ( )
129-
130- expect (
131- Object . entries ( models )
132- . filter ( ( [ _ , model ] ) => model . supportsReasoningBudget )
133- . map ( ( [ id , _ ] ) => id )
134- . sort ( ) ,
135- ) . toEqual ( expectedReasoningBudgetModels )
136-
137- const excludedRequiredReasoningBudgetModels = new Set ( [ "google/gemini-2.5-pro" ] )
138-
139- const expectedRequiredReasoningBudgetModels = Array . from ( OPEN_ROUTER_REQUIRED_REASONING_BUDGET_MODELS )
140- . filter ( ( id ) => ! excludedRequiredReasoningBudgetModels . has ( id ) )
141- . sort ( )
142-
143- expect (
144- Object . entries ( models )
145- . filter ( ( [ _ , model ] ) => model . requiredReasoningBudget )
146- . map ( ( [ id , _ ] ) => id )
147- . sort ( ) ,
148- ) . toEqual ( expectedRequiredReasoningBudgetModels )
149-
15019 expect ( models [ "anthropic/claude-3.7-sonnet" ] ) . toEqual ( {
15120 maxTokens : 8192 ,
15221 contextWindow : 200000 ,
0 commit comments