@ai-sdk/anthropic 2.0.89 → 2.0.91
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 +14 -0
- package/dist/index.d.mts +17 -4
- package/dist/index.d.ts +17 -4
- package/dist/index.js +163 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +163 -56
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +162 -55
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +162 -55
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@ai-sdk/provider-utils";
|
|
12
12
|
|
|
13
13
|
// src/version.ts
|
|
14
|
-
var VERSION = true ? "2.0.
|
|
14
|
+
var VERSION = true ? "2.0.91" : "0.0.0-test";
|
|
15
15
|
|
|
16
16
|
// src/anthropic-messages-language-model.ts
|
|
17
17
|
import {
|
|
@@ -662,7 +662,40 @@ var anthropicFilePartProviderOptions = z3.object({
|
|
|
662
662
|
*/
|
|
663
663
|
context: z3.string().optional()
|
|
664
664
|
});
|
|
665
|
+
var anthropicSystemMessageProviderOptions = z3.object({
|
|
666
|
+
/**
|
|
667
|
+
* Mid-conversation tool changes. Adds or removes tools from the
|
|
668
|
+
* conversation's tool set between turns without invalidating the prompt
|
|
669
|
+
* cache.
|
|
670
|
+
*
|
|
671
|
+
* Only supported on system messages that appear mid-conversation (not the
|
|
672
|
+
* initial system prompt). A system message carrying tool changes must come
|
|
673
|
+
* right before an assistant message or at the end of the messages.
|
|
674
|
+
*
|
|
675
|
+
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
676
|
+
* option (typically with `deferLoading: true` so they are not loaded until
|
|
677
|
+
* the addition surfaces them). The required
|
|
678
|
+
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
679
|
+
*/
|
|
680
|
+
toolChanges: z3.array(
|
|
681
|
+
z3.discriminatedUnion("type", [
|
|
682
|
+
z3.object({
|
|
683
|
+
type: z3.literal("tool_addition"),
|
|
684
|
+
toolName: z3.string()
|
|
685
|
+
}),
|
|
686
|
+
z3.object({
|
|
687
|
+
type: z3.literal("tool_removal"),
|
|
688
|
+
toolName: z3.string()
|
|
689
|
+
})
|
|
690
|
+
])
|
|
691
|
+
).optional()
|
|
692
|
+
});
|
|
665
693
|
var anthropicProviderOptions = z3.object({
|
|
694
|
+
/**
|
|
695
|
+
* Whether to send reasoning to the model.
|
|
696
|
+
*
|
|
697
|
+
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
698
|
+
*/
|
|
666
699
|
sendReasoning: z3.boolean().optional(),
|
|
667
700
|
/**
|
|
668
701
|
* Determines how structured outputs are generated.
|
|
@@ -771,30 +804,35 @@ var anthropicProviderOptions = z3.object({
|
|
|
771
804
|
*/
|
|
772
805
|
inferenceGeo: z3.enum(["us", "global"]).optional(),
|
|
773
806
|
/**
|
|
774
|
-
* Server-side fallback
|
|
807
|
+
* Server-side fallback configuration.
|
|
775
808
|
*
|
|
776
809
|
* When the primary model's safety classifiers block a turn, the API
|
|
777
|
-
* automatically retries it on
|
|
778
|
-
* `content-filter` finish reason means the
|
|
779
|
-
*
|
|
780
|
-
* Each entry is merged into the request as a direct request to that entry's
|
|
781
|
-
* model, so it must be formatted accordingly: `model` is required, and an
|
|
782
|
-
* entry may additionally override `max_tokens`, `thinking`, `output_config`,
|
|
783
|
-
* and `speed` for that attempt only (`speed` additionally requires the speed
|
|
784
|
-
* beta). The value is passed through to the API as-is.
|
|
810
|
+
* automatically retries it server-side on a fallback model. A
|
|
811
|
+
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
785
812
|
*
|
|
786
|
-
*
|
|
787
|
-
*
|
|
813
|
+
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
814
|
+
* recommended fallback model based on the refusal category. Requires the
|
|
815
|
+
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
816
|
+
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
817
|
+
* request as a direct request to that entry's model, so it must be
|
|
818
|
+
* formatted accordingly: `model` is required, and an entry may
|
|
819
|
+
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
820
|
+
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
821
|
+
* beta). The value is passed through to the API as-is, and the
|
|
822
|
+
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
788
823
|
*/
|
|
789
|
-
fallbacks: z3.
|
|
790
|
-
z3.
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
824
|
+
fallbacks: z3.union([
|
|
825
|
+
z3.literal("default"),
|
|
826
|
+
z3.array(
|
|
827
|
+
z3.object({
|
|
828
|
+
model: z3.string(),
|
|
829
|
+
max_tokens: z3.number().int().optional(),
|
|
830
|
+
thinking: z3.record(z3.string(), z3.unknown()).optional(),
|
|
831
|
+
output_config: z3.record(z3.string(), z3.unknown()).optional(),
|
|
832
|
+
speed: z3.enum(["fast", "standard"]).optional()
|
|
833
|
+
})
|
|
834
|
+
)
|
|
835
|
+
]).optional(),
|
|
798
836
|
/**
|
|
799
837
|
* Context management configuration for automatic context window management.
|
|
800
838
|
* Enables features like automatic compaction and clearing of tool uses/thinking blocks.
|
|
@@ -1461,7 +1499,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1461
1499
|
warnings,
|
|
1462
1500
|
cacheControlValidator
|
|
1463
1501
|
}) {
|
|
1464
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1502
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1465
1503
|
const betas = /* @__PURE__ */ new Set();
|
|
1466
1504
|
const blocks = groupIntoBlocks(prompt);
|
|
1467
1505
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -1493,19 +1531,52 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1493
1531
|
const type = block.type;
|
|
1494
1532
|
switch (type) {
|
|
1495
1533
|
case "system": {
|
|
1496
|
-
const content =
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1534
|
+
const content = [];
|
|
1535
|
+
let toolChangeCount = 0;
|
|
1536
|
+
for (const { content: text, providerOptions } of block.messages) {
|
|
1537
|
+
const systemMessageOptions = await parseProviderOptions({
|
|
1538
|
+
provider: "anthropic",
|
|
1539
|
+
providerOptions,
|
|
1540
|
+
schema: anthropicSystemMessageProviderOptions
|
|
1541
|
+
});
|
|
1542
|
+
const toolChanges = (_a = systemMessageOptions == null ? void 0 : systemMessageOptions.toolChanges) != null ? _a : [];
|
|
1543
|
+
if (text !== "" || toolChanges.length === 0) {
|
|
1544
|
+
content.push({
|
|
1545
|
+
type: "text",
|
|
1546
|
+
text,
|
|
1547
|
+
cache_control: validator.getCacheControl(providerOptions, {
|
|
1548
|
+
type: "system message",
|
|
1549
|
+
canCache: true
|
|
1550
|
+
})
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
for (const toolChange of toolChanges) {
|
|
1554
|
+
toolChangeCount++;
|
|
1555
|
+
content.push({
|
|
1556
|
+
type: toolChange.type,
|
|
1557
|
+
tool: {
|
|
1558
|
+
type: "tool_reference",
|
|
1559
|
+
name: toolChange.toolName
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
if (i === 0 || system == null && toolChangeCount === 0) {
|
|
1565
|
+
if (toolChangeCount > 0) {
|
|
1566
|
+
warnings.push({
|
|
1567
|
+
type: "other",
|
|
1568
|
+
message: "tool changes on the initial system message are not supported by Anthropic. Configure the initial tool set via the tools option instead. The tool changes have been ignored."
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
system = content.filter(
|
|
1572
|
+
(part) => part.type === "text"
|
|
1573
|
+
);
|
|
1506
1574
|
} else {
|
|
1507
1575
|
messages.push({ role: "system", content });
|
|
1508
1576
|
betas.add("mid-conversation-system-2026-04-07");
|
|
1577
|
+
if (toolChangeCount > 0) {
|
|
1578
|
+
betas.add("mid-conversation-tool-changes-2026-07-01");
|
|
1579
|
+
}
|
|
1509
1580
|
}
|
|
1510
1581
|
break;
|
|
1511
1582
|
}
|
|
@@ -1518,10 +1589,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1518
1589
|
for (let j = 0; j < content.length; j++) {
|
|
1519
1590
|
const part = content[j];
|
|
1520
1591
|
const isLastPart = j === content.length - 1;
|
|
1521
|
-
const cacheControl = (
|
|
1592
|
+
const cacheControl = (_b = validator.getCacheControl(part.providerOptions, {
|
|
1522
1593
|
type: "user message part",
|
|
1523
1594
|
canCache: true
|
|
1524
|
-
})) != null ?
|
|
1595
|
+
})) != null ? _b : isLastPart ? validator.getCacheControl(message.providerOptions, {
|
|
1525
1596
|
type: "user message",
|
|
1526
1597
|
canCache: true
|
|
1527
1598
|
}) : void 0;
|
|
@@ -1566,7 +1637,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1566
1637
|
media_type: "application/pdf",
|
|
1567
1638
|
data: convertToBase64(part.data)
|
|
1568
1639
|
},
|
|
1569
|
-
title: (
|
|
1640
|
+
title: (_c = metadata.title) != null ? _c : part.filename,
|
|
1570
1641
|
...metadata.context && { context: metadata.context },
|
|
1571
1642
|
...enableCitations && {
|
|
1572
1643
|
citations: { enabled: true }
|
|
@@ -1590,7 +1661,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1590
1661
|
media_type: "text/plain",
|
|
1591
1662
|
data: convertToString(part.data)
|
|
1592
1663
|
},
|
|
1593
|
-
title: (
|
|
1664
|
+
title: (_d = metadata.title) != null ? _d : part.filename,
|
|
1594
1665
|
...metadata.context && { context: metadata.context },
|
|
1595
1666
|
...enableCitations && {
|
|
1596
1667
|
citations: { enabled: true }
|
|
@@ -1612,10 +1683,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1612
1683
|
for (let i2 = 0; i2 < content.length; i2++) {
|
|
1613
1684
|
const part = content[i2];
|
|
1614
1685
|
const isLastPart = i2 === content.length - 1;
|
|
1615
|
-
const cacheControl = (
|
|
1686
|
+
const cacheControl = (_e = validator.getCacheControl(part.providerOptions, {
|
|
1616
1687
|
type: "tool result part",
|
|
1617
1688
|
canCache: true
|
|
1618
|
-
})) != null ?
|
|
1689
|
+
})) != null ? _e : isLastPart ? validator.getCacheControl(message.providerOptions, {
|
|
1619
1690
|
type: "tool result message",
|
|
1620
1691
|
canCache: true
|
|
1621
1692
|
}) : void 0;
|
|
@@ -1697,16 +1768,16 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1697
1768
|
for (let k = 0; k < content.length; k++) {
|
|
1698
1769
|
const part = content[k];
|
|
1699
1770
|
const isLastContentPart = k === content.length - 1;
|
|
1700
|
-
const cacheControl = (
|
|
1771
|
+
const cacheControl = (_f = validator.getCacheControl(part.providerOptions, {
|
|
1701
1772
|
type: "assistant message part",
|
|
1702
1773
|
canCache: true
|
|
1703
|
-
})) != null ?
|
|
1774
|
+
})) != null ? _f : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
|
|
1704
1775
|
type: "assistant message",
|
|
1705
1776
|
canCache: true
|
|
1706
1777
|
}) : void 0;
|
|
1707
1778
|
switch (part.type) {
|
|
1708
1779
|
case "text": {
|
|
1709
|
-
const textMetadata = (
|
|
1780
|
+
const textMetadata = (_g = part.providerOptions) == null ? void 0 : _g.anthropic;
|
|
1710
1781
|
if ((textMetadata == null ? void 0 : textMetadata.type) === "compaction") {
|
|
1711
1782
|
anthropicContent.push({
|
|
1712
1783
|
type: "compaction",
|
|
@@ -2233,7 +2304,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2233
2304
|
toolChoice,
|
|
2234
2305
|
providerOptions
|
|
2235
2306
|
}) {
|
|
2236
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2307
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2237
2308
|
const warnings = [];
|
|
2238
2309
|
if (frequencyPenalty != null) {
|
|
2239
2310
|
warnings.push({
|
|
@@ -2292,6 +2363,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2292
2363
|
maxOutputTokens: maxOutputTokensForModel,
|
|
2293
2364
|
supportsStructuredOutput,
|
|
2294
2365
|
rejectsSamplingParameters,
|
|
2366
|
+
rejectsThinkingDisabledAboveHighEffort,
|
|
2295
2367
|
isKnownModel
|
|
2296
2368
|
} = getModelCapabilities(this.modelId);
|
|
2297
2369
|
if (!isKnownModel && maxOutputTokens == null) {
|
|
@@ -2326,7 +2398,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2326
2398
|
topP = void 0;
|
|
2327
2399
|
}
|
|
2328
2400
|
}
|
|
2329
|
-
const isAnthropicModel = isKnownModel || this.modelId.
|
|
2401
|
+
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
2330
2402
|
const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : "jsonTool";
|
|
2331
2403
|
const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
2332
2404
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
@@ -2349,10 +2421,18 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2349
2421
|
warnings,
|
|
2350
2422
|
cacheControlValidator
|
|
2351
2423
|
});
|
|
2352
|
-
|
|
2424
|
+
if (rejectsThinkingDisabledAboveHighEffort && ((_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type) === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
2425
|
+
warnings.push({
|
|
2426
|
+
type: "unsupported-setting",
|
|
2427
|
+
setting: "providerOptions.anthropic.effort",
|
|
2428
|
+
details: `effort '${anthropicOptions.effort}' is not supported by ${this.modelId} when thinking is disabled. The effort has been lowered to 'high'.`
|
|
2429
|
+
});
|
|
2430
|
+
anthropicOptions.effort = "high";
|
|
2431
|
+
}
|
|
2432
|
+
const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
|
|
2353
2433
|
const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
|
|
2354
|
-
let thinkingBudget = thinkingType === "enabled" ? (
|
|
2355
|
-
const thinkingDisplay = thinkingType === "adaptive" ? (
|
|
2434
|
+
let thinkingBudget = thinkingType === "enabled" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens : void 0;
|
|
2435
|
+
const thinkingDisplay = thinkingType === "adaptive" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.display : void 0;
|
|
2356
2436
|
const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
|
|
2357
2437
|
const baseArgs = {
|
|
2358
2438
|
// model id:
|
|
@@ -2399,20 +2479,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2399
2479
|
...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
|
|
2400
2480
|
inference_geo: anthropicOptions.inferenceGeo
|
|
2401
2481
|
},
|
|
2402
|
-
...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0 && {
|
|
2482
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) != null && (anthropicOptions.fallbacks === "default" || anthropicOptions.fallbacks.length > 0) && {
|
|
2403
2483
|
fallbacks: anthropicOptions.fallbacks
|
|
2404
2484
|
},
|
|
2405
2485
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
2406
2486
|
cache_control: anthropicOptions.cacheControl
|
|
2407
2487
|
},
|
|
2408
|
-
...((
|
|
2488
|
+
...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
|
|
2409
2489
|
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
2410
2490
|
},
|
|
2411
2491
|
// container with agent skills:
|
|
2412
2492
|
...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
|
|
2413
2493
|
container: {
|
|
2414
2494
|
id: anthropicOptions.container.id,
|
|
2415
|
-
skills: (
|
|
2495
|
+
skills: (_h = anthropicOptions.container.skills) == null ? void 0 : _h.map((skill) => ({
|
|
2416
2496
|
type: skill.type,
|
|
2417
2497
|
skill_id: skill.skillId,
|
|
2418
2498
|
version: skill.version
|
|
@@ -2544,7 +2624,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2544
2624
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
|
|
2545
2625
|
betas.add("fast-mode-2026-02-01");
|
|
2546
2626
|
}
|
|
2547
|
-
if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks)
|
|
2627
|
+
if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) === "default") {
|
|
2628
|
+
betas.add("server-side-fallback-2026-07-01");
|
|
2629
|
+
} else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
|
|
2548
2630
|
betas.add("server-side-fallback-2026-06-01");
|
|
2549
2631
|
}
|
|
2550
2632
|
if (useStructuredOutput) {
|
|
@@ -2587,7 +2669,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2587
2669
|
...betas,
|
|
2588
2670
|
...toolsBetas,
|
|
2589
2671
|
...userSuppliedBetas,
|
|
2590
|
-
...(
|
|
2672
|
+
...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
|
|
2591
2673
|
]),
|
|
2592
2674
|
usesJsonResponseTool: jsonResponseTool != null
|
|
2593
2675
|
};
|
|
@@ -3603,11 +3685,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3603
3685
|
}
|
|
3604
3686
|
};
|
|
3605
3687
|
function getModelCapabilities(modelId) {
|
|
3606
|
-
if (modelId.includes("claude-opus-
|
|
3688
|
+
if (modelId.includes("claude-opus-5")) {
|
|
3607
3689
|
return {
|
|
3608
3690
|
maxOutputTokens: 128e3,
|
|
3609
3691
|
supportsStructuredOutput: true,
|
|
3610
3692
|
rejectsSamplingParameters: true,
|
|
3693
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
3694
|
+
isKnownModel: true
|
|
3695
|
+
};
|
|
3696
|
+
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
|
|
3697
|
+
return {
|
|
3698
|
+
maxOutputTokens: 128e3,
|
|
3699
|
+
supportsStructuredOutput: true,
|
|
3700
|
+
rejectsSamplingParameters: true,
|
|
3701
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3611
3702
|
isKnownModel: true
|
|
3612
3703
|
};
|
|
3613
3704
|
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
@@ -3615,6 +3706,7 @@ function getModelCapabilities(modelId) {
|
|
|
3615
3706
|
maxOutputTokens: 128e3,
|
|
3616
3707
|
supportsStructuredOutput: true,
|
|
3617
3708
|
rejectsSamplingParameters: false,
|
|
3709
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3618
3710
|
isKnownModel: true
|
|
3619
3711
|
};
|
|
3620
3712
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
@@ -3622,6 +3714,7 @@ function getModelCapabilities(modelId) {
|
|
|
3622
3714
|
maxOutputTokens: 64e3,
|
|
3623
3715
|
supportsStructuredOutput: true,
|
|
3624
3716
|
rejectsSamplingParameters: false,
|
|
3717
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3625
3718
|
isKnownModel: true
|
|
3626
3719
|
};
|
|
3627
3720
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
@@ -3629,6 +3722,7 @@ function getModelCapabilities(modelId) {
|
|
|
3629
3722
|
maxOutputTokens: 32e3,
|
|
3630
3723
|
supportsStructuredOutput: true,
|
|
3631
3724
|
rejectsSamplingParameters: false,
|
|
3725
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3632
3726
|
isKnownModel: true
|
|
3633
3727
|
};
|
|
3634
3728
|
} else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
|
|
@@ -3636,6 +3730,7 @@ function getModelCapabilities(modelId) {
|
|
|
3636
3730
|
maxOutputTokens: 64e3,
|
|
3637
3731
|
supportsStructuredOutput: false,
|
|
3638
3732
|
rejectsSamplingParameters: false,
|
|
3733
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3639
3734
|
isKnownModel: true
|
|
3640
3735
|
};
|
|
3641
3736
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
@@ -3643,27 +3738,39 @@ function getModelCapabilities(modelId) {
|
|
|
3643
3738
|
maxOutputTokens: 32e3,
|
|
3644
3739
|
supportsStructuredOutput: false,
|
|
3645
3740
|
rejectsSamplingParameters: false,
|
|
3741
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3646
3742
|
isKnownModel: true
|
|
3647
3743
|
};
|
|
3648
|
-
} else if (modelId.includes("claude-3-
|
|
3744
|
+
} else if (modelId.includes("claude-3-haiku")) {
|
|
3649
3745
|
return {
|
|
3650
|
-
maxOutputTokens:
|
|
3746
|
+
maxOutputTokens: 4096,
|
|
3651
3747
|
supportsStructuredOutput: false,
|
|
3652
3748
|
rejectsSamplingParameters: false,
|
|
3749
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3653
3750
|
isKnownModel: true
|
|
3654
3751
|
};
|
|
3655
|
-
} else if (
|
|
3752
|
+
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
3656
3753
|
return {
|
|
3657
3754
|
maxOutputTokens: 4096,
|
|
3658
3755
|
supportsStructuredOutput: false,
|
|
3659
3756
|
rejectsSamplingParameters: false,
|
|
3660
|
-
|
|
3757
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3758
|
+
isKnownModel: false
|
|
3759
|
+
};
|
|
3760
|
+
} else if (modelId.includes("claude-")) {
|
|
3761
|
+
return {
|
|
3762
|
+
maxOutputTokens: 128e3,
|
|
3763
|
+
supportsStructuredOutput: true,
|
|
3764
|
+
rejectsSamplingParameters: true,
|
|
3765
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
3766
|
+
isKnownModel: false
|
|
3661
3767
|
};
|
|
3662
3768
|
} else {
|
|
3663
3769
|
return {
|
|
3664
3770
|
maxOutputTokens: 4096,
|
|
3665
3771
|
supportsStructuredOutput: false,
|
|
3666
3772
|
rejectsSamplingParameters: false,
|
|
3773
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3667
3774
|
isKnownModel: false
|
|
3668
3775
|
};
|
|
3669
3776
|
}
|