UNPKG

@bobmatnyc/ai-code-review

Version:

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

55 lines (54 loc) 1.91 kB
/** * @fileoverview OpenRouter-specific token and cost estimator. * * This module provides token counting and cost estimation specifically * for models available through OpenRouter, with accurate pricing information. */ import { AbstractTokenEstimator } from './abstractEstimator'; /** * OpenRouter-specific token and cost estimator */ export declare class OpenRouterTokenEstimator extends AbstractTokenEstimator { private static instance; private anthropicEstimator; private openaiEstimator; /** * Get the singleton instance of the estimator * @returns OpenRouterTokenEstimator instance */ static getInstance(): OpenRouterTokenEstimator; /** * Pricing information for OpenRouter-specific models * Note: Many models are provided by other providers and use their pricing */ 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 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; }