@juspay/neurolink 13.16.2 → 13.17.1

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.
Files changed (126) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/dist/adapters/providerImageAdapter.js +29 -495
  3. package/dist/browser/neurolink.min.js +465 -471
  4. package/dist/constants/contextWindows.js +13 -328
  5. package/dist/constants/enums.d.ts +1 -0
  6. package/dist/constants/enums.js +2 -1
  7. package/dist/context/anthropicLoopGuard.d.ts +1 -1
  8. package/dist/context/anthropicLoopGuard.js +2 -1
  9. package/dist/core/constants.js +6 -53
  10. package/dist/core/geminiLoopAdapter.js +8 -6
  11. package/dist/core/modules/structuredOutputPolicy.d.ts +0 -21
  12. package/dist/core/modules/structuredOutputPolicy.js +4 -54
  13. package/dist/core/nativeGenerateLoop.js +5 -0
  14. package/dist/factories/providerDescriptors.js +3 -2
  15. package/dist/factories/providerRegistry.js +3 -2
  16. package/dist/models/manifests/anthropic.d.ts +1 -1
  17. package/dist/models/manifests/anthropic.js +1 -1
  18. package/dist/models/manifests/azure.js +9 -9
  19. package/dist/models/manifests/ollama.js +13 -0
  20. package/dist/models/manifests/openai.d.ts +1 -1
  21. package/dist/models/manifests/openai.js +1 -1
  22. package/dist/models/modelRegistry.js +25 -42
  23. package/dist/neurolink.js +1 -0
  24. package/dist/providers/amazonBedrock/client.js +9 -37
  25. package/dist/providers/amazonBedrock/loopAdapter.js +3 -11
  26. package/dist/providers/amazonSagemaker.js +6 -0
  27. package/dist/providers/anthropic/client.js +57 -100
  28. package/dist/providers/anthropic/loopAdapter.js +24 -22
  29. package/dist/providers/anthropic/structuredOutput.d.ts +0 -2
  30. package/dist/providers/anthropic/structuredOutput.js +3 -5
  31. package/dist/providers/azureOpenai.js +4 -22
  32. package/dist/providers/catalog/loader.js +12 -25
  33. package/dist/providers/cohere.js +5 -30
  34. package/dist/providers/googleAiStudio/client.js +12 -61
  35. package/dist/providers/googleNativeGemini3/utils.js +43 -102
  36. package/dist/providers/googleVertex/client.d.ts +7 -0
  37. package/dist/providers/googleVertex/client.js +150 -192
  38. package/dist/providers/litellm/client.js +10 -50
  39. package/dist/providers/llamaCpp.js +4 -15
  40. package/dist/providers/lmStudio.js +9 -14
  41. package/dist/providers/nvidiaNim/client.js +4 -62
  42. package/dist/providers/ollama/client.js +14 -54
  43. package/dist/providers/ollama/constants.d.ts +1 -3
  44. package/dist/providers/ollama/constants.js +2 -3
  45. package/dist/providers/openAI/client.js +5 -57
  46. package/dist/providers/openRouter/client.js +4 -65
  47. package/dist/providers/openaiChatCompletionsBase.js +53 -62
  48. package/dist/providers/openaiChatCompletionsClient.js +17 -57
  49. package/dist/providers/openaiCompatible/client.js +9 -36
  50. package/dist/providers/rules/README.md +100 -0
  51. package/dist/providers/rules/anthropic.json +108 -0
  52. package/dist/providers/rules/azure.json +13 -0
  53. package/dist/providers/rules/bedrock.json +48 -0
  54. package/dist/providers/rules/cohere.json +32 -0
  55. package/dist/providers/rules/credentials.json +34 -0
  56. package/dist/providers/rules/errorRules.d.ts +17 -0
  57. package/dist/providers/rules/errorRules.js +197 -0
  58. package/dist/providers/rules/errorSignals.d.ts +2 -0
  59. package/dist/providers/rules/errorSignals.js +28 -0
  60. package/dist/providers/rules/fallbackModel.d.ts +4 -0
  61. package/dist/providers/rules/fallbackModel.js +21 -0
  62. package/dist/providers/rules/finalResultTool.d.ts +11 -0
  63. package/dist/providers/rules/finalResultTool.js +17 -0
  64. package/dist/providers/rules/finishReasons.d.ts +10 -0
  65. package/dist/providers/rules/finishReasons.js +28 -0
  66. package/dist/providers/rules/gemini.json +92 -0
  67. package/dist/providers/rules/google-ai.json +55 -0
  68. package/dist/providers/rules/limits.json +338 -0
  69. package/dist/providers/rules/litellm.json +36 -0
  70. package/dist/providers/rules/llamacpp.json +23 -0
  71. package/dist/providers/rules/lm-studio.json +21 -0
  72. package/dist/providers/rules/model-families.json +115 -0
  73. package/dist/providers/rules/modelFamilies.d.ts +10 -0
  74. package/dist/providers/rules/modelFamilies.js +45 -0
  75. package/dist/providers/rules/nvidia-nim.json +43 -0
  76. package/dist/providers/rules/ollama.json +37 -0
  77. package/dist/providers/rules/openai-chat.json +66 -0
  78. package/dist/providers/rules/openai-compatible.json +31 -0
  79. package/dist/providers/rules/openai.json +38 -0
  80. package/dist/providers/rules/openrouter.json +57 -0
  81. package/dist/providers/rules/proxy.json +44 -0
  82. package/dist/providers/rules/registry.d.ts +7 -0
  83. package/dist/providers/rules/registry.js +76 -0
  84. package/dist/providers/rules/requestDefaults.d.ts +7 -0
  85. package/dist/providers/rules/requestDefaults.js +9 -0
  86. package/dist/providers/rules/requestFields.d.ts +21 -0
  87. package/dist/providers/rules/requestFields.js +42 -0
  88. package/dist/providers/rules/sagemaker.json +88 -0
  89. package/dist/providers/rules/schema.d.ts +242 -0
  90. package/dist/providers/rules/schema.js +359 -0
  91. package/dist/providers/rules/structured-output.json +36 -0
  92. package/dist/providers/rules/thinkingLimits.d.ts +7 -0
  93. package/dist/providers/rules/thinkingLimits.js +9 -0
  94. package/dist/providers/rules/toolRules.d.ts +16 -0
  95. package/dist/providers/rules/toolRules.js +95 -0
  96. package/dist/providers/rules/usage.json +51 -0
  97. package/dist/providers/rules/vertex.json +65 -0
  98. package/dist/providers/rules/vision.json +505 -0
  99. package/dist/providers/rules/wireUsage.d.ts +38 -0
  100. package/dist/providers/rules/wireUsage.js +82 -0
  101. package/dist/providers/sagemaker/language-model.js +6 -33
  102. package/dist/providers/sagemaker/parsers.js +13 -48
  103. package/dist/providers/sagemaker/streaming.js +9 -16
  104. package/dist/proxy/claudeFormat.js +3 -16
  105. package/dist/proxy/geminiFormat.js +3 -9
  106. package/dist/proxy/openaiFormat.js +3 -16
  107. package/dist/types/generate.d.ts +2 -0
  108. package/dist/types/index.d.ts +1 -0
  109. package/dist/types/index.js +2 -0
  110. package/dist/types/providerRules.d.ts +414 -0
  111. package/dist/types/providerRules.js +10 -0
  112. package/dist/utils/errorClassifier.d.ts +2 -2
  113. package/dist/utils/errorClassifier.js +3 -2
  114. package/dist/utils/modelDetection.d.ts +1 -1
  115. package/dist/utils/modelDetection.js +30 -71
  116. package/dist/utils/providerConfig.d.ts +10 -9
  117. package/dist/utils/providerConfig.js +26 -25
  118. package/dist/utils/providerHealth.js +1 -0
  119. package/dist/utils/thinkingConfig.d.ts +1 -1
  120. package/dist/utils/thinkingConfig.js +8 -8
  121. package/dist/utils/tokenUtils.d.ts +12 -38
  122. package/dist/utils/tokenUtils.js +44 -127
  123. package/docs-site/static/search-index.json +5 -5
  124. package/package.json +2 -1
  125. package/dist/providers/localRuntimeOpenAICompat.d.ts +0 -16
  126. package/dist/providers/localRuntimeOpenAICompat.js +0 -26
@@ -0,0 +1,338 @@
1
+ {
2
+ "$schema": "./provider-rules.schema.json",
3
+ "id": "limits",
4
+ "contextWindows": {
5
+ "nvidia-nim": {
6
+ "_default": 128000,
7
+ "meta/llama-3.3-70b-instruct": 128000,
8
+ "meta/llama-3.1-405b-instruct": 128000,
9
+ "meta/llama-3.1-70b-instruct": 128000,
10
+ "meta/llama-3.2-90b-vision-instruct": 128000,
11
+ "meta/llama-3.2-11b-vision-instruct": 128000,
12
+ "nvidia/llama-3.3-nemotron-super-49b-v1": 128000,
13
+ "nvidia/llama-3.1-nemotron-nano-8b-v1": 128000,
14
+ "nvidia/llama-3.1-nemotron-70b-instruct": 128000,
15
+ "deepseek-ai/deepseek-r1": 128000,
16
+ "deepseek-ai/deepseek-r1-distill-llama-70b": 128000,
17
+ "mistralai/mixtral-8x22b-instruct-v0.1": 65536,
18
+ "mistralai/mixtral-8x7b-instruct-v0.1": 32768,
19
+ "microsoft/phi-4": 16384,
20
+ "google/gemma-3-27b-it": 8192,
21
+ "openai/gpt-oss-20b": 131072
22
+ },
23
+ "lm-studio": {
24
+ "_default": 8192
25
+ },
26
+ "llamacpp": {
27
+ "_default": 8192
28
+ },
29
+ "cohere": {
30
+ "_default": 128000,
31
+ "command-r-plus": 128000,
32
+ "command-r": 128000,
33
+ "command-r7b-12-2024": 128000
34
+ },
35
+ "replicate": {
36
+ "_default": 32768
37
+ },
38
+ "voyage": {
39
+ "_default": 32000,
40
+ "voyage-4": 32000,
41
+ "voyage-4-large": 32000,
42
+ "voyage-4-lite": 32000,
43
+ "voyage-code-4": 32000,
44
+ "voyage-3.5": 32000,
45
+ "voyage-3.5-lite": 32000,
46
+ "voyage-3-large": 32000,
47
+ "voyage-code-3": 32000,
48
+ "voyage-finance-2": 32000,
49
+ "voyage-law-2": 16000,
50
+ "voyage-multilingual-2": 32000
51
+ },
52
+ "jina": {
53
+ "_default": 8192,
54
+ "jina-embeddings-v3": 8192,
55
+ "jina-embeddings-v2-base-en": 8192,
56
+ "jina-embeddings-v2-small-en": 8192,
57
+ "jina-colbert-v2": 32000
58
+ },
59
+ "stability": {
60
+ "_default": 2000
61
+ },
62
+ "ideogram": {
63
+ "_default": 2000
64
+ },
65
+ "recraft": {
66
+ "_default": 2000
67
+ },
68
+ "anthropic": {
69
+ "_default": 200000,
70
+ "claude-opus-5-5": 1000000,
71
+ "claude-sonnet-5-5": 1000000,
72
+ "claude-fable-5-1": 1000000,
73
+ "claude-sonnet-5": 1000000,
74
+ "claude-opus-5": 1000000,
75
+ "claude-fable-5": 1000000,
76
+ "claude-opus-4-8": 1000000,
77
+ "claude-opus-4-7": 1000000,
78
+ "claude-opus-4-6": 1000000,
79
+ "claude-sonnet-4-6": 1000000,
80
+ "claude-opus-4-5-20251101": 200000,
81
+ "claude-sonnet-4-5-20250929": 200000,
82
+ "claude-haiku-4-5-20251001": 200000,
83
+ "claude-opus-4-1-20250805": 200000,
84
+ "claude-opus-4-20250514": 200000,
85
+ "claude-sonnet-4-20250514": 200000,
86
+ "claude-3-7-sonnet-20250219": 200000,
87
+ "claude-3-5-sonnet-20241022": 200000,
88
+ "claude-3-5-haiku-20241022": 200000,
89
+ "claude-3-opus-20240229": 200000,
90
+ "claude-3-sonnet-20240229": 200000,
91
+ "claude-3-haiku-20240307": 200000
92
+ },
93
+ "openai": {
94
+ "_default": 128000,
95
+ "gpt-6-astra": 1050000,
96
+ "gpt-6-sol": 1050000,
97
+ "gpt-6-luna": 1050000,
98
+ "gpt-5.4": 1050000,
99
+ "gpt-5.4-mini": 400000,
100
+ "gpt-5.4-nano": 400000,
101
+ "gpt-5.4-pro": 1050000,
102
+ "gpt-5.3-codex": 400000,
103
+ "gpt-5.2": 400000,
104
+ "gpt-5.2-pro": 400000,
105
+ "gpt-5.2-codex": 400000,
106
+ "gpt-5.2-chat-latest": 128000,
107
+ "gpt-5.1": 400000,
108
+ "gpt-5.1-codex": 400000,
109
+ "gpt-5.1-codex-max": 400000,
110
+ "gpt-5.1-codex-mini": 400000,
111
+ "gpt-5.1-chat-latest": 128000,
112
+ "gpt-5": 400000,
113
+ "gpt-5-mini": 400000,
114
+ "gpt-5-nano": 400000,
115
+ "gpt-5-pro": 400000,
116
+ "gpt-5-codex": 400000,
117
+ "gpt-5-chat-latest": 128000,
118
+ "gpt-oss-120b": 128000,
119
+ "gpt-oss-20b": 128000,
120
+ "gpt-4.1": 1047576,
121
+ "gpt-4.1-mini": 1047576,
122
+ "gpt-4.1-nano": 1047576,
123
+ "gpt-4o": 128000,
124
+ "gpt-4o-mini": 128000,
125
+ "o1": 200000,
126
+ "o1-mini": 128000,
127
+ "o1-pro": 200000,
128
+ "o3": 200000,
129
+ "o3-mini": 200000,
130
+ "o3-pro": 200000,
131
+ "o4-mini": 200000,
132
+ "gpt-4-turbo": 128000,
133
+ "gpt-4": 8192,
134
+ "gpt-3.5-turbo": 16385
135
+ },
136
+ "google-ai": {
137
+ "_default": 1048576,
138
+ "gemini-3.1-pro-preview": 1048576,
139
+ "gemini-3.1-flash-lite-preview": 1048576,
140
+ "gemini-3.1-flash-image-preview": 1048576,
141
+ "gemini-3.1-pro-preview-customtools": 1048576,
142
+ "gemini-3-flash-preview": 1048576,
143
+ "gemini-3-pro-image-preview": 65536,
144
+ "gemini-3-pro-preview": 1048576,
145
+ "gemini-2.5-pro": 1048576,
146
+ "gemini-2.5-flash": 1048576,
147
+ "gemini-2.5-flash-lite": 1048576,
148
+ "gemini-2.5-flash-image": 32768,
149
+ "gemini-2.0-flash": 1048576,
150
+ "gemini-1.5-pro": 2097152,
151
+ "gemini-1.5-flash": 1048576
152
+ },
153
+ "vertex": {
154
+ "_default": 1048576,
155
+ "claude-opus-5-5": 1000000,
156
+ "claude-sonnet-5-5": 1000000,
157
+ "claude-fable-5-1": 1000000,
158
+ "claude-sonnet-5": 1000000,
159
+ "claude-opus-5": 1000000,
160
+ "claude-fable-5": 1000000,
161
+ "claude-opus-4-8": 1000000,
162
+ "claude-opus-4-7": 1000000,
163
+ "claude-opus-4-6": 1000000,
164
+ "claude-sonnet-4-6": 1000000,
165
+ "claude-sonnet-4-5": 200000,
166
+ "claude-opus-4-5": 200000,
167
+ "claude-haiku-4-5": 200000,
168
+ "claude-sonnet-4": 200000,
169
+ "claude-sonnet-4-20250514": 200000,
170
+ "claude-opus-4-20250514": 200000,
171
+ "claude-opus-4": 200000,
172
+ "claude-": 200000,
173
+ "gemini-3.1-pro-preview": 1048576,
174
+ "gemini-3.1-flash-lite-preview": 1048576,
175
+ "gemini-3.1-flash-image-preview": 1048576,
176
+ "gemini-3.1-pro-preview-customtools": 1048576,
177
+ "gemini-3-flash-preview": 1048576,
178
+ "gemini-3-pro-image-preview": 65536,
179
+ "gemini-3-pro-preview": 1048576,
180
+ "gemini-2.5-pro": 1048576,
181
+ "gemini-2.5-flash": 1048576,
182
+ "gemini-2.0-flash": 1048576,
183
+ "gemini-1.5-pro": 2097152,
184
+ "gemini-1.5-flash": 1048576
185
+ },
186
+ "bedrock": {
187
+ "_default": 200000,
188
+ "anthropic.claude-opus-5-5": 1000000,
189
+ "anthropic.claude-sonnet-5-5": 1000000,
190
+ "anthropic.claude-fable-5-1": 1000000,
191
+ "anthropic.claude-opus-4-6-v1": 1000000,
192
+ "anthropic.claude-sonnet-4-6": 1000000,
193
+ "anthropic.claude-opus-4-5-20251101-v1:0": 200000,
194
+ "anthropic.claude-sonnet-4-5-20250929-v1:0": 200000,
195
+ "anthropic.claude-haiku-4-5-20251001-v1:0": 200000,
196
+ "anthropic.claude-opus-4-1-20250805-v1:0": 200000,
197
+ "anthropic.claude-sonnet-4-20250514-v1:0": 200000,
198
+ "anthropic.claude-3-7-sonnet-20250219-v1:0": 200000,
199
+ "us.anthropic.claude-3-7-sonnet-20250219-v1:0": 200000,
200
+ "anthropic.claude-3-5-sonnet-20241022-v1:0": 200000,
201
+ "anthropic.claude-3-5-haiku-20241022-v1:0": 200000,
202
+ "anthropic.claude-3-opus-20240229-v1:0": 200000,
203
+ "anthropic.claude-3-sonnet-20240229-v1:0": 200000,
204
+ "anthropic.claude-3-haiku-20240307-v1:0": 200000,
205
+ "amazon.nova-pro-v1:0": 300000,
206
+ "amazon.nova-lite-v1:0": 300000,
207
+ "amazon.nova-2-lite-v1:0": 1000000,
208
+ "writer.palmyra-x5-v1:0": 1000000,
209
+ "writer.palmyra-x4-v1:0": 128000,
210
+ "nvidia.nemotron-nano-3-30b": 256000
211
+ },
212
+ "azure": {
213
+ "_default": 128000,
214
+ "gpt-6-astra": 1050000,
215
+ "gpt-6-sol": 1050000,
216
+ "gpt-6-luna": 1050000,
217
+ "gpt-5.6-sol": 1050000,
218
+ "gpt-5.6-terra": 1050000,
219
+ "gpt-5.6-luna": 1050000,
220
+ "gpt-5.5": 1050000,
221
+ "gpt-5.4": 1050000,
222
+ "gpt-5.4-mini": 400000,
223
+ "gpt-5.4-nano": 400000,
224
+ "gpt-5.4-pro": 1050000,
225
+ "gpt-5.2": 400000,
226
+ "gpt-5.2-pro": 400000,
227
+ "gpt-5.2-codex": 400000,
228
+ "gpt-5.1": 400000,
229
+ "gpt-5": 400000,
230
+ "gpt-5-mini": 400000,
231
+ "gpt-4.1": 1047576,
232
+ "gpt-4.1-mini": 1047576,
233
+ "gpt-4o": 128000,
234
+ "gpt-4o-mini": 128000,
235
+ "o3": 200000,
236
+ "o3-mini": 200000,
237
+ "o4-mini": 200000,
238
+ "gpt-4-turbo": 128000,
239
+ "gpt-4": 8192
240
+ },
241
+ "ollama": {
242
+ "_default": 128000
243
+ },
244
+ "litellm": {
245
+ "_default": 128000
246
+ },
247
+ "huggingface": {
248
+ "_default": 32000
249
+ },
250
+ "sagemaker": {
251
+ "_default": 128000,
252
+ "nvidia-nemotron-3-nano-30b": 1000000,
253
+ "qwen3-vl-8b-instruct": 32768
254
+ }
255
+ },
256
+ "contextWindowNotes": {
257
+ "replicate": {
258
+ "_default": "Per-model — Replicate hosts arbitrary models; sensible default."
259
+ },
260
+ "voyage": {
261
+ "_default": "Voyage embeddings: max input tokens vary 16K-32K per model"
262
+ },
263
+ "jina": {
264
+ "_default": "Jina embeddings: 8K input tokens for v3; 8K for v2; 32K for ColBERT-v2"
265
+ },
266
+ "stability": {
267
+ "_default": "Image-gen — context is prompt length only; ~2000 char limit"
268
+ },
269
+ "anthropic": {
270
+ "claude-opus-5-5": "Claude 5.5 / 5.1 (Sep 2026) — 1M context window, confirmed on platform.claude.com/docs/en/about-claude/models/overview",
271
+ "claude-sonnet-5": "Claude 5 (mid 2026) — 1M context window",
272
+ "claude-opus-4-8": "Claude 4.7 / 4.8 — 1M context window (platform.claude.com/docs/en/models)",
273
+ "claude-opus-4-6": "Claude 4.6 (Feb 2026) — 1M context window",
274
+ "claude-opus-4-5-20251101": "Claude 4.5",
275
+ "claude-opus-4-1-20250805": "Claude 4.x",
276
+ "claude-3-7-sonnet-20250219": "Claude 3.x"
277
+ },
278
+ "openai": {
279
+ "gpt-6-astra": "GPT-6 family (Sep 2026) — 1.05M context, per developers.openai.com/api/docs/models",
280
+ "gpt-5.4": "GPT-5.4 family — 1.05M context",
281
+ "gpt-5.3-codex": "GPT-5.x family — 400K context",
282
+ "gpt-oss-120b": "GPT Open Source",
283
+ "gpt-4.1": "GPT-4.1 family — 1M context",
284
+ "gpt-4o": "GPT-4o",
285
+ "o1": "O-series reasoning — 200K context",
286
+ "gpt-4-turbo": "Legacy"
287
+ },
288
+ "google-ai": {
289
+ "gemini-3.1-pro-preview": "Gemini 3.1 Series (all require -preview suffix)",
290
+ "gemini-3-flash-preview": "Gemini 3 Series",
291
+ "gemini-3-pro-preview": "@deprecated SHUT DOWN March 9, 2026. Migrate to gemini-3.1-pro-preview."
292
+ },
293
+ "vertex": {
294
+ "claude-opus-5-5": "Claude on Vertex",
295
+ "claude-opus-5": "Placed before the 200K `claude-opus-4` prefix key below: the lookup takes the first prefix that matches, so a dated `claude-opus-4-8@...` id would otherwise land on 200K.",
296
+ "claude-": "Catch-all for UNKNOWN Claude models on Vertex (prefix match runs after the specific keys above). Without this, an unlisted Claude model falls to the Gemini-shaped _default (1,048,576) — ABOVE Anthropic's real 1M API cap — so the pre-dispatch budget check and the in-loop context guard both under-guard it (the claude-sonnet-5 1,005,647-token 400s). 200K is the conservative Anthropic floor; list real models explicitly.",
297
+ "gemini-3.1-pro-preview": "Gemini 3.1 on Vertex (all require -preview suffix)",
298
+ "gemini-3-flash-preview": "Gemini 3 on Vertex",
299
+ "gemini-3-pro-preview": "@deprecated SHUT DOWN March 9, 2026. Migrate to gemini-3.1-pro-preview.",
300
+ "gemini-2.5-pro": "Gemini 2.x on Vertex"
301
+ },
302
+ "bedrock": {
303
+ "anthropic.claude-opus-5-5": "Claude 5.5 / 5.1 (Sep 2026)",
304
+ "anthropic.claude-opus-4-6-v1": "Claude 4.6",
305
+ "anthropic.claude-opus-4-5-20251101-v1:0": "Claude 4.5",
306
+ "anthropic.claude-opus-4-1-20250805-v1:0": "Claude 4.1 / 4 — the AWS Bedrock model cards state 200K tokens",
307
+ "anthropic.claude-3-7-sonnet-20250219-v1:0": "Claude legacy. AWS lists no model card for 3.7 Sonnet; 200K is the window of the same model in the Anthropic manifest. The `us.` id is its cross-region inference profile, the form tokens.ts keys its output cap by.",
308
+ "amazon.nova-pro-v1:0": "Amazon Nova",
309
+ "writer.palmyra-x5-v1:0": "Writer",
310
+ "nvidia.nemotron-nano-3-30b": "NVIDIA"
311
+ },
312
+ "azure": {
313
+ "gpt-6-astra": "GPT-6 family (Sep 2026) — 1.05M context, per learn.microsoft.com/azure/ai-foundry/openai/concepts/models",
314
+ "gpt-5.6-sol": "GPT-5.6 / GPT-5.5 — Azure-only as of Sep 2026, same 1.05M context",
315
+ "gpt-5.4": "GPT-5.4",
316
+ "gpt-5.2": "GPT-5.x",
317
+ "gpt-4.1": "GPT-4.1",
318
+ "gpt-4o": "GPT-4o",
319
+ "o3": "O-series",
320
+ "gpt-4-turbo": "Legacy"
321
+ },
322
+ "sagemaker": {
323
+ "nvidia-nemotron-3-nano-30b": "NVIDIA Nemotron 3 Nano (February 2026) — 1M context",
324
+ "qwen3-vl-8b-instruct": "Qwen3 VL — 32K context"
325
+ }
326
+ },
327
+ "providerAliases": {
328
+ "aws": "bedrock",
329
+ "googleaistudio": "google-ai",
330
+ "googleai": "google-ai",
331
+ "lmstudio": "lm-studio",
332
+ "llamacpp": "llamacpp",
333
+ "nvidianim": "nvidia-nim",
334
+ "nim": "nvidia-nim",
335
+ "nvidia": "nvidia-nim",
336
+ "deepseek": "deepseek"
337
+ }
338
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "./provider-rules.schema.json",
3
+ "id": "litellm",
4
+ "errors": {
5
+ "rules": [
6
+ {
7
+ "errorName": "TimeoutError",
8
+ "pattern": "timeout",
9
+ "class": "network",
10
+ "message": "Request timed out: {message}"
11
+ },
12
+ {
13
+ "pattern": "ECONNREFUSED|Failed to fetch",
14
+ "caseSensitive": true,
15
+ "class": "network",
16
+ "message": "LiteLLM proxy server not available. Please start the LiteLLM proxy server at {baseURL}"
17
+ },
18
+ {
19
+ "pattern": "API_KEY_INVALID|Invalid API key",
20
+ "caseSensitive": true,
21
+ "class": "authentication",
22
+ "message": "Invalid LiteLLM configuration. Please check your LITELLM_API_KEY environment variable."
23
+ },
24
+ {
25
+ "pattern": "rate limit",
26
+ "class": "rate-limit",
27
+ "message": "LiteLLM rate limit exceeded. Please try again later."
28
+ },
29
+ {
30
+ "allPatterns": ["model", "not found"],
31
+ "class": "invalid-model",
32
+ "message": "Model '{model}' not available in LiteLLM proxy. Please check your LiteLLM configuration and ensure the model is configured."
33
+ }
34
+ ]
35
+ }
36
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "./provider-rules.schema.json",
3
+ "id": "llamacpp",
4
+ "errors": {
5
+ "rules": [
6
+ {
7
+ "errorCode": "ECONNREFUSED",
8
+ "pattern": "ECONNREFUSED|Failed to fetch|fetch failed",
9
+ "caseSensitive": true,
10
+ "class": "network",
11
+ "message": "llama.cpp server not reachable at {baseURL}. Start it with: ./llama-server -m model.gguf --port 8080"
12
+ },
13
+ {
14
+ "status": 400,
15
+ "pattern": "\\b400\\b",
16
+ "caseSensitive": true,
17
+ "patternWhenNoStatus": true,
18
+ "class": "provider",
19
+ "message": "llama.cpp rejected the request. Common cause: model doesn't support tools (start llama-server with --jinja for tool support)."
20
+ }
21
+ ]
22
+ }
23
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "./provider-rules.schema.json",
3
+ "id": "lm-studio",
4
+ "errors": {
5
+ "rules": [
6
+ {
7
+ "errorCode": "ECONNREFUSED",
8
+ "pattern": "ECONNREFUSED|Failed to fetch|fetch failed",
9
+ "caseSensitive": true,
10
+ "class": "network",
11
+ "message": "LM Studio server not reachable at {baseURL}. Open the LM Studio app, load a model, and click \"Start Server\"."
12
+ },
13
+ {
14
+ "pattern": "model_not_found|404",
15
+ "caseSensitive": true,
16
+ "class": "invalid-model",
17
+ "message": "LM Studio model '{model}' is not loaded. Load it in the LM Studio app first."
18
+ }
19
+ ]
20
+ }
21
+ }
@@ -0,0 +1,115 @@
1
+ {
2
+ "$schema": "./provider-rules.schema.json",
3
+ "id": "model-families",
4
+ "modelFamilies": {
5
+ "samplingParamsRejected": [
6
+ "sonnet[-_.]?5(?![0-9])",
7
+ "opus[-_.]?4[-_.]?(?:[7-9]|\\d{2,})(?![0-9])",
8
+ "opus[-_.]?5(?![0-9])",
9
+ "fable",
10
+ "mythos"
11
+ ],
12
+ "forcedToolChoiceRejected": [
13
+ "sonnet[-_.]?5[-_.]5(?![0-9])",
14
+ "opus[-_.]?5[-_.]5(?![0-9])",
15
+ "(?:fable|mythos)[-_.]?5[-_.]1(?![0-9])"
16
+ ],
17
+ "betweenToolsThinking": ["sonnet[-_.]?5[-_.]5(?![0-9])"],
18
+ "claudeModernVision": [
19
+ "claude-(?:opus|sonnet|haiku)-(?:[4-9]|\\d{2,})",
20
+ "claude-(?:fable|mythos)-\\d"
21
+ ],
22
+ "gemini3": ["^gemini-3(\\.\\d+)?(-.*)?$"],
23
+ "gemini25": ["^gemini-2\\.5(-.*)?$"],
24
+ "thinkingConfig": ["^gemini-3", "^gemini-2\\.5-pro", "^gemini-2\\.5-flash"],
25
+ "promptCaching": ["^gemini-3", "^gemini-2\\.5", "^gpt-4", "^claude-3"],
26
+ "restrictedOutput": ["^gemini-3"],
27
+ "maxCompletionTokens": ["^(o\\d|gpt-5)"],
28
+ "samplingExclusive": [
29
+ "opus[-_.]?4[-_.]?[1-6](?![0-9])",
30
+ "sonnet[-_.]?4[-_.]?[5-9](?![0-9])",
31
+ "haiku[-_.]?4[-_.]?[5-9](?![0-9])"
32
+ ]
33
+ },
34
+ "modelFamilyNotes": {
35
+ "samplingParamsRejected": "Reject temperature/topP in favour of reasoning-effort controls: Claude Sonnet 5, Opus 4.7+ (including Opus 5) and the Fable/Mythos 5 tier, notably as served through Vertex. Patterns, because gateway ids carry arbitrary prefixes and suffixes (vertex_ai/claude-sonnet-5@20260203).",
36
+ "forcedToolChoiceRejected": "Answer a forced tool_choice (any or tool) with a 400: \"tool_choice: type \\\"tool\\\" and \\\"any\\\" are not supported for this model.\" Sonnet 5.5 and Opus 5.5 were probed live on Vertex; the Fable 5.1 docs state the same, and Mythos 5.1 shares Fable 5.1's capabilities. The same families also refuse thinking: {type: \"disabled\"}.",
37
+ "betweenToolsThinking": "Of forcedToolChoiceRejected, the ones that accept thinking: {type: \"between_tools\"} as their lowest setting. The rest think adaptively, always on, and take no thinking field in its place.",
38
+ "claudeModernVision": "Name-first Claude ids with major version 4 or later (claude-sonnet-5, claude-opus-4-7, claude-haiku-4-5) plus Fable/Mythos. Legacy number-first 3.x ids (claude-3-5-haiku) deliberately do not match: claude-3-5-haiku, the last non-vision Claude, must stay rejected.",
39
+ "gemini3": "Gemini 3 and 3.x: thinking takes thinkingLevel.",
40
+ "gemini25": "Gemini 2.5: rejects thinkingLevel with 400 \"thinking_level not supported\"; takes thinkingBudget.",
41
+ "maxCompletionTokens": "Reasoning-class OpenAI models (o-series, gpt-5+) reject max_tokens and take max_completion_tokens. Matched against the id after its last '/'.",
42
+ "restrictedOutput": "Output capped at gemini.json reasoning.restrictedOutputTokenLimit, as are the imageGeneration models (matched as prefixes).",
43
+ "samplingExclusive": "Accept temperature or top_p but reject both in one request with a 400 (\"temperature and top_p cannot both be specified for this model\"): Claude Opus 4.1 to 4.6, Sonnet 4.5+ and Haiku 4.5+ (docs.claude.com, what's new in Claude Sonnet 4.5). When a caller sets both, temperature is kept. Opus 4.7+ and Sonnet 5 reject sampling entirely (samplingParamsRejected)."
44
+ },
45
+ "modelFamilyLabels": {
46
+ "rules": [
47
+ {
48
+ "match": "^gemini-3",
49
+ "label": "gemini-3"
50
+ },
51
+ {
52
+ "match": "^gemini-2\\.5",
53
+ "label": "gemini-2.5"
54
+ },
55
+ {
56
+ "match": "^gemini-2",
57
+ "label": "gemini-2"
58
+ },
59
+ {
60
+ "match": "^gpt-4",
61
+ "label": "gpt-4"
62
+ },
63
+ {
64
+ "match": "^claude-3",
65
+ "label": "claude-3"
66
+ }
67
+ ],
68
+ "default": "unknown"
69
+ },
70
+ "modelLists": {
71
+ "imageGeneration": [
72
+ "gemini-3-pro-image-preview",
73
+ "gemini-2.5-flash-image",
74
+ "gemini-3.1-flash-image-preview",
75
+ "stable-image-ultra",
76
+ "stable-image-core",
77
+ "sd3.5-large",
78
+ "sd3.5-large-turbo",
79
+ "sd3.5-medium",
80
+ "V_1",
81
+ "V_1_TURBO",
82
+ "V_2",
83
+ "V_2_TURBO",
84
+ "V_2A",
85
+ "V_2A_TURBO",
86
+ "V_3",
87
+ "recraftv3",
88
+ "recraftv2",
89
+ "gpt-image-1",
90
+ "dall-e-3",
91
+ "dall-e-2",
92
+ "black-forest-labs/flux",
93
+ "stability-ai/sdxl",
94
+ "stability-ai/stable-diffusion"
95
+ ],
96
+ "pdfImageGeneration": [
97
+ "gemini-3-pro-image-preview",
98
+ "gemini-3.1-flash-image-preview"
99
+ ],
100
+ "vertexGlobalLocationText": [
101
+ "gemini-3.1-pro-preview",
102
+ "gemini-3.1-flash-lite-preview",
103
+ "gemini-3.1-pro-preview-customtools",
104
+ "gemini-3-pro-preview",
105
+ "gemini-3-pro-preview-11-2025",
106
+ "gemini-3-pro-latest",
107
+ "gemini-3-flash-preview"
108
+ ]
109
+ },
110
+ "modelListNotes": {
111
+ "imageGeneration": "Image-generation models, not text. isImageGenerationModel matches an entry exactly or bounded by - _ : . / @ or the ends, so short ids such as V_1 (Ideogram) don't match unrelated names. Groups: Gemini image (Vertex, AI Studio); Stability; Ideogram model versions; Recraft; OpenAI DALL-E and GPT-Image; Replicate slugs (matched as a slug prefix).",
112
+ "pdfImageGeneration": "Models that can generate images from PDFs.",
113
+ "vertexGlobalLocationText": "Gemini 3.x text models that Vertex serves only on the global endpoint (aiplatform.googleapis.com). GLOBAL_LOCATION_MODELS is imageGeneration followed by this list, so a new image model is routed to global too."
114
+ }
115
+ }
@@ -0,0 +1,10 @@
1
+ /** A family's compiled patterns; throws when the family is missing. */
2
+ export declare function getModelFamilyPatterns(name: string): RegExp[];
3
+ /** Whether a model id matches any pattern of a family. */
4
+ export declare function inModelFamily(name: string, modelId: string): boolean;
5
+ /** The first rule whose case-insensitive `match` pattern matches the model id. */
6
+ export declare function firstModelRule<T extends {
7
+ match: string;
8
+ }>(rules: readonly T[], modelId: string): T | undefined;
9
+ /** A copy of a named list of exact model ids from model-families.json; throws when missing. */
10
+ export declare function getModelList(name: string): string[];
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Named model-id families from `model-families.json`. Each family is a list
3
+ * of case-insensitive patterns; gateway ids carry arbitrary prefixes and
4
+ * suffixes (`vertex_ai/claude-sonnet-5@20260203`), so exact ids can't cover
5
+ * them.
6
+ */
7
+ import { getProviderRules } from "./registry.js";
8
+ const compiled = new Map();
9
+ /** A family's compiled patterns; throws when the family is missing. */
10
+ export function getModelFamilyPatterns(name) {
11
+ let family = compiled.get(name);
12
+ if (!family) {
13
+ const sources = getProviderRules("model-families").modelFamilies?.[name];
14
+ if (!sources) {
15
+ throw new Error(`Provider rules file "model-families.json" has no modelFamilies.${name}`);
16
+ }
17
+ family = sources.map((source) => new RegExp(source, "i"));
18
+ compiled.set(name, family);
19
+ }
20
+ return family;
21
+ }
22
+ /** Whether a model id matches any pattern of a family. */
23
+ export function inModelFamily(name, modelId) {
24
+ return getModelFamilyPatterns(name).some((pattern) => pattern.test(modelId));
25
+ }
26
+ const compiledRules = new WeakMap();
27
+ /** The first rule whose case-insensitive `match` pattern matches the model id. */
28
+ export function firstModelRule(rules, modelId) {
29
+ return rules.find((rule) => {
30
+ let pattern = compiledRules.get(rule);
31
+ if (!pattern) {
32
+ pattern = new RegExp(rule.match, "i");
33
+ compiledRules.set(rule, pattern);
34
+ }
35
+ return pattern.test(modelId);
36
+ });
37
+ }
38
+ /** A copy of a named list of exact model ids from model-families.json; throws when missing. */
39
+ export function getModelList(name) {
40
+ const list = getProviderRules("model-families").modelLists?.[name];
41
+ if (!list) {
42
+ throw new Error(`Provider rules file "model-families.json" has no modelLists.${name}`);
43
+ }
44
+ return [...list];
45
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "./provider-rules.schema.json",
3
+ "id": "nvidia-nim",
4
+ "errors": {
5
+ "rules": [
6
+ {
7
+ "pattern": "Invalid API key|Unauthorized",
8
+ "caseSensitive": true,
9
+ "messageStatus": 401,
10
+ "class": "authentication",
11
+ "message": "Invalid NVIDIA NIM API key. Get one at https://build.nvidia.com/settings/api-keys"
12
+ },
13
+ {
14
+ "pattern": "rate limit",
15
+ "caseSensitive": true,
16
+ "messageStatus": 429,
17
+ "class": "rate-limit",
18
+ "message": "NVIDIA NIM rate limit exceeded"
19
+ },
20
+ {
21
+ "pattern": "authori[sz]ation failed",
22
+ "notPattern": "quota",
23
+ "class": "authentication",
24
+ "message": "NVIDIA NIM rejected the credentials (HTTP 403 Authorization failed). Check the API key at https://build.nvidia.com/settings/api-keys; a valid key is also refused when its organization lacks Public API Endpoints access."
25
+ },
26
+ {
27
+ "status": 404,
28
+ "pattern": "model_not_found",
29
+ "caseSensitive": true,
30
+ "messageStatus": 404,
31
+ "class": "invalid-model",
32
+ "message": "NVIDIA NIM model '{model}' not available. Browse the catalog at https://build.nvidia.com/models"
33
+ },
34
+ {
35
+ "pattern": "quota",
36
+ "caseSensitive": true,
37
+ "messageStatus": 403,
38
+ "class": "provider",
39
+ "message": "NVIDIA NIM quota exceeded for your account"
40
+ }
41
+ ]
42
+ }
43
+ }