import { A as AiModelsCatalogClient } from './AiModelsCatalogClient-CG-GQORx.cjs'; import { A as AiModelPricing, g as ModelResolverOptions } from './types-B7BnnrsK.cjs'; type AiUsageInput = { tokens: { prompt: number; completion: number; total: number; cached?: number; cacheWrite?: number; reasoning?: number; audio?: number; image?: number; }; provider: string; /** Runtime model id from the provider response (highest priority). */ usedModel?: string; /** Alias of `usedModel` (same priority). */ modelUsed?: string; /** Requested / configured model id; used when runtime id fields are absent. */ model?: string; }; type AiCostExtraction = { model: { field: string; path: string; }; modelUsed?: { field: string; path: string; }; provider?: { field: string; path: string; }; tokens: { source: string; path: string; estimated?: boolean; }; }; type AiCostWarningCode = "UNKNOWN_MODEL" | "LOCAL_PROVIDER_NO_PRICING" | "AI_PROFILES_ESTIMATE" | "OPENROUTER_MARKUP_ESTIMATED" | "ESTIMATED_TOKEN_USAGE" | "VERSION_SUFFIX_PRICING"; type AiCostWarning = { code: AiCostWarningCode; message: string; }; type AiCostResult = { cost: number; /** Model id used for pricing (after resolution). */ resolvedModelId: string; /** Runtime model id when present on input. */ usedModel?: string; /** Requested model id when distinct from runtime. */ model?: string; provider: string; usage: AiUsageInput["tokens"]; extraction?: AiCostExtraction; breakdown?: { promptCostUsd: number; completionCostUsd: number; cachingCostUsd?: number; reasoningCostUsd?: number; audioCostUsd?: number; imageCostUsd?: number; requestFlatCostUsd?: number; }; routedViaOpenRouter: boolean; isAuthoritative: boolean; pricingSnapshot: AiModelPricing; source: "catalog" | "ai-profiles" | "local" | "estimate-fallback"; /** Present when pricing could not be resolved (zero-cost fallback). */ unknownModel?: boolean; warnings?: AiCostWarning[]; }; /** Model id field priority (higher wins). Runtime ids beat request/config aliases. */ declare const MODEL_FIELD_PRIORITY: readonly { key: string; score: number; }[]; type FieldProvenance = { field: string; path: string; score: number; }; type TokenExtractionProvenance = { source: "usage" | "tokens" | "diagnostics" | "estimated"; path: string; estimated?: boolean; }; type ExtractUsageInputResult = { input: AiUsageInput; provenance: { model: FieldProvenance; modelUsed?: FieldProvenance; provider?: FieldProvenance; tokens: TokenExtractionProvenance; }; }; type ExtractUsageInputOptions = { /** Default when no provider field is found (default: `openrouter`). */ defaultProvider?: string; }; /** * Extract {@link AiUsageInput} from activity logs, gateway records, MongoDB exports, * or any nested JSON shape (e.g. `outer.input`, `config`, `metadata.diagnostics`). */ declare function extractUsageInput(record: unknown, options?: ExtractUsageInputOptions): ExtractUsageInputResult; type CostCalculatorOptions = { includeBreakdown?: boolean; resolverOptions?: ModelResolverOptions; /** When true, throw {@link UnknownModelCostError} instead of zero-cost fallback. */ throwOnUnknownModel?: boolean; }; declare class CostCalculator { private readonly catalog; private readonly includeBreakdown; private readonly resolverOptions?; private readonly throwOnUnknownModel; constructor(catalog: AiModelsCatalogClient, options?: CostCalculatorOptions); /** * Extract model, provider, and token usage from an activity / gateway record * (MongoDB export, nested `outer`, `config`, `metadata.diagnostics`, etc.) * then run {@link calculate}. */ calculateFromRecord(record: unknown, extractOptions?: ExtractUsageInputOptions): Promise; calculate(input: AiUsageInput): Promise; private versionSuffixWarnings; private finish; private localProviderResult; private unknownModelResult; } export { type AiCostExtraction as A, CostCalculator as C, type ExtractUsageInputOptions as E, type FieldProvenance as F, MODEL_FIELD_PRIORITY as M, type TokenExtractionProvenance as T, type AiCostResult as a, type AiCostWarning as b, type AiCostWarningCode as c, type AiUsageInput as d, type CostCalculatorOptions as e, type ExtractUsageInputResult as f, extractUsageInput as g };