11import axios from "axios"
2- import { ModelRecord } from "../../../shared/api"
2+ import { COMPUTER_USE_MODELS , ModelRecord } from "../../../shared/api"
33
44/**
55 * Fetches available models from a LiteLLM server
@@ -21,19 +21,25 @@ export async function getLiteLLMModels(apiKey: string, baseUrl: string): Promise
2121 const response = await axios . get ( `${ baseUrl } /v1/model/info` , { headers } )
2222 const models : ModelRecord = { }
2323
24+ const computerModels = Array . from ( COMPUTER_USE_MODELS )
25+
2426 // Process the model info from the response
2527 if ( response . data && response . data . data && Array . isArray ( response . data . data ) ) {
2628 for ( const model of response . data . data ) {
2729 const modelName = model . model_name
2830 const modelInfo = model . model_info
31+ const litellmModelName = model ?. litellm_params ?. model as string | undefined
2932
30- if ( ! modelName || ! modelInfo ) continue
33+ if ( ! modelName || ! modelInfo || ! litellmModelName ) continue
3134
3235 models [ modelName ] = {
3336 maxTokens : modelInfo . max_tokens || 8192 ,
3437 contextWindow : modelInfo . max_input_tokens || 200000 ,
3538 supportsImages : Boolean ( modelInfo . supports_vision ) ,
36- supportsComputerUse : Boolean ( modelInfo . supports_function_calling || modelInfo . supports_tool_choice ) ,
39+ // litellm_params.model may have a prefix like openrouter/
40+ supportsComputerUse : computerModels . some ( ( computer_model ) =>
41+ litellmModelName . endsWith ( computer_model ) ,
42+ ) ,
3743 supportsPromptCache : Boolean ( modelInfo . supports_prompt_caching ) ,
3844 inputPrice : modelInfo . input_cost_per_token ? modelInfo . input_cost_per_token * 1000000 : undefined ,
3945 outputPrice : modelInfo . output_cost_per_token
0 commit comments