/** * The ONE interpreter of image (vision) input-token cost. * * Every provider difference is DATA — a `GptVisionCost` regime on the model * profile — never a branch on the model id. Adding a family means adding a * profile (or an env override), not an `if (isFoo(model))` here or at a call * site. Callers pass anything profile-shaped (`{ vision, visionTier }`), so the * gate can price a hypothetical geometry with the same code that prices a real * request. * * This module is a dependency leaf: it imports only types, so profile modules * can use it without an import cycle through model resolution. * * Anthropic's 28-px patch geometry lives here too (it is one regime among * several); `anthropic-vision.ts` is the documented, model-id-facing wrapper * around it. */ import type { GptVisionCost } from './gpt-model-profiles.js'; /** One visual token per 28×28-pixel patch. Also the Qwen2-VL grid; NOT OpenAI's * 32-px patch / 512-px tile model — keep those on the OpenAI regimes. */ export declare const ANTHROPIC_PATCH_PX = 28; export type AnthropicVisionTier = 'high-res' | 'standard'; export interface AnthropicVisionProfile { readonly tier: AnthropicVisionTier; /** Neither side may exceed this after downscale (px). */ readonly maxLongEdge: number; /** ⌈w/28⌉×⌈h/28⌉ may not exceed this after downscale (visual tokens). */ readonly maxVisualTokens: number; } /** * Anthropic's documented pre-billing downscale, tiered by model VERSION: * | High-resolution | Claude 4.7 and later models | 2576 px | 4784 | * | Standard | All other models | 1568 px | 1568 | */ export declare const ANTHROPIC_TIERS: Record; /** Raw 28-px patch count for a `w×h` image, i.e. the visual-token cost when the * image already fits the tier limits (no downscale). `⌈w/28⌉` inherently pads * the right/bottom edge up to the next 28-px multiple, as Anthropic documents. */ export declare function patchTokens(width: number, height: number): number; /** * Anthropic visual-token cost at `width×height` for a tier: the documented * resize (largest aspect-preserving size fitting BOTH the long-edge limit and * the visual-token budget, found by binary search exactly as Anthropic's * reference `count_image_tokens`), then the 28-px patch count. * * Note: pxpipe's own pages are always ≤ 1568×728, so the resize never fires for * proxy output (both tiers charge the raw patch count). The resize path is for * correctness as a general-purpose estimator (e.g. arbitrary export input). */ export declare function patchTokensForTier(tier: AnthropicVisionTier | undefined, width: number, height: number): number; /** The profile fields that determine image cost. `GptModelProfile` satisfies * this structurally, so a profile can be passed straight in. */ export interface VisionPricing { readonly vision: GptVisionCost; readonly visionTier?: AnthropicVisionTier; } /** * Per-image input-token cost of a `width×height` render under `pricing`. * This is the DOCUMENTED provider cost — any gate conservatism (safety margin) * is applied by the gate, so this stays honest about what is actually charged. */ export declare function visionTokens(pricing: VisionPricing, width: number, height: number): number; //# sourceMappingURL=vision-cost.d.ts.map