@juspay/neurolink 9.14.0 → 9.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +15 -15
- package/dist/auth/anthropicOAuth.d.ts +377 -0
- package/dist/auth/anthropicOAuth.js +914 -0
- package/dist/auth/index.d.ts +20 -0
- package/dist/auth/index.js +29 -0
- package/dist/auth/tokenStore.d.ts +225 -0
- package/dist/auth/tokenStore.js +521 -0
- package/dist/cli/commands/auth.d.ts +50 -0
- package/dist/cli/commands/auth.js +1115 -0
- package/dist/cli/factories/authCommandFactory.d.ts +52 -0
- package/dist/cli/factories/authCommandFactory.js +146 -0
- package/dist/cli/factories/commandFactory.d.ts +6 -0
- package/dist/cli/factories/commandFactory.js +92 -2
- package/dist/cli/parser.js +11 -2
- package/dist/constants/enums.d.ts +20 -0
- package/dist/constants/enums.js +30 -0
- package/dist/constants/index.d.ts +3 -1
- package/dist/constants/index.js +11 -1
- package/dist/index.d.ts +1 -1
- package/dist/lib/auth/anthropicOAuth.d.ts +377 -0
- package/dist/lib/auth/anthropicOAuth.js +915 -0
- package/dist/lib/auth/index.d.ts +20 -0
- package/dist/lib/auth/index.js +30 -0
- package/dist/lib/auth/tokenStore.d.ts +225 -0
- package/dist/lib/auth/tokenStore.js +522 -0
- package/dist/lib/constants/enums.d.ts +20 -0
- package/dist/lib/constants/enums.js +30 -0
- package/dist/lib/constants/index.d.ts +3 -1
- package/dist/lib/constants/index.js +11 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/models/anthropicModels.d.ts +267 -0
- package/dist/lib/models/anthropicModels.js +528 -0
- package/dist/lib/providers/anthropic.d.ts +123 -2
- package/dist/lib/providers/anthropic.js +800 -10
- package/dist/lib/types/errors.d.ts +62 -0
- package/dist/lib/types/errors.js +107 -0
- package/dist/lib/types/index.d.ts +2 -1
- package/dist/lib/types/index.js +2 -0
- package/dist/lib/types/providers.d.ts +107 -0
- package/dist/lib/types/providers.js +69 -0
- package/dist/lib/types/subscriptionTypes.d.ts +893 -0
- package/dist/lib/types/subscriptionTypes.js +8 -0
- package/dist/lib/utils/providerConfig.d.ts +167 -0
- package/dist/lib/utils/providerConfig.js +619 -9
- package/dist/models/anthropicModels.d.ts +267 -0
- package/dist/models/anthropicModels.js +527 -0
- package/dist/providers/anthropic.d.ts +123 -2
- package/dist/providers/anthropic.js +800 -10
- package/dist/types/errors.d.ts +62 -0
- package/dist/types/errors.js +107 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +2 -0
- package/dist/types/providers.d.ts +107 -0
- package/dist/types/providers.js +69 -0
- package/dist/types/subscriptionTypes.d.ts +893 -0
- package/dist/types/subscriptionTypes.js +7 -0
- package/dist/utils/providerConfig.d.ts +167 -0
- package/dist/utils/providerConfig.js +619 -9
- package/package.json +2 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anthropic Models - Subscription Tier Access and Capabilities
|
|
3
|
+
*
|
|
4
|
+
* This module defines Anthropic Claude models, their availability by subscription tier,
|
|
5
|
+
* model capabilities, and provides helper functions for tier-based access control.
|
|
6
|
+
*/
|
|
7
|
+
import type { ClaudeSubscriptionTier, AnthropicModelMetadata } from "../types/subscriptionTypes.js";
|
|
8
|
+
import { ModelAccessError } from "../types/errors.js";
|
|
9
|
+
export type { ClaudeSubscriptionTier, AnthropicModelMetadata };
|
|
10
|
+
export { ModelAccessError };
|
|
11
|
+
/**
|
|
12
|
+
* Anthropic Claude model identifiers
|
|
13
|
+
*
|
|
14
|
+
* @description Enum of all available Claude models with their exact API identifiers.
|
|
15
|
+
* Models are organized by family (Haiku, Sonnet, Opus) and version.
|
|
16
|
+
*/
|
|
17
|
+
export declare enum AnthropicModel {
|
|
18
|
+
CLAUDE_3_HAIKU = "claude-3-haiku-20240307",
|
|
19
|
+
CLAUDE_3_5_HAIKU = "claude-3-5-haiku-20241022",
|
|
20
|
+
CLAUDE_3_5_SONNET = "claude-3-5-sonnet-20241022",
|
|
21
|
+
CLAUDE_3_5_SONNET_V2 = "claude-3-5-sonnet-v2-20241022",
|
|
22
|
+
CLAUDE_SONNET_4 = "claude-sonnet-4-20250514",
|
|
23
|
+
CLAUDE_3_OPUS = "claude-3-opus-20240229",
|
|
24
|
+
CLAUDE_OPUS_4 = "claude-opus-4-20250514"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Model access mapping by subscription tier
|
|
28
|
+
*
|
|
29
|
+
* Each tier includes progressively more models:
|
|
30
|
+
* - free: Basic models for casual use (Haiku only)
|
|
31
|
+
* - pro: Professional tier with Sonnet models
|
|
32
|
+
* - max: All models including the latest flagship Opus
|
|
33
|
+
* - api: Full API access to all models (based on API access)
|
|
34
|
+
*/
|
|
35
|
+
export declare const MODEL_TIER_ACCESS: Record<ClaudeSubscriptionTier, string[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Model metadata by model ID
|
|
38
|
+
*
|
|
39
|
+
* Comprehensive mapping of each Anthropic model's metadata,
|
|
40
|
+
* including display names, context windows, vision support, and extended thinking.
|
|
41
|
+
*/
|
|
42
|
+
export declare const MODEL_METADATA: Record<string, AnthropicModelMetadata>;
|
|
43
|
+
/**
|
|
44
|
+
* Default model for each subscription tier
|
|
45
|
+
*
|
|
46
|
+
* These are the recommended default models that provide the best
|
|
47
|
+
* balance of capability and cost for each tier level.
|
|
48
|
+
*/
|
|
49
|
+
export declare const DEFAULT_MODELS_BY_TIER: Record<ClaudeSubscriptionTier, string>;
|
|
50
|
+
/**
|
|
51
|
+
* Check if a model is available for a given subscription tier
|
|
52
|
+
*
|
|
53
|
+
* @param model - The model ID to check (can be enum value or string)
|
|
54
|
+
* @param tier - The subscription tier to check against
|
|
55
|
+
* @returns true if the model is available for the tier
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* if (isModelAvailableForTier(AnthropicModel.CLAUDE_OPUS_4, "pro")) {
|
|
60
|
+
* // Model not available for pro tier
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* if (isModelAvailableForTier(AnthropicModel.CLAUDE_OPUS_4, "max")) {
|
|
64
|
+
* // Model available for max tier
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function isModelAvailableForTier(model: string, tier: ClaudeSubscriptionTier): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Get all models available for a given subscription tier
|
|
71
|
+
*
|
|
72
|
+
* @param tier - The subscription tier
|
|
73
|
+
* @returns Array of model IDs available for the tier
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const models = getAvailableModelsForTier("pro");
|
|
78
|
+
* console.log(models);
|
|
79
|
+
* // ["claude-3-haiku-20240307", "claude-3-5-haiku-20241022", "claude-3-5-sonnet-20241022", ...]
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare function getAvailableModelsForTier(tier: ClaudeSubscriptionTier): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Get the human-readable display name for a model
|
|
85
|
+
*
|
|
86
|
+
* @param model - The model ID
|
|
87
|
+
* @returns The display name, or the model ID if not found
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const name = getModelDisplayName(AnthropicModel.CLAUDE_OPUS_4);
|
|
92
|
+
* console.log(name); // "Claude Opus 4"
|
|
93
|
+
*
|
|
94
|
+
* const unknown = getModelDisplayName("unknown-model");
|
|
95
|
+
* console.log(unknown); // "unknown-model"
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function getModelDisplayName(model: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* Get the default/recommended model for a given subscription tier
|
|
101
|
+
*
|
|
102
|
+
* Returns the best default model that should be used for each tier.
|
|
103
|
+
*
|
|
104
|
+
* @param tier - The subscription tier
|
|
105
|
+
* @returns The default model ID for the tier
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const model = getDefaultModelForTier("max");
|
|
110
|
+
* console.log(model); // "claude-opus-4-20250514"
|
|
111
|
+
*
|
|
112
|
+
* const proModel = getDefaultModelForTier("pro");
|
|
113
|
+
* console.log(proModel); // "claude-sonnet-4-20250514"
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function getDefaultModelForTier(tier: ClaudeSubscriptionTier): string;
|
|
117
|
+
/**
|
|
118
|
+
* Get metadata for a specific model
|
|
119
|
+
*
|
|
120
|
+
* @param model - The model ID
|
|
121
|
+
* @returns The model metadata, or undefined if not found
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* const metadata = getModelMetadata(AnthropicModel.CLAUDE_OPUS_4);
|
|
126
|
+
* if (metadata?.supportsExtendedThinking) {
|
|
127
|
+
* // Enable extended thinking mode
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare function getModelMetadata(model: string): AnthropicModelMetadata | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Check if a model supports a specific capability
|
|
134
|
+
*
|
|
135
|
+
* @param model - The model ID
|
|
136
|
+
* @param capability - The capability to check
|
|
137
|
+
* @returns true if the model supports the capability
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* if (modelSupportsCapability(AnthropicModel.CLAUDE_OPUS_4, "supportsExtendedThinking")) {
|
|
142
|
+
* // Use extended thinking
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export declare function modelSupportsCapability(model: string, capability: keyof Omit<AnthropicModelMetadata, "displayName" | "description" | "family">): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Get the minimum subscription tier required for a model
|
|
149
|
+
*
|
|
150
|
+
* @param model - The model ID to check
|
|
151
|
+
* @returns The minimum tier required, or "api" if model not found
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* const tier = getMinimumTierForModel(AnthropicModel.CLAUDE_OPUS_4);
|
|
156
|
+
* console.log(tier); // "max"
|
|
157
|
+
*
|
|
158
|
+
* const haikuTier = getMinimumTierForModel(AnthropicModel.CLAUDE_3_HAIKU);
|
|
159
|
+
* console.log(haikuTier); // "free"
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export declare function getMinimumTierForModel(model: string): ClaudeSubscriptionTier;
|
|
163
|
+
/**
|
|
164
|
+
* Get all models that support a specific capability
|
|
165
|
+
*
|
|
166
|
+
* @param capability - The capability to filter by
|
|
167
|
+
* @returns Array of model IDs that have the capability
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const thinkingModels = getModelsWithCapability("supportsExtendedThinking");
|
|
172
|
+
* console.log(thinkingModels);
|
|
173
|
+
* // ["claude-sonnet-4-20250514", "claude-opus-4-20250514"]
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
export declare function getModelsWithCapability(capability: keyof Omit<AnthropicModelMetadata, "displayName" | "description" | "family">): string[];
|
|
177
|
+
/**
|
|
178
|
+
* Get models filtered by family (haiku, sonnet, opus)
|
|
179
|
+
*
|
|
180
|
+
* @param family - The model family to filter by
|
|
181
|
+
* @returns Array of model IDs in the specified family
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const opusModels = getModelsByFamily("opus");
|
|
186
|
+
* // ["claude-3-opus-20240229", "claude-opus-4-20250514"]
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
export declare function getModelsByFamily(family: AnthropicModelMetadata["family"]): string[];
|
|
190
|
+
/**
|
|
191
|
+
* Get the latest (non-deprecated) model in each family
|
|
192
|
+
*
|
|
193
|
+
* @returns Object mapping family name to the latest model in that family
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const latest = getLatestModelsByFamily();
|
|
198
|
+
* console.log(latest.opus); // "claude-opus-4-20250514"
|
|
199
|
+
* console.log(latest.sonnet); // "claude-sonnet-4-20250514"
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
export declare function getLatestModelsByFamily(): Record<AnthropicModelMetadata["family"], string | undefined>;
|
|
203
|
+
/**
|
|
204
|
+
* Validate that a model is accessible for a given tier, throwing if not
|
|
205
|
+
*
|
|
206
|
+
* @param model - The model ID to validate
|
|
207
|
+
* @param tier - The subscription tier to validate against
|
|
208
|
+
* @throws {ModelAccessError} If the model is not available for the tier
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* try {
|
|
213
|
+
* validateModelAccess(AnthropicModel.CLAUDE_OPUS_4, "free");
|
|
214
|
+
* } catch (error) {
|
|
215
|
+
* if (error instanceof ModelAccessError) {
|
|
216
|
+
* console.log(`Upgrade to ${error.requiredTier} to use this model`);
|
|
217
|
+
* }
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
export declare function validateModelAccess(model: string, tier: ClaudeSubscriptionTier): void;
|
|
222
|
+
/**
|
|
223
|
+
* Compare subscription tiers
|
|
224
|
+
*
|
|
225
|
+
* @param tier1 - First tier to compare
|
|
226
|
+
* @param tier2 - Second tier to compare
|
|
227
|
+
* @returns Negative if tier1 < tier2, positive if tier1 > tier2, 0 if equal
|
|
228
|
+
*/
|
|
229
|
+
export declare function compareTiers(tier1: ClaudeSubscriptionTier, tier2: ClaudeSubscriptionTier): number;
|
|
230
|
+
/**
|
|
231
|
+
* Get context window size for a model
|
|
232
|
+
*
|
|
233
|
+
* @param model - The model ID
|
|
234
|
+
* @returns The context window size in tokens, or 0 if model not found
|
|
235
|
+
*/
|
|
236
|
+
export declare function getContextWindow(model: string): number;
|
|
237
|
+
/**
|
|
238
|
+
* Get max output tokens for a model
|
|
239
|
+
*
|
|
240
|
+
* @param model - The model ID
|
|
241
|
+
* @returns The max output tokens, or 0 if model not found
|
|
242
|
+
*/
|
|
243
|
+
export declare function getMaxOutputTokens(model: string): number;
|
|
244
|
+
/**
|
|
245
|
+
* Check if a model supports vision/image input
|
|
246
|
+
*
|
|
247
|
+
* @param model - The model ID
|
|
248
|
+
* @returns true if the model supports vision
|
|
249
|
+
*/
|
|
250
|
+
export declare function supportsVision(model: string): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Check if a model supports extended thinking
|
|
253
|
+
*
|
|
254
|
+
* @param model - The model ID
|
|
255
|
+
* @returns true if the model supports extended thinking
|
|
256
|
+
*/
|
|
257
|
+
export declare function supportsExtendedThinking(model: string): boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Alias for getDefaultModelForTier for backward compatibility
|
|
260
|
+
* @deprecated Use getDefaultModelForTier instead
|
|
261
|
+
*/
|
|
262
|
+
export declare const getRecommendedModelForTier: typeof getDefaultModelForTier;
|
|
263
|
+
/**
|
|
264
|
+
* Alias for getModelMetadata for backward compatibility
|
|
265
|
+
* @deprecated Use getModelMetadata instead
|
|
266
|
+
*/
|
|
267
|
+
export declare const getModelCapabilities: typeof getModelMetadata;
|