@ai-sdk/anthropic 4.0.91 → 4.0.93
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 +28 -0
- package/dist/index.js +341 -229
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +17 -35
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +341 -229
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +11 -7
- package/package.json +3 -3
- package/src/anthropic-language-model.ts +11 -285
- package/src/anthropic-model-catalog.ts +406 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 4.0.93
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dcd2f8d: Introduce a model entry contract with named capability sections and request configuration. Consolidate the OpenAI and Anthropic model catalogs so existing request behavior and generated capability documentation use the same source of truth. Catalogs also declare the provider options each provider accepts and which models support them.
|
|
8
|
+
- Updated dependencies [7716e18]
|
|
9
|
+
- Updated dependencies [5c247e9]
|
|
10
|
+
- Updated dependencies [dcd2f8d]
|
|
11
|
+
- @ai-sdk/provider-utils@5.0.72
|
|
12
|
+
- @ai-sdk/provider@4.0.35
|
|
13
|
+
|
|
14
|
+
## 4.0.92
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 61a315e: fix: map the top-level `reasoning` option consistently across providers
|
|
19
|
+
|
|
20
|
+
Providers now resolve reasoning the same way:
|
|
21
|
+
|
|
22
|
+
1. A provider-specific reasoning setting in `providerOptions` is sent unchanged. OpenAI no longer drops `providerOptions.openai.reasoningEffort` values that are not in its list for the model, and Fireworks no longer rewrites `providerOptions.fireworks.reasoningEffort`. Fireworks also sends top-level `reasoning` values directly instead of rounding them to `'high'` at most, except for model families known to reject `'none'` (GPT-OSS, GLM-5.3, Muse Spark) or `'minimal'` (Nemotron, Inkling).
|
|
23
|
+
2. Otherwise, `reasoning` maps to the closest level the model supports, rounding down, and rounds up only when there is no lower level. For example, `'xhigh'` now maps to `'high'` instead of `'max'` on Anthropic and Bedrock models without `xhigh` effort, and `'medium'` maps to `'low'` instead of `'high'` on DeepSeek, Kimi K3, and Mistral GLM-5.3 models.
|
|
24
|
+
3. `'none'` on a model that cannot disable reasoning maps to the model's lowest level with a compatibility warning, instead of being dropped or sending a request the API rejects. This affects GPT-6 models without `'none'`, xAI grok-4.5 and later, Groq GPT-OSS, Kimi K3, Perplexity, QuiverAI, Bedrock OpenAI `gpt-oss` models, and Gemini 2.5 Pro (minimum thinking budget). Gemini 3 and Anthropic and Bedrock `between_tools` mappings now emit the compatibility warning too.
|
|
25
|
+
|
|
26
|
+
`mapReasoningToProviderEffort` now accepts any `reasoning` value, returns an optional `providerOptionsEffort` unchanged, and rounds levels that are missing from the effort map to the closest supported level. `mapReasoningToProviderBudget` maps `'none'` to the minimum reasoning budget, always returns a budget, and uses the default percentage for levels missing from `budgetPercentages`. `OpenAICompatibleChatConfig` adds an optional `mapReasoning` function for mapping the top-level `reasoning` option.
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [61a315e]
|
|
29
|
+
- @ai-sdk/provider-utils@5.0.71
|
|
30
|
+
|
|
3
31
|
## 4.0.91
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,330 @@ var AnthropicFiles = class {
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
//#endregion
|
|
67
|
+
//#region src/anthropic-model-catalog.ts
|
|
68
|
+
/**
|
|
69
|
+
* Options accepted under `providerOptions.anthropic`. The `satisfies` check
|
|
70
|
+
* keeps this list in sync with the option schema.
|
|
71
|
+
*/
|
|
72
|
+
const anthropicProviderOptions = { language: {
|
|
73
|
+
sendReasoning: { description: "Whether to send reasoning to the model." },
|
|
74
|
+
structuredOutputMode: { description: "How structured outputs are generated." },
|
|
75
|
+
thinking: { description: "Extended thinking configuration." },
|
|
76
|
+
disableParallelToolUse: { description: "Use at most one tool per response." },
|
|
77
|
+
cacheControl: { description: "Prompt cache control settings." },
|
|
78
|
+
metadata: { description: "Request metadata, such as a user ID." },
|
|
79
|
+
mcpServers: { description: "MCP servers to use in the request." },
|
|
80
|
+
container: { description: "Container and Agent Skills configuration." },
|
|
81
|
+
toolStreaming: { description: "Fine-grained streaming of tool inputs and outputs." },
|
|
82
|
+
effort: { description: "Effort spent on thinking, text, and tool calls." },
|
|
83
|
+
taskBudget: { description: "Advisory token budget for an agentic task." },
|
|
84
|
+
speed: { description: "Fast mode for faster output token speeds." },
|
|
85
|
+
serviceTier: { description: "Service tier for the request." },
|
|
86
|
+
inferenceGeo: { description: "Where model inference runs." },
|
|
87
|
+
fallbacks: { description: "Server-side fallback models." },
|
|
88
|
+
anthropicBeta: { description: "Additional beta features to enable." },
|
|
89
|
+
safeguards: { description: "Server-side safeguards to run." },
|
|
90
|
+
compaction: { description: "On-demand conversation summary." },
|
|
91
|
+
contextManagement: { description: "Server-side context management." }
|
|
92
|
+
} };
|
|
93
|
+
const legacyClaude = defineRuntime({});
|
|
94
|
+
const currentClaude = defineRuntime({
|
|
95
|
+
maxOutputTokens: 128e3,
|
|
96
|
+
nativeStructuredOutput: true,
|
|
97
|
+
adaptiveThinking: true
|
|
98
|
+
});
|
|
99
|
+
const currentClaudeWithoutSampling = defineRuntime({
|
|
100
|
+
...currentClaude,
|
|
101
|
+
samplingParameters: false,
|
|
102
|
+
xhighEffort: true
|
|
103
|
+
});
|
|
104
|
+
function defineRuntime(overrides) {
|
|
105
|
+
return {
|
|
106
|
+
maxOutputTokens: 4096,
|
|
107
|
+
nativeStructuredOutput: false,
|
|
108
|
+
adaptiveThinking: false,
|
|
109
|
+
samplingParameters: true,
|
|
110
|
+
xhighEffort: false,
|
|
111
|
+
thinkingCanBeDisabledAboveHighEffort: true,
|
|
112
|
+
thinkingCanBeDisabled: true,
|
|
113
|
+
budgetThinking: true,
|
|
114
|
+
forcedToolUse: true,
|
|
115
|
+
betweenToolsThinking: false,
|
|
116
|
+
knownModel: true,
|
|
117
|
+
...overrides
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const runtimeRules = [
|
|
121
|
+
{
|
|
122
|
+
matches: (modelId) => modelId.includes("claude-sonnet-5-5"),
|
|
123
|
+
definition: defineRuntime({
|
|
124
|
+
...currentClaudeWithoutSampling,
|
|
125
|
+
thinkingCanBeDisabledAboveHighEffort: false,
|
|
126
|
+
thinkingCanBeDisabled: false,
|
|
127
|
+
budgetThinking: false,
|
|
128
|
+
forcedToolUse: false,
|
|
129
|
+
betweenToolsThinking: true
|
|
130
|
+
})
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
matches: (modelId) => modelId.includes("claude-opus-5-5"),
|
|
134
|
+
definition: defineRuntime({
|
|
135
|
+
...currentClaudeWithoutSampling,
|
|
136
|
+
thinkingCanBeDisabledAboveHighEffort: false,
|
|
137
|
+
thinkingCanBeDisabled: false,
|
|
138
|
+
budgetThinking: false,
|
|
139
|
+
forcedToolUse: false
|
|
140
|
+
})
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
matches: (modelId) => modelId.includes("claude-haiku-5-5"),
|
|
144
|
+
definition: defineRuntime({
|
|
145
|
+
...currentClaudeWithoutSampling,
|
|
146
|
+
thinkingCanBeDisabledAboveHighEffort: false,
|
|
147
|
+
budgetThinking: false
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
matches: (modelId) => modelId.includes("claude-opus-5"),
|
|
152
|
+
definition: defineRuntime({
|
|
153
|
+
...currentClaudeWithoutSampling,
|
|
154
|
+
thinkingCanBeDisabledAboveHighEffort: false
|
|
155
|
+
})
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
matches: (modelId) => modelId.includes("claude-fable-5-1"),
|
|
159
|
+
definition: defineRuntime({
|
|
160
|
+
...currentClaudeWithoutSampling,
|
|
161
|
+
thinkingCanBeDisabled: false,
|
|
162
|
+
budgetThinking: false,
|
|
163
|
+
forcedToolUse: false
|
|
164
|
+
})
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
matches: (modelId) => modelId.includes("claude-fable-5"),
|
|
168
|
+
definition: defineRuntime({
|
|
169
|
+
...currentClaudeWithoutSampling,
|
|
170
|
+
thinkingCanBeDisabled: false,
|
|
171
|
+
budgetThinking: false
|
|
172
|
+
})
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
matches: (modelId) => modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5"),
|
|
176
|
+
definition: currentClaudeWithoutSampling
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
matches: (modelId) => modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6"),
|
|
180
|
+
definition: currentClaude
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
matches: (modelId) => modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5"),
|
|
184
|
+
definition: defineRuntime({
|
|
185
|
+
maxOutputTokens: 64e3,
|
|
186
|
+
nativeStructuredOutput: true
|
|
187
|
+
})
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
matches: (modelId) => modelId.includes("claude-opus-4-1"),
|
|
191
|
+
definition: defineRuntime({
|
|
192
|
+
maxOutputTokens: 32e3,
|
|
193
|
+
nativeStructuredOutput: true
|
|
194
|
+
})
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
matches: (modelId) => /claude-sonnet-4(?:-|@)/.test(modelId),
|
|
198
|
+
definition: defineRuntime({ maxOutputTokens: 64e3 })
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
matches: (modelId) => /claude-opus-4(?:-|@)/.test(modelId),
|
|
202
|
+
definition: defineRuntime({ maxOutputTokens: 32e3 })
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
matches: (modelId) => modelId.includes("claude-3-haiku"),
|
|
206
|
+
definition: legacyClaude
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
matches: (modelId) => /claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId),
|
|
210
|
+
definition: defineRuntime({ knownModel: false })
|
|
211
|
+
}
|
|
212
|
+
];
|
|
213
|
+
const anthropicModelCatalog = Object.fromEntries(Object.entries({
|
|
214
|
+
"claude-opus-5-5": {
|
|
215
|
+
toolSearch: true,
|
|
216
|
+
compaction: true,
|
|
217
|
+
effort: true
|
|
218
|
+
},
|
|
219
|
+
"claude-opus-5": {
|
|
220
|
+
toolSearch: true,
|
|
221
|
+
compaction: true,
|
|
222
|
+
effort: true
|
|
223
|
+
},
|
|
224
|
+
"claude-sonnet-5-5": {
|
|
225
|
+
toolSearch: true,
|
|
226
|
+
compaction: true,
|
|
227
|
+
effort: true
|
|
228
|
+
},
|
|
229
|
+
"claude-sonnet-5": {
|
|
230
|
+
toolSearch: true,
|
|
231
|
+
compaction: true,
|
|
232
|
+
effort: true
|
|
233
|
+
},
|
|
234
|
+
"claude-haiku-5-5": {
|
|
235
|
+
toolSearch: true,
|
|
236
|
+
compaction: true,
|
|
237
|
+
effort: true
|
|
238
|
+
},
|
|
239
|
+
"claude-fable-5-1": {
|
|
240
|
+
toolSearch: true,
|
|
241
|
+
compaction: true,
|
|
242
|
+
effort: true
|
|
243
|
+
},
|
|
244
|
+
"claude-fable-5": {
|
|
245
|
+
toolSearch: true,
|
|
246
|
+
compaction: true,
|
|
247
|
+
effort: true
|
|
248
|
+
},
|
|
249
|
+
"claude-opus-4-8": {
|
|
250
|
+
toolSearch: true,
|
|
251
|
+
compaction: true,
|
|
252
|
+
effort: true
|
|
253
|
+
},
|
|
254
|
+
"claude-opus-4-7": {
|
|
255
|
+
toolSearch: true,
|
|
256
|
+
compaction: true,
|
|
257
|
+
effort: true
|
|
258
|
+
},
|
|
259
|
+
"claude-opus-4-6": {
|
|
260
|
+
toolSearch: true,
|
|
261
|
+
compaction: true,
|
|
262
|
+
effort: true
|
|
263
|
+
},
|
|
264
|
+
"claude-sonnet-4-6": {
|
|
265
|
+
toolSearch: true,
|
|
266
|
+
compaction: true,
|
|
267
|
+
effort: true
|
|
268
|
+
},
|
|
269
|
+
"claude-opus-4-5": {
|
|
270
|
+
toolSearch: true,
|
|
271
|
+
compaction: false,
|
|
272
|
+
effort: true
|
|
273
|
+
},
|
|
274
|
+
"claude-haiku-4-5": {
|
|
275
|
+
toolSearch: true,
|
|
276
|
+
compaction: false,
|
|
277
|
+
effort: false
|
|
278
|
+
},
|
|
279
|
+
"claude-sonnet-4-5": {
|
|
280
|
+
toolSearch: true,
|
|
281
|
+
compaction: false,
|
|
282
|
+
effort: false
|
|
283
|
+
},
|
|
284
|
+
"claude-opus-4-1": {
|
|
285
|
+
toolSearch: false,
|
|
286
|
+
compaction: false,
|
|
287
|
+
effort: false
|
|
288
|
+
},
|
|
289
|
+
"claude-opus-4-0": {
|
|
290
|
+
toolSearch: false,
|
|
291
|
+
compaction: false,
|
|
292
|
+
effort: false
|
|
293
|
+
},
|
|
294
|
+
"claude-sonnet-4-0": {
|
|
295
|
+
toolSearch: false,
|
|
296
|
+
compaction: false,
|
|
297
|
+
effort: false
|
|
298
|
+
}
|
|
299
|
+
}).map(([modelId, capabilities]) => [modelId, createAnthropicLanguageModelEntry(modelId, capabilities)]));
|
|
300
|
+
function getAnthropicLanguageModelEntry(modelId) {
|
|
301
|
+
return Object.prototype.hasOwnProperty.call(anthropicModelCatalog, modelId) ? anthropicModelCatalog[modelId] : createAnthropicLanguageModelEntry(modelId);
|
|
302
|
+
}
|
|
303
|
+
function createAnthropicLanguageModelEntry(modelId, documented) {
|
|
304
|
+
const runtime = resolveRuntimeDefinition(modelId);
|
|
305
|
+
const declared = documented != null;
|
|
306
|
+
const samplingSupport = runtime.samplingParameters ? true : { condition: "Only supported when thinking is disabled." };
|
|
307
|
+
const reasoningSupport = runtime.adaptiveThinking || runtime.budgetThinking;
|
|
308
|
+
return {
|
|
309
|
+
capabilities: { language: {
|
|
310
|
+
inputs: {
|
|
311
|
+
image: declared ? true : "unknown",
|
|
312
|
+
audio: declared ? false : "unknown"
|
|
313
|
+
},
|
|
314
|
+
objectGeneration: declared ? true : "unknown",
|
|
315
|
+
tools: {
|
|
316
|
+
usage: declared ? true : "unknown",
|
|
317
|
+
streaming: declared ? true : "unknown",
|
|
318
|
+
forcedChoice: runtime.forcedToolUse,
|
|
319
|
+
computerUse: declared ? true : "unknown",
|
|
320
|
+
webSearch: declared ? true : "unknown",
|
|
321
|
+
toolSearch: documented?.toolSearch ?? "unknown"
|
|
322
|
+
},
|
|
323
|
+
reasoning: {
|
|
324
|
+
support: reasoningSupport,
|
|
325
|
+
efforts: runtime.xhighEffort ? [
|
|
326
|
+
"low",
|
|
327
|
+
"medium",
|
|
328
|
+
"high",
|
|
329
|
+
"xhigh",
|
|
330
|
+
"max"
|
|
331
|
+
] : void 0,
|
|
332
|
+
adaptive: runtime.adaptiveThinking,
|
|
333
|
+
budget: runtime.budgetThinking,
|
|
334
|
+
canDisable: runtime.thinkingCanBeDisabled,
|
|
335
|
+
canDisableAboveHighEffort: runtime.thinkingCanBeDisabledAboveHighEffort,
|
|
336
|
+
supportsXhighEffort: runtime.xhighEffort,
|
|
337
|
+
betweenTools: runtime.betweenToolsThinking
|
|
338
|
+
},
|
|
339
|
+
sampling: {
|
|
340
|
+
temperature: samplingSupport,
|
|
341
|
+
topP: samplingSupport,
|
|
342
|
+
topK: samplingSupport,
|
|
343
|
+
logprobs: false
|
|
344
|
+
},
|
|
345
|
+
structuredOutput: { native: runtime.nativeStructuredOutput },
|
|
346
|
+
compaction: documented?.compaction ?? "unknown"
|
|
347
|
+
} },
|
|
348
|
+
providerOptions: { language: declareProviderOptions(anthropicProviderOptions.language, declared ? true : "unknown", {
|
|
349
|
+
thinking: reasoningSupport,
|
|
350
|
+
effort: documented?.effort ?? "unknown",
|
|
351
|
+
speed: declared ? modelId === "claude-opus-4-6" : "unknown",
|
|
352
|
+
taskBudget: modelId === "claude-opus-4-7" ? true : "unknown"
|
|
353
|
+
}) },
|
|
354
|
+
requestConfig: { language: {
|
|
355
|
+
maxOutputTokens: runtime.maxOutputTokens,
|
|
356
|
+
knownModel: runtime.knownModel
|
|
357
|
+
} }
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
/** Applies one default support value to every option, except the listed ones. */
|
|
361
|
+
function declareProviderOptions(definitions, support, exceptions) {
|
|
362
|
+
return Object.fromEntries(Object.keys(definitions).map((option) => [option, exceptions[option] ?? support]));
|
|
363
|
+
}
|
|
364
|
+
function resolveRuntimeDefinition(modelId) {
|
|
365
|
+
const rule = runtimeRules.find((rule) => rule.matches(modelId));
|
|
366
|
+
if (rule != null) return rule.definition;
|
|
367
|
+
return modelId.includes("claude-") ? defineRuntime({
|
|
368
|
+
...currentClaudeWithoutSampling,
|
|
369
|
+
thinkingCanBeDisabledAboveHighEffort: false,
|
|
370
|
+
knownModel: false
|
|
371
|
+
}) : defineRuntime({ knownModel: false });
|
|
372
|
+
}
|
|
373
|
+
/** Compatibility projection for the provider's existing request preparation. */
|
|
374
|
+
function getAnthropicModelCapabilities(modelId) {
|
|
375
|
+
const { capabilities: { language }, requestConfig: { language: requestConfig } } = getAnthropicLanguageModelEntry(modelId);
|
|
376
|
+
return {
|
|
377
|
+
maxOutputTokens: requestConfig.maxOutputTokens,
|
|
378
|
+
supportsStructuredOutput: language.structuredOutput.native,
|
|
379
|
+
supportsAdaptiveThinking: language.reasoning.adaptive,
|
|
380
|
+
rejectsSamplingParameters: language.sampling.temperature !== true,
|
|
381
|
+
supportsXhighEffort: language.reasoning.supportsXhighEffort,
|
|
382
|
+
rejectsThinkingDisabledAboveHighEffort: !language.reasoning.canDisableAboveHighEffort,
|
|
383
|
+
rejectsThinkingDisabled: !language.reasoning.canDisable,
|
|
384
|
+
rejectsBudgetThinking: !language.reasoning.budget,
|
|
385
|
+
rejectsForcedToolUse: !language.tools.forcedChoice,
|
|
386
|
+
supportsBetweenToolsThinking: language.reasoning.betweenTools,
|
|
387
|
+
isKnownModel: requestConfig.knownModel
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
//#endregion
|
|
67
391
|
//#region src/map-anthropic-citation.ts
|
|
68
392
|
function mapAnthropicCitation(citation, documents) {
|
|
69
393
|
if (citation.type === "web_search_result_location" || citation.type === "search_result_location") {
|
|
@@ -3616,7 +3940,7 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
|
|
|
3616
3940
|
}) : null;
|
|
3617
3941
|
const usedCustomProviderKey = customProviderOptions != null;
|
|
3618
3942
|
const anthropicOptions = Object.assign({}, canonicalOptions ?? {}, customProviderOptions ?? {});
|
|
3619
|
-
const { maxOutputTokens: maxOutputTokensForModel, supportsStructuredOutput: modelSupportsStructuredOutput, supportsAdaptiveThinking, rejectsSamplingParameters, supportsXhighEffort, rejectsThinkingDisabledAboveHighEffort, rejectsThinkingDisabled, rejectsBudgetThinking, rejectsForcedToolUse, supportsBetweenToolsThinking, isKnownModel } =
|
|
3943
|
+
const { maxOutputTokens: maxOutputTokensForModel, supportsStructuredOutput: modelSupportsStructuredOutput, supportsAdaptiveThinking, rejectsSamplingParameters, supportsXhighEffort, rejectsThinkingDisabledAboveHighEffort, rejectsThinkingDisabled, rejectsBudgetThinking, rejectsForcedToolUse, supportsBetweenToolsThinking, isKnownModel } = getAnthropicModelCapabilities(modelId);
|
|
3620
3944
|
if (!isKnownModel && maxOutputTokens == null) warnings.push({
|
|
3621
3945
|
type: "compatibility",
|
|
3622
3946
|
feature: "maxOutputTokens",
|
|
@@ -5306,222 +5630,6 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
|
|
|
5306
5630
|
};
|
|
5307
5631
|
}
|
|
5308
5632
|
};
|
|
5309
|
-
/**
|
|
5310
|
-
* Returns the capabilities of a Claude model that are used for defaults and feature selection.
|
|
5311
|
-
*
|
|
5312
|
-
* @see https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table
|
|
5313
|
-
* @see https://platform.claude.com/docs/en/build-with-claude/structured-outputs
|
|
5314
|
-
*/
|
|
5315
|
-
function getModelCapabilities(modelId) {
|
|
5316
|
-
if (modelId.includes("claude-sonnet-5-5")) return {
|
|
5317
|
-
maxOutputTokens: 128e3,
|
|
5318
|
-
supportsStructuredOutput: true,
|
|
5319
|
-
supportsAdaptiveThinking: true,
|
|
5320
|
-
rejectsSamplingParameters: true,
|
|
5321
|
-
supportsXhighEffort: true,
|
|
5322
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5323
|
-
rejectsThinkingDisabled: true,
|
|
5324
|
-
rejectsBudgetThinking: true,
|
|
5325
|
-
rejectsForcedToolUse: true,
|
|
5326
|
-
supportsBetweenToolsThinking: true,
|
|
5327
|
-
isKnownModel: true
|
|
5328
|
-
};
|
|
5329
|
-
else if (modelId.includes("claude-opus-5-5")) return {
|
|
5330
|
-
maxOutputTokens: 128e3,
|
|
5331
|
-
supportsStructuredOutput: true,
|
|
5332
|
-
supportsAdaptiveThinking: true,
|
|
5333
|
-
rejectsSamplingParameters: true,
|
|
5334
|
-
supportsXhighEffort: true,
|
|
5335
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5336
|
-
rejectsThinkingDisabled: true,
|
|
5337
|
-
rejectsBudgetThinking: true,
|
|
5338
|
-
rejectsForcedToolUse: true,
|
|
5339
|
-
supportsBetweenToolsThinking: false,
|
|
5340
|
-
isKnownModel: true
|
|
5341
|
-
};
|
|
5342
|
-
else if (modelId.includes("claude-haiku-5-5")) return {
|
|
5343
|
-
maxOutputTokens: 128e3,
|
|
5344
|
-
supportsStructuredOutput: true,
|
|
5345
|
-
supportsAdaptiveThinking: true,
|
|
5346
|
-
rejectsSamplingParameters: true,
|
|
5347
|
-
supportsXhighEffort: true,
|
|
5348
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5349
|
-
rejectsThinkingDisabled: false,
|
|
5350
|
-
rejectsBudgetThinking: true,
|
|
5351
|
-
rejectsForcedToolUse: false,
|
|
5352
|
-
supportsBetweenToolsThinking: false,
|
|
5353
|
-
isKnownModel: true
|
|
5354
|
-
};
|
|
5355
|
-
else if (modelId.includes("claude-opus-5")) return {
|
|
5356
|
-
maxOutputTokens: 128e3,
|
|
5357
|
-
supportsStructuredOutput: true,
|
|
5358
|
-
supportsAdaptiveThinking: true,
|
|
5359
|
-
rejectsSamplingParameters: true,
|
|
5360
|
-
supportsXhighEffort: true,
|
|
5361
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5362
|
-
rejectsThinkingDisabled: false,
|
|
5363
|
-
rejectsBudgetThinking: false,
|
|
5364
|
-
rejectsForcedToolUse: false,
|
|
5365
|
-
supportsBetweenToolsThinking: false,
|
|
5366
|
-
isKnownModel: true
|
|
5367
|
-
};
|
|
5368
|
-
else if (modelId.includes("claude-fable-5-1")) return {
|
|
5369
|
-
maxOutputTokens: 128e3,
|
|
5370
|
-
supportsStructuredOutput: true,
|
|
5371
|
-
supportsAdaptiveThinking: true,
|
|
5372
|
-
rejectsSamplingParameters: true,
|
|
5373
|
-
supportsXhighEffort: true,
|
|
5374
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5375
|
-
rejectsThinkingDisabled: true,
|
|
5376
|
-
rejectsBudgetThinking: true,
|
|
5377
|
-
rejectsForcedToolUse: true,
|
|
5378
|
-
supportsBetweenToolsThinking: false,
|
|
5379
|
-
isKnownModel: true
|
|
5380
|
-
};
|
|
5381
|
-
else if (modelId.includes("claude-fable-5")) return {
|
|
5382
|
-
maxOutputTokens: 128e3,
|
|
5383
|
-
supportsStructuredOutput: true,
|
|
5384
|
-
supportsAdaptiveThinking: true,
|
|
5385
|
-
rejectsSamplingParameters: true,
|
|
5386
|
-
supportsXhighEffort: true,
|
|
5387
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5388
|
-
rejectsThinkingDisabled: true,
|
|
5389
|
-
rejectsBudgetThinking: true,
|
|
5390
|
-
rejectsForcedToolUse: false,
|
|
5391
|
-
supportsBetweenToolsThinking: false,
|
|
5392
|
-
isKnownModel: true
|
|
5393
|
-
};
|
|
5394
|
-
else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) return {
|
|
5395
|
-
maxOutputTokens: 128e3,
|
|
5396
|
-
supportsStructuredOutput: true,
|
|
5397
|
-
supportsAdaptiveThinking: true,
|
|
5398
|
-
rejectsSamplingParameters: true,
|
|
5399
|
-
supportsXhighEffort: true,
|
|
5400
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5401
|
-
rejectsThinkingDisabled: false,
|
|
5402
|
-
rejectsBudgetThinking: false,
|
|
5403
|
-
rejectsForcedToolUse: false,
|
|
5404
|
-
supportsBetweenToolsThinking: false,
|
|
5405
|
-
isKnownModel: true
|
|
5406
|
-
};
|
|
5407
|
-
else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) return {
|
|
5408
|
-
maxOutputTokens: 128e3,
|
|
5409
|
-
supportsStructuredOutput: true,
|
|
5410
|
-
supportsAdaptiveThinking: true,
|
|
5411
|
-
rejectsSamplingParameters: false,
|
|
5412
|
-
supportsXhighEffort: false,
|
|
5413
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5414
|
-
rejectsThinkingDisabled: false,
|
|
5415
|
-
rejectsBudgetThinking: false,
|
|
5416
|
-
rejectsForcedToolUse: false,
|
|
5417
|
-
supportsBetweenToolsThinking: false,
|
|
5418
|
-
isKnownModel: true
|
|
5419
|
-
};
|
|
5420
|
-
else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) return {
|
|
5421
|
-
maxOutputTokens: 64e3,
|
|
5422
|
-
supportsStructuredOutput: true,
|
|
5423
|
-
supportsAdaptiveThinking: false,
|
|
5424
|
-
rejectsSamplingParameters: false,
|
|
5425
|
-
supportsXhighEffort: false,
|
|
5426
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5427
|
-
rejectsThinkingDisabled: false,
|
|
5428
|
-
rejectsBudgetThinking: false,
|
|
5429
|
-
rejectsForcedToolUse: false,
|
|
5430
|
-
supportsBetweenToolsThinking: false,
|
|
5431
|
-
isKnownModel: true
|
|
5432
|
-
};
|
|
5433
|
-
else if (modelId.includes("claude-opus-4-1")) return {
|
|
5434
|
-
maxOutputTokens: 32e3,
|
|
5435
|
-
supportsStructuredOutput: true,
|
|
5436
|
-
supportsAdaptiveThinking: false,
|
|
5437
|
-
rejectsSamplingParameters: false,
|
|
5438
|
-
supportsXhighEffort: false,
|
|
5439
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5440
|
-
rejectsThinkingDisabled: false,
|
|
5441
|
-
rejectsBudgetThinking: false,
|
|
5442
|
-
rejectsForcedToolUse: false,
|
|
5443
|
-
supportsBetweenToolsThinking: false,
|
|
5444
|
-
isKnownModel: true
|
|
5445
|
-
};
|
|
5446
|
-
else if (/claude-sonnet-4(?:-|@)/.test(modelId)) return {
|
|
5447
|
-
maxOutputTokens: 64e3,
|
|
5448
|
-
supportsStructuredOutput: false,
|
|
5449
|
-
supportsAdaptiveThinking: false,
|
|
5450
|
-
rejectsSamplingParameters: false,
|
|
5451
|
-
supportsXhighEffort: false,
|
|
5452
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5453
|
-
rejectsThinkingDisabled: false,
|
|
5454
|
-
rejectsBudgetThinking: false,
|
|
5455
|
-
rejectsForcedToolUse: false,
|
|
5456
|
-
supportsBetweenToolsThinking: false,
|
|
5457
|
-
isKnownModel: true
|
|
5458
|
-
};
|
|
5459
|
-
else if (/claude-opus-4(?:-|@)/.test(modelId)) return {
|
|
5460
|
-
maxOutputTokens: 32e3,
|
|
5461
|
-
supportsStructuredOutput: false,
|
|
5462
|
-
supportsAdaptiveThinking: false,
|
|
5463
|
-
rejectsSamplingParameters: false,
|
|
5464
|
-
supportsXhighEffort: false,
|
|
5465
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5466
|
-
rejectsThinkingDisabled: false,
|
|
5467
|
-
rejectsBudgetThinking: false,
|
|
5468
|
-
rejectsForcedToolUse: false,
|
|
5469
|
-
supportsBetweenToolsThinking: false,
|
|
5470
|
-
isKnownModel: true
|
|
5471
|
-
};
|
|
5472
|
-
else if (modelId.includes("claude-3-haiku")) return {
|
|
5473
|
-
maxOutputTokens: 4096,
|
|
5474
|
-
supportsStructuredOutput: false,
|
|
5475
|
-
supportsAdaptiveThinking: false,
|
|
5476
|
-
rejectsSamplingParameters: false,
|
|
5477
|
-
supportsXhighEffort: false,
|
|
5478
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5479
|
-
rejectsThinkingDisabled: false,
|
|
5480
|
-
rejectsBudgetThinking: false,
|
|
5481
|
-
rejectsForcedToolUse: false,
|
|
5482
|
-
supportsBetweenToolsThinking: false,
|
|
5483
|
-
isKnownModel: true
|
|
5484
|
-
};
|
|
5485
|
-
else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) return {
|
|
5486
|
-
maxOutputTokens: 4096,
|
|
5487
|
-
supportsStructuredOutput: false,
|
|
5488
|
-
supportsAdaptiveThinking: false,
|
|
5489
|
-
rejectsSamplingParameters: false,
|
|
5490
|
-
supportsXhighEffort: false,
|
|
5491
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5492
|
-
rejectsThinkingDisabled: false,
|
|
5493
|
-
rejectsBudgetThinking: false,
|
|
5494
|
-
rejectsForcedToolUse: false,
|
|
5495
|
-
supportsBetweenToolsThinking: false,
|
|
5496
|
-
isKnownModel: false
|
|
5497
|
-
};
|
|
5498
|
-
else if (modelId.includes("claude-")) return {
|
|
5499
|
-
maxOutputTokens: 128e3,
|
|
5500
|
-
supportsStructuredOutput: true,
|
|
5501
|
-
supportsAdaptiveThinking: true,
|
|
5502
|
-
rejectsSamplingParameters: true,
|
|
5503
|
-
supportsXhighEffort: true,
|
|
5504
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5505
|
-
rejectsThinkingDisabled: false,
|
|
5506
|
-
rejectsBudgetThinking: false,
|
|
5507
|
-
rejectsForcedToolUse: false,
|
|
5508
|
-
supportsBetweenToolsThinking: false,
|
|
5509
|
-
isKnownModel: false
|
|
5510
|
-
};
|
|
5511
|
-
else return {
|
|
5512
|
-
maxOutputTokens: 4096,
|
|
5513
|
-
supportsStructuredOutput: false,
|
|
5514
|
-
supportsAdaptiveThinking: false,
|
|
5515
|
-
rejectsSamplingParameters: false,
|
|
5516
|
-
supportsXhighEffort: false,
|
|
5517
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5518
|
-
rejectsThinkingDisabled: false,
|
|
5519
|
-
rejectsBudgetThinking: false,
|
|
5520
|
-
rejectsForcedToolUse: false,
|
|
5521
|
-
supportsBetweenToolsThinking: false,
|
|
5522
|
-
isKnownModel: false
|
|
5523
|
-
};
|
|
5524
|
-
}
|
|
5525
5633
|
function hasDynamicFilteringWebToolWithoutCodeExecution(tools) {
|
|
5526
5634
|
if (!tools) return false;
|
|
5527
5635
|
let hasDynamicFilteringWebTool = false;
|
|
@@ -5541,7 +5649,14 @@ function hasDynamicFilteringWebToolWithoutCodeExecution(tools) {
|
|
|
5541
5649
|
function resolveAnthropicReasoningConfig({ reasoning, modelId, supportsAdaptiveThinking, supportsXhighEffort, rejectsThinkingDisabled, supportsBetweenToolsThinking, maxOutputTokensForModel, warnings }) {
|
|
5542
5650
|
if (!isCustomReasoning(reasoning)) return;
|
|
5543
5651
|
if (reasoning === "none") {
|
|
5544
|
-
if (supportsBetweenToolsThinking)
|
|
5652
|
+
if (supportsBetweenToolsThinking) {
|
|
5653
|
+
warnings.push({
|
|
5654
|
+
type: "compatibility",
|
|
5655
|
+
feature: "reasoning",
|
|
5656
|
+
details: `reasoning 'none' is not supported by ${modelId}; thinking cannot be disabled. Using 'between_tools' thinking, the lowest thinking setting, instead.`
|
|
5657
|
+
});
|
|
5658
|
+
return { thinking: { type: "between_tools" } };
|
|
5659
|
+
}
|
|
5545
5660
|
if (rejectsThinkingDisabled) {
|
|
5546
5661
|
warnings.push({
|
|
5547
5662
|
type: "compatibility",
|
|
@@ -5560,26 +5675,23 @@ function resolveAnthropicReasoningConfig({ reasoning, modelId, supportsAdaptiveT
|
|
|
5560
5675
|
effort: mapReasoningToProviderEffort({
|
|
5561
5676
|
reasoning,
|
|
5562
5677
|
effortMap: {
|
|
5563
|
-
minimal: "low",
|
|
5564
5678
|
low: "low",
|
|
5565
5679
|
medium: "medium",
|
|
5566
5680
|
high: "high",
|
|
5567
|
-
|
|
5681
|
+
...supportsXhighEffort && { xhigh: "xhigh" },
|
|
5568
5682
|
max: "max"
|
|
5569
5683
|
},
|
|
5570
5684
|
warnings
|
|
5571
5685
|
})
|
|
5572
5686
|
};
|
|
5573
|
-
const budgetTokens = mapReasoningToProviderBudget({
|
|
5574
|
-
reasoning,
|
|
5575
|
-
maxOutputTokens: maxOutputTokensForModel,
|
|
5576
|
-
maxReasoningBudget: maxOutputTokensForModel,
|
|
5577
|
-
warnings
|
|
5578
|
-
});
|
|
5579
|
-
if (budgetTokens == null) return;
|
|
5580
5687
|
return { thinking: {
|
|
5581
5688
|
type: "enabled",
|
|
5582
|
-
budgetTokens
|
|
5689
|
+
budgetTokens: mapReasoningToProviderBudget({
|
|
5690
|
+
reasoning,
|
|
5691
|
+
maxOutputTokens: maxOutputTokensForModel,
|
|
5692
|
+
maxReasoningBudget: maxOutputTokensForModel,
|
|
5693
|
+
warnings
|
|
5694
|
+
})
|
|
5583
5695
|
} };
|
|
5584
5696
|
}
|
|
5585
5697
|
function mapAnthropicResponseContextManagement$1(contextManagement) {
|
|
@@ -7021,7 +7133,7 @@ var AnthropicSkills = class {
|
|
|
7021
7133
|
};
|
|
7022
7134
|
//#endregion
|
|
7023
7135
|
//#region src/version.ts
|
|
7024
|
-
const VERSION = "4.0.
|
|
7136
|
+
const VERSION = "4.0.93";
|
|
7025
7137
|
//#endregion
|
|
7026
7138
|
//#region src/anthropic-provider.ts
|
|
7027
7139
|
const ANTHROPIC_API_URL = "https://api.anthropic.com";
|