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

269 lines (268 loc) 9.18 kB
/** * Anthropic Models - Subscription Tier Access and Capabilities * * This module defines Anthropic Claude models, their availability by subscription tier, * model capabilities, and provides helper functions for tier-based access control. */ import type { ClaudeSubscriptionTier, AnthropicModelMetadata } from "../types/index.js"; import { ModelAccessError } from "../types/index.js"; export { ModelAccessError }; /** * Anthropic Claude model identifiers * * @description Enum of all available Claude models with their exact API identifiers. * Models are organized by family (Haiku, Sonnet, Opus) and version. */ export declare enum AnthropicModel { CLAUDE_3_HAIKU = "claude-3-haiku-20240307", CLAUDE_3_5_HAIKU = "claude-3-5-haiku-20241022", CLAUDE_3_5_SONNET = "claude-3-5-sonnet-20241022", CLAUDE_3_5_SONNET_V2 = "claude-3-5-sonnet-v2-20241022", CLAUDE_SONNET_4 = "claude-sonnet-4-20250514", CLAUDE_SONNET_4_6 = "claude-sonnet-4-6", CLAUDE_3_OPUS = "claude-3-opus-20240229", CLAUDE_OPUS_4 = "claude-opus-4-20250514", CLAUDE_OPUS_4_6 = "claude-opus-4-6" } /** * Model access mapping by subscription tier * * Each tier includes progressively more models: * - free: Basic models for casual use (Haiku only) * - pro: Professional tier with Sonnet models * - max: All models including the latest flagship Opus * - api: Full API access to all models (based on API access) */ export declare const MODEL_TIER_ACCESS: Record<ClaudeSubscriptionTier, string[]>; /** * Model metadata by model ID * * Comprehensive mapping of each Anthropic model's metadata, * including display names, context windows, vision support, and extended thinking. */ export declare const MODEL_METADATA: Record<string, AnthropicModelMetadata>; /** * Default model for each subscription tier * * These are the recommended default models that provide the best * balance of capability and cost for each tier level. */ export declare const DEFAULT_MODELS_BY_TIER: Record<ClaudeSubscriptionTier, string>; /** * Check if a model is available for a given subscription tier * * @param model - The model ID to check (can be enum value or string) * @param tier - The subscription tier to check against * @returns true if the model is available for the tier * * @example * ```typescript * if (isModelAvailableForTier(AnthropicModel.CLAUDE_OPUS_4, "pro")) { * // Model not available for pro tier * } * * if (isModelAvailableForTier(AnthropicModel.CLAUDE_OPUS_4, "max")) { * // Model available for max tier * } * ``` */ export declare function isModelAvailableForTier(model: string, tier: ClaudeSubscriptionTier): boolean; /** * Get all models available for a given subscription tier * * @param tier - The subscription tier * @returns Array of model IDs available for the tier * * @example * ```typescript * const models = getAvailableModelsForTier("pro"); * console.log(models); * // ["claude-3-haiku-20240307", "claude-3-5-haiku-20241022", "claude-3-5-sonnet-20241022", ...] * ``` */ export declare function getAvailableModelsForTier(tier: ClaudeSubscriptionTier): string[]; /** * Get the human-readable display name for a model * * @param model - The model ID * @returns The display name, or the model ID if not found * * @example * ```typescript * const name = getModelDisplayName(AnthropicModel.CLAUDE_OPUS_4); * console.log(name); // "Claude Opus 4" * * const unknown = getModelDisplayName("unknown-model"); * console.log(unknown); // "unknown-model" * ``` */ export declare function getModelDisplayName(model: string): string; /** * Get the default/recommended model for a given subscription tier * * Returns the best default model that should be used for each tier. * * @param tier - The subscription tier * @returns The default model ID for the tier * * @example * ```typescript * const model = getDefaultModelForTier("max"); * console.log(model); // "claude-opus-4-20250514" * * const proModel = getDefaultModelForTier("pro"); * console.log(proModel); // "claude-sonnet-4-20250514" * ``` */ export declare function getDefaultModelForTier(tier: ClaudeSubscriptionTier): string; /** * Get metadata for a specific model * * @param model - The model ID * @returns The model metadata, or undefined if not found * * @example * ```typescript * const metadata = getModelMetadata(AnthropicModel.CLAUDE_OPUS_4); * if (metadata?.supportsExtendedThinking) { * // Enable extended thinking mode * } * ``` */ export declare function getModelMetadata(model: string): AnthropicModelMetadata | undefined; /** * Check if a model supports a specific capability * * @param model - The model ID * @param capability - The capability to check * @returns true if the model supports the capability * * @example * ```typescript * if (modelSupportsCapability(AnthropicModel.CLAUDE_OPUS_4, "supportsExtendedThinking")) { * // Use extended thinking * } * ``` */ export declare function modelSupportsCapability(model: string, capability: keyof Omit<AnthropicModelMetadata, "displayName" | "description" | "family">): boolean; /** * Get the minimum subscription tier required for a model * * @param model - The model ID to check * @returns The minimum tier required, or "api" if model not found * * @example * ```typescript * const tier = getMinimumTierForModel(AnthropicModel.CLAUDE_OPUS_4); * console.log(tier); // "max" * * const haikuTier = getMinimumTierForModel(AnthropicModel.CLAUDE_3_HAIKU); * console.log(haikuTier); // "free" * ``` */ export declare function getMinimumTierForModel(model: string): ClaudeSubscriptionTier; /** * Get all models that support a specific capability * * @param capability - The capability to filter by * @returns Array of model IDs that have the capability * * @example * ```typescript * const thinkingModels = getModelsWithCapability("supportsExtendedThinking"); * console.log(thinkingModels); * // ["claude-sonnet-4-20250514", "claude-opus-4-20250514"] * ``` */ export declare function getModelsWithCapability(capability: keyof Omit<AnthropicModelMetadata, "displayName" | "description" | "family">): string[]; /** * Get models filtered by family (haiku, sonnet, opus) * * @param family - The model family to filter by * @returns Array of model IDs in the specified family * * @example * ```typescript * const opusModels = getModelsByFamily("opus"); * // ["claude-3-opus-20240229", "claude-opus-4-20250514"] * ``` */ export declare function getModelsByFamily(family: AnthropicModelMetadata["family"]): string[]; /** * Get the latest (non-deprecated) model in each family * * @returns Object mapping family name to the latest model in that family * * @example * ```typescript * const latest = getLatestModelsByFamily(); * console.log(latest.opus); // "claude-opus-4-20250514" * console.log(latest.sonnet); // "claude-sonnet-4-20250514" * ``` */ export declare function getLatestModelsByFamily(): Record<AnthropicModelMetadata["family"], string | undefined>; /** * Validate that a model is accessible for a given tier, throwing if not * * @param model - The model ID to validate * @param tier - The subscription tier to validate against * @throws {ModelAccessError} If the model is not available for the tier * * @example * ```typescript * try { * validateModelAccess(AnthropicModel.CLAUDE_OPUS_4, "free"); * } catch (error) { * if (error instanceof ModelAccessError) { * console.log(`Upgrade to ${error.requiredTier} to use this model`); * } * } * ``` */ export declare function validateModelAccess(model: string, tier: ClaudeSubscriptionTier): void; /** * Compare subscription tiers * * @param tier1 - First tier to compare * @param tier2 - Second tier to compare * @returns Negative if tier1 < tier2, positive if tier1 > tier2, 0 if equal */ export declare function compareTiers(tier1: ClaudeSubscriptionTier, tier2: ClaudeSubscriptionTier): number; /** * Get context window size for a model * * @param model - The model ID * @returns The context window size in tokens, or 0 if model not found */ export declare function getContextWindow(model: string): number; /** * Get max output tokens for a model * * @param model - The model ID * @returns The max output tokens, or 0 if model not found */ export declare function getMaxOutputTokens(model: string): number; /** * Check if a model supports vision/image input * * @param model - The model ID * @returns true if the model supports vision */ export declare function supportsVision(model: string): boolean; /** * Check if a model supports extended thinking * * @param model - The model ID * @returns true if the model supports extended thinking */ export declare function supportsExtendedThinking(model: string): boolean; /** * Alias for getDefaultModelForTier for backward compatibility * @deprecated Use getDefaultModelForTier instead */ export declare const getRecommendedModelForTier: typeof getDefaultModelForTier; /** * Alias for getModelMetadata for backward compatibility * @deprecated Use getModelMetadata instead */ export declare const getModelCapabilities: typeof getModelMetadata;