/** * The plugin's operational price table: USD per 1M tokens, merged with * `config.prices` at load. Entries marked `source: 'vendor'` were authored * from vendor pricing pages at porting time; entries marked * `source: 'upstream-cny'` were converted from the ported * LLM-Cost-Estimator-CN table (CNY per 1k tokens) with the fixed rate * {@link UPSTREAM_CNY_PER_USD} captured at porting time. Prices drift — treat * this table as a starting point and override entries via `config.prices`. * * @module dsh-budget/estimate/prices */ /** Where a built-in entry's numbers came from. */ export type PriceSource = 'vendor' | 'upstream-cny'; /** USD price per 1M tokens. Cache fields follow the harness TokenUsage split. */ export interface PriceEntry { /** Uncached input tokens. */ input: number; /** Output tokens. */ output: number; /** Cached (hit) input tokens; defaults to `input` when absent. */ cacheRead?: number; /** Cache-miss (written) input tokens; defaults to `input` when absent. */ cacheWrite?: number; /** Provenance metadata for built-in entries. */ source?: PriceSource; /** * `false` marks an entry as an unpriced signal instead of an estimate: * its numbers are NOT used for cost accounting and consumers must surface * the model as "cost unknown". Absent (or `true`) means priced. */ priced?: boolean; } /** * Fixed CNY→USD rate used when converting the upstream CNY-per-1k table into * USD-per-1M entries, captured at porting time. It is a conversion constant * of the shipped DATA, not a runtime exchange rate; override any converted * entry via `config.prices` when vendor USD pricing is available. */ export declare const UPSTREAM_CNY_PER_USD = 7.2; /** * Convert an upstream CNY-per-1k price into USD per 1M tokens. * * @param cnyPer1k - price in CNY per 1000 tokens. * @returns the price in USD per 1,000,000 tokens. */ export declare function cnyPer1kToUsdPer1m(cnyPer1k: number): number; /** The built-in price table (USD per 1M tokens). */ export declare const BUILTIN_PRICES: Readonly>; /** * Merge the user table over the built-in table (per-model override). * * @param custom - `config.prices` entries. * @returns the merged table; custom entries win per model id. */ export declare function mergePrices(custom: Readonly>): Record; /** * Resolve the price for one exact route: `${provider}/${model}` first, then * the bare model id, then the fallback. * * @param table - merged price table. * @param fallback - price for models absent from the table. * @param provider - registered provider route. * @param model - model id. * @returns the effective price entry (never undefined). */ export declare function priceFor(table: Readonly>, fallback: Readonly, provider: string, model: string): PriceEntry; /** Cost breakdown for one usage record. */ export interface UsageCost { /** Uncached input cost (USD). */ inputCost: number; /** Output cost (USD). */ outputCost: number; /** Cache-hit input cost (USD). */ cacheReadCost: number; /** Cache-miss input cost (USD). */ cacheWriteCost: number; /** Sum of all four buckets (USD). */ totalCost: number; } /** * Price one disjoint token usage record. * * @param price - effective price entry. * @param inputTokens - uncached input tokens. * @param outputTokens - output tokens. * @param cacheReadTokens - cache-hit tokens (0 when absent). * @param cacheWriteTokens - cache-miss tokens (0 when absent). * @returns the USD cost breakdown. */ export declare function estimateUsageCost(price: Readonly, inputTokens: number, outputTokens: number, cacheReadTokens: number, cacheWriteTokens: number): UsageCost; //# sourceMappingURL=prices.d.ts.map