/** * Model pricing and cost computation for the dashboard. * * Maintains per-model pricing tables and computes costs from token counts. * Prices are in USD per million tokens. * * @module */ import type { RunLog } from '../ai/types.js'; /** Pricing per million tokens for a model */ export interface ModelPricing { /** Cost per 1M input tokens */ inputPerM: number; /** Cost per 1M output tokens */ outputPerM: number; /** Cost per 1M cache read tokens (typically discounted) */ cacheReadPerM: number; /** Cost per 1M cache write/creation tokens */ cacheWritePerM: number; } /** Cost breakdown for a run or entry */ export interface CostBreakdown { /** Input token cost */ inputCost: number; /** Output token cost */ outputCost: number; /** Cache read cost */ cacheReadCost: number; /** Cache write cost */ cacheWriteCost: number; /** Total cost */ totalCost: number; } /** * Look up pricing for a model identifier. * * Tries exact match first, then partial match (model ID contains the key * or key contains the model ID). Falls back to default pricing. * * @param model - Model identifier from the run log * @returns Pricing data for the model */ export declare function getModelPricing(model: string): ModelPricing; /** * Compute cost breakdown from token counts and model pricing. */ export declare function computeCost(inputTokens: number, outputTokens: number, cacheReadTokens: number, cacheWriteTokens: number, pricing: ModelPricing): CostBreakdown; /** * Compute cost for an entire run log using per-entry model pricing. * * Uses the model from each entry (not the run-level model) for accuracy, * since individual entries report the actual model used. */ export declare function computeRunCost(runLog: RunLog): CostBreakdown; /** * Format a cost value as a dollar string. */ export declare function formatCost(cost: number): string; /** * Format a token count with K/M suffix for readability. */ export declare function formatTokens(count: number): string; /** * Format a duration in ms to human-readable string. */ export declare function formatDuration(ms: number): string; //# sourceMappingURL=cost-calculator.d.ts.map