import type { CreditLedger } from './utils/credit-ledger.js'; import type { CircuitBreakerState, LLMRequest, ModelCapabilities } from './types.js'; export type ProviderName = 'openai' | 'anthropic' | 'cloudflare' | 'cerebras' | 'groq' | 'nvidia'; export type ModelLifecycle = 'active' | 'compatibility' | 'retired'; export type ModelRecommendationUseCase = 'COST_EFFECTIVE' | 'HIGH_PERFORMANCE' | 'BALANCED' | 'TOOL_CALLING' | 'LONG_CONTEXT' | 'VISION' | 'RESEARCH'; export type ModelWorkloadClass = 'summary' | 'planning' | 'code_draft' | 'long_context' | 'tool_loop' | 'vision' | 'research' | 'cost_effective' | 'balanced' | 'high_performance'; export type ModelPreferenceMap = Partial>>>; export interface ModelCatalogEntry { provider: ProviderName; model: string; lifecycle: ModelLifecycle; useCases: ModelRecommendationUseCase[]; capabilities: ModelCapabilities; speedScore: number; qualityScore: number; costScore: number; } type SelectionHealthEntry = { healthy?: boolean; circuitBreaker?: CircuitBreakerState | null; }; export interface ModelSelectionContext { request?: Partial; providerHealth?: Partial>; ledger?: Pick; modelPreferences?: ModelPreferenceMap; } export declare const PROVIDER_FALLBACK_ORDER: ProviderName[]; export declare const MODEL_CATALOG: readonly ModelCatalogEntry[]; export declare function inferUseCaseFromRequest(request: Partial): ModelRecommendationUseCase; export declare function rankModels(useCase: ModelRecommendationUseCase, availableProviders: string[], context?: ModelSelectionContext): ModelCatalogEntry[]; export declare function getRecommendedModel(useCase: ModelRecommendationUseCase, availableProviders: string[], context?: ModelSelectionContext): string; export declare function normalizeModelWorkload(workload: ModelRecommendationUseCase | ModelWorkloadClass): ModelRecommendationUseCase; export declare function getRecommendedModelForWorkload(workload: ModelRecommendationUseCase | ModelWorkloadClass, availableProviders: string[], context?: ModelSelectionContext): string; export declare function getProviderDefaultModelForWorkload(provider: ProviderName, workload: ModelRecommendationUseCase | ModelWorkloadClass, context?: Omit): string; export declare function getProviderDefaultModel(provider: ProviderName, request?: Partial, context?: Omit): string; export declare function getCatalogEntry(model: string): ModelCatalogEntry | undefined; export declare function getProviderForCatalogModel(model: string): ProviderName | null; /** * All providers that serve this exact model string, ordered by * `PROVIDER_FALLBACK_ORDER`. Some model strings are hosted by more than one * provider (e.g. `openai/gpt-oss-120b` runs on both Cerebras and Groq); the * singular `getProviderForCatalogModel` returns only the first catalog match, * which hides the collision. Routing uses this plural form to choose a * configured / capability-matching provider deterministically. */ export declare function getProvidersForCatalogModel(model: string): ProviderName[]; /** * Whether a specific (model, provider) pair advertises a given built-in tool, * or any built-in tool when `tool` is omitted. Used to steer a built-in-tools * request to the capable provider when a model string is hosted by several. */ export declare function modelSupportsBuiltInTools(model: string, provider: ProviderName, tool?: string): boolean; /** * Pre-flight routing snapshot for a request. * * Gateways and agent orchestrators call this BEFORE dispatching to understand * what the catalog engine would do: which use-case tier the request falls into, * which model/provider would be selected, estimated token load, and any * lifecycle warnings on the target model. Pair with `metadata.useCase` on the * `LLMRequest` to pass the gateway's classification directly into the factory's * `resolveUseCase()` path so model selection stays catalog-driven at runtime. */ export interface RoutingInfo { /** Use case inferred from the request's tools, vision, and message length */ useCase: ModelRecommendationUseCase; /** Provider that would serve the request */ provider: ProviderName; /** Model string that would be selected */ model: string; /** Full catalog entry for the selected model, or undefined if not in catalog */ catalogEntry: ModelCatalogEntry | undefined; /** Heuristic input token estimate (~4 chars/token for English text) */ estimatedInputTokens: number; /** True if the request has tools attached or tool history in messages */ requiresTools: boolean; /** True if the request has image inputs */ requiresVision: boolean; /** True if request.stream is set */ requestsStreaming: boolean; /** Catalog lifecycle of the target model */ modelLifecycle: ModelLifecycle | 'unknown'; /** * Human-readable deprecation warning if the target model is not on active * lifecycle, or if its catalog description contains a deprecation date. * Undefined when the model is active with no known end-of-life date. */ deprecationWarning: string | undefined; } /** * Return a routing snapshot for a request without dispatching it. * * @param request - The request to analyse (may be partial; model optional). * @param availableProviders - Providers to consider. Defaults to the full * fallback order. Pass the list of actually-configured providers for an * accurate recommendation. * @param context - Optional health and ledger context for ranking. */ export declare function getRoutingInfo(request: Partial, availableProviders?: ProviderName[], context?: ModelSelectionContext): RoutingInfo; export declare const MODEL_RECOMMENDATIONS: { readonly COST_EFFECTIVE: string[]; readonly HIGH_PERFORMANCE: string[]; readonly BALANCED: string[]; readonly TOOL_CALLING: string[]; readonly LONG_CONTEXT: string[]; readonly VISION: string[]; readonly RESEARCH: string[]; }; export {}; //# sourceMappingURL=model-catalog.d.ts.map