/** * Minimal per-MTok rate card for OpenCode's realized-savings counterfactual. * * OpenCode persists a pre-computed `cost_usd` per session (priced at its own * model when recorded), so the ACTUAL arm needs no rate card. The * COUNTERFACTUAL arm, however, reprices the same token VOLUME at a DIFFERENT * (baseline) model mix, which requires a per-class rate card the stored cost * cannot supply. This module is that card. * * Rates mirror openclaw/src/pricing.ts exactly (USD per token; verified * May 30, 2026). cacheWrite = 5-minute-TTL rate (1.25x input); cacheWrite1h = * 1-hour-TTL rate (2x input), only set for Claude models that support it. * * A "mix" is a {modelKey -> share} map (shares sum to ~1). price() blends the * per-token cost across the mix; unpriced models fall back to a proxy rate. */ export interface ModelPricing { input: number; output: number; cacheRead: number; /** 5-minute cache-write rate (1.25x input). Used when TTL is unknown. */ cacheWrite: number; /** 1-hour cache-write rate (2x input). Only set for Claude models. */ cacheWrite1h?: number; } /** Default pricing (USD per token). Mirrors openclaw/src/pricing.ts. */ export declare const DEFAULT_PRICING: Record; /** Swap the sonnet card to the introductory rate while it is in effect (idempotent). Returns * true when introductory pricing is active. `asOf` (epoch ms) overrides both env and clock. */ export declare function applySonnetIntroPricing(asOf?: number): boolean; /** Price the proxy rate card uses when a model is unpriced. */ export declare const PROXY_MODEL = "sonnet"; /** * Normalize a model ID into a pricing key. Mirrors openclaw/src/pricing.ts. * Handles provider prefixes (anthropic/claude-sonnet-4-6 -> sonnet) and version * suffixes (gpt-5.2-2026-03 -> gpt-5.2). Returns lowercased raw on no match. */ export declare function normalizeModelName(modelId: string): string; /** A model mix: modelKey (or display name) -> token share. Shares sum to ~1. */ export type ModelMix = Record; /** * Price the fresh+cache_read POOL and OUTPUT at a model mix (NO cache-write). * Linear in tokens, so aggregate window totals price the whole window directly. * Mirrors measure.py's `price(fi, cr, out, shares)`. */ export declare function price(F: number, CR: number, O: number, mix: ModelMix): number; /** * Price cache-write at a model mix, TTL-aware: 1h writes bill at 2x input, 5m * at 1.25x. Cache-write IS a routing lever (billed at the writing model's * rate), so each arm prices CW at its OWN mix. Mirrors measure.py's `price_cw`. * OpenCode's session_log has no 5m/1h split, so all writes are treated as 5m * (conservative) unless cw1h is supplied. */ export declare function price_cw(CW: number, mix: ModelMix, CW_5m?: number, CW_1h?: number): number; /** * Cost of 1M fresh-input tokens at a mix. Used to reprice the compression * add-back: baseline_input_rate / current_input_rate. Mirrors measure.py's * `price(1_000_000, 0, 0, shares)`. */ export declare function inputRatePerMTok(mix: ModelMix): number; //# sourceMappingURL=pricing.d.ts.map