File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
packages/types/src/providers
src/api/providers/fetchers Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -88,3 +88,8 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
8888 "anthropic/claude-3.7-sonnet:thinking" ,
8989 "google/gemini-2.5-flash-preview-05-20:thinking" ,
9090] )
91+
92+ // Models that support image input but may not be correctly reported by OpenRouter API
93+ export const OPEN_ROUTER_IMAGE_SUPPORT_MODELS = new Set ( [
94+ "moonshotai/kimi-k2:free" ,
95+ ] )
Original file line number Diff line number Diff line change 99 OPEN_ROUTER_COMPUTER_USE_MODELS ,
1010 OPEN_ROUTER_REASONING_BUDGET_MODELS ,
1111 OPEN_ROUTER_REQUIRED_REASONING_BUDGET_MODELS ,
12+ OPEN_ROUTER_IMAGE_SUPPORT_MODELS ,
1213} from "@roo-code/types"
1314
1415import { getOpenRouterModelEndpoints , getOpenRouterModels } from "../openrouter"
@@ -148,6 +149,15 @@ describe("OpenRouter API", () => {
148149 . sort ( ) ,
149150 ) . toEqual ( expectedRequiredReasoningBudgetModels )
150151
152+ // Test image support for hardcoded models
153+ expect (
154+ Object . entries ( models )
155+ . filter ( ( [ _ , model ] ) => model . supportsImages )
156+ . map ( ( [ id , _ ] ) => id )
157+ . filter ( ( id ) => OPEN_ROUTER_IMAGE_SUPPORT_MODELS . has ( id ) )
158+ . sort ( ) ,
159+ ) . toEqual ( Array . from ( OPEN_ROUTER_IMAGE_SUPPORT_MODELS ) . sort ( ) )
160+
151161 expect ( models [ "anthropic/claude-3.7-sonnet" ] ) . toEqual ( {
152162 maxTokens : 8192 ,
153163 contextWindow : 200000 ,
Original file line number Diff line number Diff line change 77 OPEN_ROUTER_COMPUTER_USE_MODELS ,
88 OPEN_ROUTER_REASONING_BUDGET_MODELS ,
99 OPEN_ROUTER_REQUIRED_REASONING_BUDGET_MODELS ,
10+ OPEN_ROUTER_IMAGE_SUPPORT_MODELS ,
1011 anthropicModels ,
1112} from "@roo-code/types"
1213
@@ -193,7 +194,7 @@ export const parseOpenRouterModel = ({
193194 const modelInfo : ModelInfo = {
194195 maxTokens : maxTokens || Math . ceil ( model . context_length * 0.2 ) ,
195196 contextWindow : model . context_length ,
196- supportsImages : modality ?. includes ( "image" ) ?? false ,
197+ supportsImages : modality ?. includes ( "image" ) ?? OPEN_ROUTER_IMAGE_SUPPORT_MODELS . has ( id ) ?? false ,
197198 supportsPromptCache,
198199 inputPrice : parseApiPrice ( model . pricing ?. prompt ) ,
199200 outputPrice : parseApiPrice ( model . pricing ?. completion ) ,
You can’t perform that action at this time.
0 commit comments