/** * Static USD cost estimation for LLM chat requests. * * Pure, no I/O, no dependencies on any other module in this project (other * than a type-only import of {@link ProviderName}, which is erased at * runtime). Maps `(provider, model, tokenUsage)` to a USD estimate via a * static, in-repo price table keyed by `${provider}:${modelPrefix}` and * resolved by longest-prefix match — the most specific known model prefix * wins over a shorter/broader one. * * The `claude-code` provider is NEVER estimated here (ADR-3): the `claude` * CLI reports its own vendor-authoritative `total_cost_usd` (which also * accounts for cache-read/cache-creation tokens this module never sees), so * `estimateCostUsd` unconditionally returns `undefined` for it. * * An unknown `provider:model` pair also returns `undefined` rather than a * guessed number — callers must never surface a silently-wrong cost. */ import type { ProviderName } from "./factory.js"; /** Per-million-token list prices for one model family. */ export interface PriceRow { /** USD per 1,000,000 input tokens. */ inputPerMillion: number; /** USD per 1,000,000 output tokens. */ outputPerMillion: number; } /** Price table keyed by `${provider}:${modelPrefix}`, longest-prefix-match resolved. */ export type PriceTable = Record; export declare const PRICE_TABLE: PriceTable; /** * Estimate the USD cost of a single chat request from its token usage. * * Resolution: builds `${provider}:${model}`, finds every price-table key * that is a prefix of it, and picks the longest (most specific) match. When * no key matches, or `provider` is `"claude-code"`, returns `undefined` — * the caller must treat `undefined` as "unknown," never as zero. * * @param input.provider - The resolved provider name. * @param input.model - The provider-native model ID actually used for the request. * @param input.usage - Token usage for the request (inline shape — this module * has zero cross-module dependencies by design; see file header). * @returns The estimated USD cost, or `undefined` if unknown/unpriced. */ export declare function estimateCostUsd(input: { provider: ProviderName; model: string; usage: { inputTokens: number; outputTokens: number; }; }): number | undefined; //# sourceMappingURL=cost-meter.d.ts.map