UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

35 lines (34 loc) • 1.84 kB
import type { FallbackEntry, ModelMapping, ProxyRoutingConfig, RouteResult } from "../types/index.js"; /** Accepted range for an explicitly configured OAuth account admission cap. */ export declare const MIN_MAX_INFLIGHT_PER_ACCOUNT = 1; export declare const MAX_MAX_INFLIGHT_PER_ACCOUNT = 20; /** * The single definition of "a usable admission cap": an integer inside the * accepted range. Anything else — `0`, `1.5`, `21`, `NaN` — means unlimited. * * `parseProxyConfig()` already drops invalid YAML values, but `ProxyRoutingConfig` * is an exported type, so a programmatic caller can hand `ModelRouter` a value * that never passed through it. Without this, `getMaxInflightPerAccount()` would * report a bound (`0`, `21`) that the admission path ignores as unlimited, and * the two would disagree about whether the account is capped. */ export declare function normalizeMaxInflightPerAccount(capacity: number | undefined): number | undefined; export declare class ModelRouter { private readonly mappings; private readonly passthrough; private readonly fallback; private readonly autoFallback; private readonly maxInflightPerAccount; constructor(config: ProxyRoutingConfig); resolve(requestedModel: string): RouteResult; isClaudeTarget(requestedModel: string): boolean; getFallbackChain(): FallbackEntry[]; /** Whether translation-layer auto-provider fallback is explicitly enabled. */ isAutoFallbackEnabled(): boolean; /** Explicit per-account admission cap, or undefined when admission is unlimited. */ getMaxInflightPerAccount(): number | undefined; /** Return the raw model mapping entries (used by /v1/models). */ getModelMappings(): ModelMapping[]; /** Return models configured for passthrough (used by /v1/models). */ getPassthroughModels(): string[]; }