UNPKG

@bobmatnyc/ai-code-review

Version:

A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter

61 lines (60 loc) 2.05 kB
/** * @fileoverview Gemini-specific token and cost estimator. * * This module provides token counting and cost estimation specifically * for Google's Gemini models, with accurate pricing information. */ import { AbstractTokenEstimator } from './abstractEstimator'; /** * Gemini-specific token and cost estimator */ export declare class GeminiTokenEstimator extends AbstractTokenEstimator { private static instance; /** * Get the singleton instance of the estimator * @returns GeminiTokenEstimator instance */ static getInstance(): GeminiTokenEstimator; /** * Pricing information for Gemini models */ private MODEL_PRICING; /** * Private constructor to enforce singleton pattern */ private constructor(); /** * Get the pricing for a specific model * @param modelName Name of the model * @returns Pricing information for the model */ private getModelPricing; /** * Calculate the cost for a specific tier * @param tokens Number of tokens * @param tokenCost Cost per 1K tokens * @param tierStart Start of the tier * @param tierEnd End of the tier (or undefined for no upper limit) * @returns Cost for this tier */ private calculateTierCost; /** * Calculate the cost for a given number of input and output tokens * @param inputTokens Number of input tokens * @param outputTokens Number of output tokens * @param modelName Name of the model (optional, uses default if not provided) * @returns Estimated cost in USD */ calculateCost(inputTokens: number, outputTokens: number, modelName?: string): number; /** * Get the default model name for this estimator * @returns Default model name */ getDefaultModel(): string; /** * Check if this estimator supports a given model * @param modelName Name of the model to check * @returns True if the model is supported, false otherwise */ supportsModel(modelName: string): boolean; }