Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/types/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/api/providers/fetchers/roo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/api/providers/roo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
}
Expand Down