/** * Cost computation (1.37). core never hardcodes provider pricing — a deployment injects it via * `RunnerDeps.pricing` or each `Model.cost`. All prices are **absolute per-1M-token USD**, not * multipliers: each provider's adapter precomputes its discount into an absolute value * (OpenAI/DeepSeek: the cache-hit price; Anthropic: base×0.1 read / ×1.25 5min-write / ×2.0 1h-write). */ /** Per-1M-token absolute prices (USD) for a model. */ export interface ModelPricing { inputPer1M: number; outputPer1M: number; /** Cache-read (hit) absolute price per 1M. Default 0 (treated as full-price input if absent). */ cacheReadPer1M?: number; /** Cache-write 5-min-TTL absolute price per 1M (Anthropic ~1.25× base). 0 elsewhere. */ cacheWritePer1M?: number; /** Cache-write 1-hour-TTL absolute price per 1M (Anthropic ~2.0× base). 0 elsewhere. */ cacheWriteLongPer1M?: number; } /** * Unified token counts for one task/turn, **already normalized** so `totalInputTokens` INCLUDES all * cache tokens (matching OTel `gen_ai.usage.input_tokens`). `cacheReadTokens`/`cacheWriteTokens`/ * `cacheWriteTokensLong` are mutually exclusive subsets of `totalInputTokens`. */ export interface TokenCounts { totalInputTokens: number; cacheReadTokens: number; cacheWriteTokens: number; cacheWriteTokensLong: number; outputTokens: number; } /** * Cost in **integer micro-USD** (1e-6 USD) — integer to avoid float-accumulation error in billing * reconcile (Stripe/AWS-style). Convergent across providers: full-price input = `totalInputTokens` * minus all cache tokens; cache read/write priced at their own absolute rates; output at its rate. * * DeepSeek (hit price as `cacheReadPer1M`, no cache-write) and OpenAI (no 1h write) fall out by their * zero token counts; Anthropic uses all fields. This fixes P2 (cached charged at full price) by * pricing the cache subset separately instead of trusting the brain's possibly-overstated cost total. */ export declare function computeCostMicroUsd(counts: TokenCounts, pricing: ModelPricing): number; /** Map a vendor `Model.cost` (already per-1M absolute) to `ModelPricing`. We don't emit 1h cache * writes, so `cacheWriteLongPer1M` defaults to the 5-min write price (irrelevant while that count is 0). */ export declare function modelCostToPricing(cost: { input?: number; output?: number; cacheRead?: number; cacheWrite?: number; } | undefined): ModelPricing; //# sourceMappingURL=pricing.d.ts.map