UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

54 lines (53 loc) 2.35 kB
/** * Context Window Registry * * Accurate per-provider, per-model context window sizes (INPUT token limits). * These are distinct from OUTPUT token limits in tokens.ts. * * Sources: * - Anthropic: https://docs.anthropic.com/en/docs/about-claude/models * - OpenAI: https://platform.openai.com/docs/models * - Google: https://ai.google.dev/gemini-api/docs/models * - Others: Provider documentation as of Feb 2026 */ /** Default context window when provider/model is unknown */ export declare const DEFAULT_CONTEXT_WINDOW = 128000; /** Maximum output reserve when maxTokens not specified */ export declare const MAX_DEFAULT_OUTPUT_RESERVE = 64000; /** Default output reserve ratio (35% of context) */ export declare const DEFAULT_OUTPUT_RESERVE_RATIO = 0.35; /** * Per-provider, per-model context window sizes. * The "_default" key is the fallback for unknown models within a provider. */ export declare const MODEL_CONTEXT_WINDOWS: Record<string, Record<string, number>>; /** * Resolve context window size for a provider/model combination. * * Priority: * 0. Dynamic model registry (DynamicModelProvider) — resolves cross-provider * models (e.g. Claude on Vertex) that the static table cannot handle * 1. Exact model match under provider in static registry * 2. Prefix match under provider in static registry * 3. Provider's _default in static registry * 4. Global DEFAULT_CONTEXT_WINDOW */ export declare function getContextWindowSize(provider: string, model?: string): number; /** * Calculate output token reserve for a given context window. * * Returns the *real* token count that will be reserved for output so callers * (`getAvailableInputTokens`, `BudgetChecker`, conversation-memory pruning, file * summarisation) compute input budget against the actual outgoing maxTokens. * * @param contextWindow - Total context window size * @param maxTokens - Explicit maxTokens from user config (if set) * @returns Number of tokens reserved for output (matches what's sent upstream) */ export declare function getOutputReserve(contextWindow: number, maxTokens?: number): number; /** * Calculate available input tokens for a given provider/model. * * available = contextWindow - outputReserve */ export declare function getAvailableInputTokens(provider: string, model?: string, maxTokens?: number): number;