From 5e873eee828d81891cc7b75ec0905f9a42197851 Mon Sep 17 00:00:00 2001 From: joshualipman123 Date: Mon, 25 Aug 2025 15:50:44 -0700 Subject: [PATCH] provide accurate model metadata --- .../types/src/providers/vercel-ai-gateway.ts | 60 +++++++++++++++++++ .../providers/fetchers/vercel-ai-gateway.ts | 11 +++- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/packages/types/src/providers/vercel-ai-gateway.ts b/packages/types/src/providers/vercel-ai-gateway.ts index bded0b530d..47f17ecd96 100644 --- a/packages/types/src/providers/vercel-ai-gateway.ts +++ b/packages/types/src/providers/vercel-ai-gateway.ts @@ -26,10 +26,70 @@ export const VERCEL_AI_GATEWAY_PROMPT_CACHING_MODELS = new Set([ "openai/o4-mini", ]) +export const VERCEL_AI_GATEWAY_VISION_ONLY_MODELS = new Set([ + "alibaba/qwen-3-14b", + "alibaba/qwen-3-235b", + "alibaba/qwen-3-30b", + "alibaba/qwen-3-32b", + "alibaba/qwen3-coder", + "amazon/nova-pro", + "anthropic/claude-3.5-haiku", + "google/gemini-1.5-flash-8b", + "google/gemini-2.0-flash-thinking", + "google/gemma-3-27b", + "mistral/devstral-small", + "xai/grok-vision-beta", +]) + +export const VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS = new Set([ + "amazon/nova-lite", + "anthropic/claude-3-haiku", + "anthropic/claude-3-opus", + "anthropic/claude-3-sonnet", + "anthropic/claude-3.5-sonnet", + "anthropic/claude-3.7-sonnet", + "anthropic/claude-opus-4", + "anthropic/claude-opus-4.1", + "anthropic/claude-sonnet-4", + "google/gemini-1.5-flash", + "google/gemini-1.5-pro", + "google/gemini-2.0-flash", + "google/gemini-2.0-flash-lite", + "google/gemini-2.0-pro", + "google/gemini-2.5-flash", + "google/gemini-2.5-flash-lite", + "google/gemini-2.5-pro", + "google/gemini-exp", + "meta/llama-3.2-11b", + "meta/llama-3.2-90b", + "meta/llama-3.3", + "meta/llama-4-maverick", + "meta/llama-4-scout", + "mistral/pixtral-12b", + "mistral/pixtral-large", + "moonshotai/kimi-k2", + "openai/gpt-4-turbo", + "openai/gpt-4.1", + "openai/gpt-4.1-mini", + "openai/gpt-4.1-nano", + "openai/gpt-4.5-preview", + "openai/gpt-4o", + "openai/gpt-4o-mini", + "openai/gpt-oss-120b", + "openai/gpt-oss-20b", + "openai/o3", + "openai/o3-pro", + "openai/o4-mini", + "vercel/v0-1.0-md", + "xai/grok-2-vision", + "zai/glm-4.5v", +]) + export const vercelAiGatewayDefaultModelInfo: ModelInfo = { maxTokens: 64000, contextWindow: 128000, supportsImages: true, + supportsComputerUse: true, supportsPromptCache: true, inputPrice: 3, outputPrice: 15, diff --git a/src/api/providers/fetchers/vercel-ai-gateway.ts b/src/api/providers/fetchers/vercel-ai-gateway.ts index 4444a3ec40..91456819a6 100644 --- a/src/api/providers/fetchers/vercel-ai-gateway.ts +++ b/src/api/providers/fetchers/vercel-ai-gateway.ts @@ -2,6 +2,7 @@ import axios from "axios" import { z } from "zod" import type { ModelInfo } from "@roo-code/types" +import { VERCEL_AI_GATEWAY_VISION_ONLY_MODELS, VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS } from "@roo-code/types" import type { ApiHandlerOptions } from "../../../shared/api" import { parseApiPrice } from "../../../shared/cost" @@ -67,8 +68,8 @@ export async function getVercelAiGatewayModels(options?: ApiHandlerOptions): Pro for (const model of data) { const { id } = model - // Filter out embedding models (models with "embedding" in name) - if (id.toLowerCase().includes("embed")) { + // Only include language models + if (model.type !== "language") { continue } @@ -98,11 +99,15 @@ export const parseVercelAiGatewayModel = ({ id, model }: { id: string; model: Ve const cacheReadsPrice = model.pricing?.input_cache_read ? parseApiPrice(model.pricing?.input_cache_read) : undefined const supportsPromptCache = typeof cacheWritesPrice !== "undefined" && typeof cacheReadsPrice !== "undefined" + const supportsImages = + VERCEL_AI_GATEWAY_VISION_ONLY_MODELS.has(id) || VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS.has(id) + const supportsComputerUse = VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS.has(id) const modelInfo: ModelInfo = { maxTokens: model.max_tokens, contextWindow: model.context_window, - supportsImages: false, + supportsImages, + supportsComputerUse, supportsPromptCache, inputPrice: parseApiPrice(model.pricing?.input), outputPrice: parseApiPrice(model.pricing?.output),