UNPKG

@bobmatnyc/ai-code-review

Version:

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

52 lines (51 loc) 1.72 kB
/** * @fileoverview OpenAI-specific token and cost estimator. * * This module provides token counting and cost estimation specifically * for OpenAI's models, with accurate pricing information. */ import { AbstractTokenEstimator } from './abstractEstimator'; /** * OpenAI-specific token and cost estimator */ export declare class OpenAITokenEstimator extends AbstractTokenEstimator { private static instance; /** * Get the singleton instance of the estimator * @returns OpenAITokenEstimator instance */ static getInstance(): OpenAITokenEstimator; /** * Pricing information for OpenAI 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 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; }