export interface Alternative { model: string; cost: number; salvaged: number; salvagePercent: number; } export interface PreflightResult { tokens: number; cost: number; fits: boolean; model: string; context: number; utilization: number; options: Alternative[]; } /** * Analysis tool — returns ALL cheaper models across ALL providers. * * Use this to SHOW developers what their alternatives are, regardless of * whether Slash would actually route there. If you want "what will the * Slash proxy ACTUALLY route to right now?", use `preflightRoute()`. * * TEST-NOTE (critical): * - `options` is intentionally cross-provider — this is an analysis tool. * - `options[0]` is NOT the routing decision. Using it as such is a bug. * - See `preflightRoute()` for the actual routing decision that matches * the mcpaas-cf proxy's findCheapestRoute semantics. * - A test should assert that preflight().options may contain cross-provider * entries (e.g. given model='claude-opus', options[0]?.model CAN be 'grok-...'). */ export declare function preflight(content: string, model: string): PreflightResult; /** * Routing decision — matches mcpaas-cf proxy's `findCheapestRoute` exactly. * * Returns the single cheapest SAME-PROVIDER alternative that fits the prompt, * or null if no cheaper same-provider option exists (or model unknown, * or model's provider unknown). * * This is what you want to display as "what would Slash route to" — it * matches the proxy's actual behavior. * * TEST-NOTE (critical, must never regress): * - Same-provider only. `preflightRoute('hello', 'claude-opus')` must NEVER * return a model outside Anthropic. Add a test that asserts this for every * canonical model in PROVIDER_MODELS. * - Returns null when: model unknown, provider unknown, or no cheaper same- * provider alternative exists. Null is a valid result ("PASS, no route"). * - Cheapest SAME-PROVIDER alternative by input price. If two alternatives * tie on price (unlikely but possible), returns the first encountered in * PROVIDER_MODELS order. * - Must agree with intercept.ts findCheapestRoute for identical inputs, * INCLUDING respecting the same init() config gates: shouldRoute() * (init({route: false}) must make this always return null, matching * patchFetch() never routing) and isModelAllowed() (init({models: [...]}) * must exclude any candidate not in that list, matching * findCheapestRoute's real filtering). Fixed 2026-08-23 — this * function used to ignore both, so a call site previewing "what will * Slash route to" via preflightRoute() would show a route recommendation * that real traffic through patchFetch() would never actually take * under the same config, silently breaking the "matches exactly" promise. */ export declare function preflightRoute(content: string, model: string): Alternative | null;