import type { RouterContext, RouteDecision } from './types.js'; /** * Ranks configured providers' models for a request routed as `auto`. * * Everything that depends only on configuration — which models are candidates, which pass the * allow and deny lists and the capability requirements, and how each scores for the strategy — is * computed once into a plan and kept until the configuration changes. A request pays only for what * can differ between requests: which circuits are open, and provider health. */ export declare class AutoRouter { private readonly plans; private readonly patterns; private readonly registryIds; /** Routes one request: the best candidate first, every other as a fallback in order. */ route(ctx: RouterContext): RouteDecision; /** Plans cached by this router, for tests and diagnostics. */ get planCount(): number; /** The plan for a request's configuration, built on first use and kept until the configuration changes. */ private plan; /** * What a plan depends on, normalized into a string: the routing settings, the model settings, and * the configured providers. A registry is identified by its object, so replacing * `models.registry` builds a new plan; changing one in place does not. */ private planKey; private registryId; private buildPlan; /** * The plan's candidates in order for this request. Providers whose circuit is open are left out, * unless that would leave nothing: every circuit open usually means a shared dependency is down, * and one attempt is strictly better than failing without trying. Health moves a whole provider * up or down, so the per-provider lists are merged by their adjusted scores rather than re-sorted. */ private rank; private getCandidates; /** * Scores a model for a strategy. For privacy, a model counts as local when its name says so or when * its provider was configured with `isLocal`, which is how a self-hosted OpenAI-compatible server * is preferred without renaming its models. */ private score; private capabilitiesOf; private localFallbackCapabilities; private costScore; private speedScore; private qualityScore; private preferencesForProvider; private isAllowed; /** Whether a model meets the routing requirements: the boolean ones as two bitmask tests, the rest by value. */ private matchesRequirements; /** Whether a model name matches an allow or deny entry, with `*` as a wildcard. Patterns are compiled once. */ private matchesModelPattern; private isProviderRunnable; /** Each provider's health adjustment for this request, or nothing when health does not apply. */ private healthOffsets; } export declare function routeDirectModel(model: string, ctx: RouterContext): RouteDecision;