import { n as Pricing, r as PricingMap } from "../types-DY9LSF2_.js"; //#region src/node/litellm.d.ts type LiteLlmModelRow = { input_cost_per_token?: number; output_cost_per_token?: number; cache_read_input_token_cost?: number; cache_creation_input_token_cost?: number; max_output_tokens?: number | string; max_tokens?: number | string; max_input_tokens?: number | string; }; /** LiteLLM catalog shape: model name → pricing/limits row. */ type LiteLlmCatalog = Record; /** Result of `loadLiteLlmCatalog()` including the cache/network source. */ type LiteLlmLoadResult = { catalog: LiteLlmCatalog | null; source: "cache" | "network" | "none"; }; /** * Loads the LiteLLM pricing catalog with a small on-disk cache. * * Cache location: * - `$TOKENTALLY_CACHE_DIR` if set * - otherwise: `$HOME/.tokentally/cache` */ declare function loadLiteLlmCatalog({ env, fetchImpl, nowMs }: { env: Record; fetchImpl: typeof fetch; nowMs?: number; }): Promise; /** * Resolves per-token USD pricing from a LiteLLM catalog. * * Skips entries where both prices are `0` (LiteLLM uses `0` for unknown/free in some rows). */ declare function resolveLiteLlmPricing(catalog: LiteLlmCatalog, modelId: string): Pricing | null; /** * Resolves max output tokens from a LiteLLM catalog (best-effort). * * Falls back to legacy `max_tokens` when `max_output_tokens` is missing. */ declare function resolveLiteLlmMaxOutputTokens(catalog: LiteLlmCatalog, modelId: string): number | null; /** Resolves max input tokens from a LiteLLM catalog (best-effort). */ declare function resolveLiteLlmMaxInputTokens(catalog: LiteLlmCatalog, modelId: string): number | null; //#endregion //#region src/node/types.d.ts /** Minimal `fetch` signature used by tokentally's Node helpers. */ type FetchFn = (input: RequestInfo | URL, init?: RequestInit) => Promise; //#endregion //#region src/node/openrouter.d.ts /** Minimal subset of OpenRouter model info used for pricing + limits. */ type OpenRouterModelInfo = { id: string; context_length?: number; pricing?: { prompt?: string | number; completion?: string | number; input_cache_read?: string | number; input_cache_write?: string | number; }; }; /** * Fetches the OpenRouter model catalog (cached in-memory per `apiKey`). * * Note: OpenRouter pricing values are USD per token, returned as numeric strings. */ declare function fetchOpenRouterModelCatalog({ apiKey, fetchImpl, ttlMs }: { apiKey: string; fetchImpl: FetchFn; ttlMs?: number; }): Promise; /** * Converts OpenRouter's catalog pricing to a `PricingMap`. * * OpenRouter prices are already USD per token, so they map straight through. * Entries without valid pricing are skipped. */ declare function openRouterPricingMapFromCatalog(catalog: OpenRouterModelInfo[]): PricingMap; /** * Convenience wrapper: fetch catalog → convert to pricing map. * * Uses the same in-memory TTL as `fetchOpenRouterModelCatalog()`. */ declare function fetchOpenRouterPricingMap({ apiKey, fetchImpl, ttlMs }: { apiKey: string; fetchImpl: FetchFn; ttlMs?: number; }): Promise; //#endregion export { FetchFn, LiteLlmCatalog, LiteLlmLoadResult, OpenRouterModelInfo, fetchOpenRouterModelCatalog, fetchOpenRouterPricingMap, loadLiteLlmCatalog, openRouterPricingMapFromCatalog, resolveLiteLlmMaxInputTokens, resolveLiteLlmMaxOutputTokens, resolveLiteLlmPricing };