/** * Rate table: bundled defaults, on-demand cached updates, config overrides. * * Resolution precedence: config override > cached update > bundled (FR6.5). * Model ids are normalized with a closed table-driven rule before lookup — * additions are code changes with tests, never "etc.". * * Dollar math uses integer micro-dollars to avoid float drift (DD6). * * Design: design.md §4.5, D3 */ import type { RateEntry, RateSnapshot, CostConfig, CostUnits, TokenUnits } from './types.js'; /** Normalization rule: applied in order; printed by `rates show --normalization`. */ export declare const NORMALIZATION_RULES: Array<{ kind: 'prefix' | 'suffix'; pattern: RegExp; describe: string; }>; /** Normalize a raw model id for rate lookup (FR6.5). */ export declare function normalizeModelId(model: string): string; export declare function cachedRatesPath(projectRoot: string): string; export declare function loadBundled(): RateSnapshot; export type RateOrigin = 'override' | 'cached' | 'bundled'; export interface EffectiveRates { snapshot: string; entries: Map; } /** Merge bundled < cached < overrides into the effective table. */ export declare function effectiveRates(projectRoot: string, config: CostConfig | null): EffectiveRates; /** Cost of usage units in integer micro-dollars; null = unpriced. */ export declare function priceUnits(units: CostUnits, rates: EffectiveRates): number | null; /** * The cache-read component of a token bill, in micro-USD. * * Split out so the report can say what share of the total is re-reading the * conversation rather than producing anything — measured at 59.6% on this * project's ledger, which is the finding the whole context budget rests on. * * Returns 0 when the model or its cache-read rate is unknown, rather than null: * this is a *share* of a total that `priceUnits` has already declared priceable, * so an unknown component is absent from the numerator, and the alternative — * propagating null — would blank the share for a whole instance because one * model in it lacked a rate. Under-reporting the share is the safe direction and * matches the shape `priceUnits` uses for a missing rate class with zero tokens. */ export declare function priceCacheRead(units: TokenUnits, rates: EffectiveRates): number; export declare function microToUsd(micro: number): string; /** * Fetch the LiteLLM pricing JSON and cache the models we know how to price. * HTTPS only, redirects refused, 5MB cap, schema-validated, temp-then-rename. * Throws with a user-safe message on any failure — callers keep the old table. */ export declare function updateRates(projectRoot: string, config: CostConfig | null): Promise; //# sourceMappingURL=rates.d.ts.map