From 84cf332f1967608d35f583fbe3182703c781772a Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Mon, 27 Oct 2025 14:58:43 -0400 Subject: [PATCH] Make sure not to show prices for free models (#8864) --- packages/types/src/model.ts | 2 ++ src/api/providers/fetchers/roo.ts | 1 + src/api/providers/roo.ts | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/types/src/model.ts b/packages/types/src/model.ts index 8d67d3977f..a97519af1f 100644 --- a/packages/types/src/model.ts +++ b/packages/types/src/model.ts @@ -77,6 +77,8 @@ export const modelInfoSchema = z.object({ cachableFields: z.array(z.string()).optional(), // Flag to indicate if the model is deprecated and should not be used deprecated: z.boolean().optional(), + // Flag to indicate if the model is free (no cost) + isFree: z.boolean().optional(), /** * Service tiers with pricing information. * Each tier can have a name (for OpenAI service tiers) and pricing overrides. diff --git a/src/api/providers/fetchers/roo.ts b/src/api/providers/fetchers/roo.ts index d7b212c3e8..1238f86b9a 100644 --- a/src/api/providers/fetchers/roo.ts +++ b/src/api/providers/fetchers/roo.ts @@ -88,6 +88,7 @@ export async function getRooModels(baseUrl: string, apiKey?: string): Promise { } if (lastUsage) { + // Check if the current model is marked as free + const model = this.getModel() + const isFreeModel = model.info.isFree ?? false + yield { type: "usage", inputTokens: lastUsage.prompt_tokens || 0, outputTokens: lastUsage.completion_tokens || 0, cacheWriteTokens: lastUsage.cache_creation_input_tokens, cacheReadTokens: lastUsage.prompt_tokens_details?.cached_tokens, - totalCost: lastUsage.cost ?? 0, + totalCost: isFreeModel ? 0 : (lastUsage.cost ?? 0), } } }