mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
Make sure not to show prices for free models (#8864)
This commit is contained in:
parent
e76ac42455
commit
84cf332f19
3 changed files with 8 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ export async function getRooModels(baseUrl: string, apiKey?: string): Promise<Mo
|
|||
cacheReadsPrice: cacheReadPrice,
|
||||
description: model.description || model.name,
|
||||
deprecated: model.deprecated || false,
|
||||
isFree: tags.includes("free"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,13 +117,17 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<string> {
|
|||
}
|
||||
|
||||
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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue