@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/internal/index.mjs
CHANGED
|
@@ -647,7 +647,40 @@ var anthropicFilePartProviderOptions = z3.object({
|
|
|
647
647
|
*/
|
|
648
648
|
context: z3.string().optional()
|
|
649
649
|
});
|
|
650
|
+
var anthropicSystemMessageProviderOptions = z3.object({
|
|
651
|
+
/**
|
|
652
|
+
* Mid-conversation tool changes. Adds or removes tools from the
|
|
653
|
+
* conversation's tool set between turns without invalidating the prompt
|
|
654
|
+
* cache.
|
|
655
|
+
*
|
|
656
|
+
* Only supported on system messages that appear mid-conversation (not the
|
|
657
|
+
* initial system prompt). A system message carrying tool changes must come
|
|
658
|
+
* right before an assistant message or at the end of the messages.
|
|
659
|
+
*
|
|
660
|
+
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
661
|
+
* option (typically with `deferLoading: true` so they are not loaded until
|
|
662
|
+
* the addition surfaces them). The required
|
|
663
|
+
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
664
|
+
*/
|
|
665
|
+
toolChanges: z3.array(
|
|
666
|
+
z3.discriminatedUnion("type", [
|
|
667
|
+
z3.object({
|
|
668
|
+
type: z3.literal("tool_addition"),
|
|
669
|
+
toolName: z3.string()
|
|
670
|
+
}),
|
|
671
|
+
z3.object({
|
|
672
|
+
type: z3.literal("tool_removal"),
|
|
673
|
+
toolName: z3.string()
|
|
674
|
+
})
|
|
675
|
+
])
|
|
676
|
+
).optional()
|
|
677
|
+
});
|
|
650
678
|
var anthropicProviderOptions = z3.object({
|
|
679
|
+
/**
|
|
680
|
+
* Whether to send reasoning to the model.
|
|
681
|
+
*
|
|
682
|
+
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
683
|
+
*/
|
|
651
684
|
sendReasoning: z3.boolean().optional(),
|
|
652
685
|
/**
|
|
653
686
|
* Determines how structured outputs are generated.
|
|
@@ -756,30 +789,35 @@ var anthropicProviderOptions = z3.object({
|
|
|
756
789
|
*/
|
|
757
790
|
inferenceGeo: z3.enum(["us", "global"]).optional(),
|
|
758
791
|
/**
|
|
759
|
-
* Server-side fallback
|
|
792
|
+
* Server-side fallback configuration.
|
|
760
793
|
*
|
|
761
794
|
* When the primary model's safety classifiers block a turn, the API
|
|
762
|
-
* automatically retries it on
|
|
763
|
-
* `content-filter` finish reason means the
|
|
764
|
-
*
|
|
765
|
-
* Each entry is merged into the request as a direct request to that entry's
|
|
766
|
-
* model, so it must be formatted accordingly: `model` is required, and an
|
|
767
|
-
* entry may additionally override `max_tokens`, `thinking`, `output_config`,
|
|
768
|
-
* and `speed` for that attempt only (`speed` additionally requires the speed
|
|
769
|
-
* beta). The value is passed through to the API as-is.
|
|
795
|
+
* automatically retries it server-side on a fallback model. A
|
|
796
|
+
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
770
797
|
*
|
|
771
|
-
*
|
|
772
|
-
*
|
|
798
|
+
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
799
|
+
* recommended fallback model based on the refusal category. Requires the
|
|
800
|
+
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
801
|
+
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
802
|
+
* request as a direct request to that entry's model, so it must be
|
|
803
|
+
* formatted accordingly: `model` is required, and an entry may
|
|
804
|
+
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
805
|
+
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
806
|
+
* beta). The value is passed through to the API as-is, and the
|
|
807
|
+
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
773
808
|
*/
|
|
774
|
-
fallbacks: z3.
|
|
775
|
-
z3.
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
809
|
+
fallbacks: z3.union([
|
|
810
|
+
z3.literal("default"),
|
|
811
|
+
z3.array(
|
|
812
|
+
z3.object({
|
|
813
|
+
model: z3.string(),
|
|
814
|
+
max_tokens: z3.number().int().optional(),
|
|
815
|
+
thinking: z3.record(z3.string(), z3.unknown()).optional(),
|
|
816
|
+
output_config: z3.record(z3.string(), z3.unknown()).optional(),
|
|
817
|
+
speed: z3.enum(["fast", "standard"]).optional()
|
|
818
|
+
})
|
|
819
|
+
)
|
|
820
|
+
]).optional(),
|
|
783
821
|
/**
|
|
784
822
|
* Context management configuration for automatic context window management.
|
|
785
823
|
* Enables features like automatic compaction and clearing of tool uses/thinking blocks.
|
|
@@ -1446,7 +1484,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1446
1484
|
warnings,
|
|
1447
1485
|
cacheControlValidator
|
|
1448
1486
|
}) {
|
|
1449
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1487
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1450
1488
|
const betas = /* @__PURE__ */ new Set();
|
|
1451
1489
|
const blocks = groupIntoBlocks(prompt);
|
|
1452
1490
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -1478,19 +1516,52 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1478
1516
|
const type = block.type;
|
|
1479
1517
|
switch (type) {
|
|
1480
1518
|
case "system": {
|
|
1481
|
-
const content =
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1519
|
+
const content = [];
|
|
1520
|
+
let toolChangeCount = 0;
|
|
1521
|
+
for (const { content: text, providerOptions } of block.messages) {
|
|
1522
|
+
const systemMessageOptions = await parseProviderOptions({
|
|
1523
|
+
provider: "anthropic",
|
|
1524
|
+
providerOptions,
|
|
1525
|
+
schema: anthropicSystemMessageProviderOptions
|
|
1526
|
+
});
|
|
1527
|
+
const toolChanges = (_a = systemMessageOptions == null ? void 0 : systemMessageOptions.toolChanges) != null ? _a : [];
|
|
1528
|
+
if (text !== "" || toolChanges.length === 0) {
|
|
1529
|
+
content.push({
|
|
1530
|
+
type: "text",
|
|
1531
|
+
text,
|
|
1532
|
+
cache_control: validator.getCacheControl(providerOptions, {
|
|
1533
|
+
type: "system message",
|
|
1534
|
+
canCache: true
|
|
1535
|
+
})
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
for (const toolChange of toolChanges) {
|
|
1539
|
+
toolChangeCount++;
|
|
1540
|
+
content.push({
|
|
1541
|
+
type: toolChange.type,
|
|
1542
|
+
tool: {
|
|
1543
|
+
type: "tool_reference",
|
|
1544
|
+
name: toolChange.toolName
|
|
1545
|
+
}
|
|
1546
|
+
});
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
if (i === 0 || system == null && toolChangeCount === 0) {
|
|
1550
|
+
if (toolChangeCount > 0) {
|
|
1551
|
+
warnings.push({
|
|
1552
|
+
type: "other",
|
|
1553
|
+
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."
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
system = content.filter(
|
|
1557
|
+
(part) => part.type === "text"
|
|
1558
|
+
);
|
|
1491
1559
|
} else {
|
|
1492
1560
|
messages.push({ role: "system", content });
|
|
1493
1561
|
betas.add("mid-conversation-system-2026-04-07");
|
|
1562
|
+
if (toolChangeCount > 0) {
|
|
1563
|
+
betas.add("mid-conversation-tool-changes-2026-07-01");
|
|
1564
|
+
}
|
|
1494
1565
|
}
|
|
1495
1566
|
break;
|
|
1496
1567
|
}
|
|
@@ -1503,10 +1574,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1503
1574
|
for (let j = 0; j < content.length; j++) {
|
|
1504
1575
|
const part = content[j];
|
|
1505
1576
|
const isLastPart = j === content.length - 1;
|
|
1506
|
-
const cacheControl = (
|
|
1577
|
+
const cacheControl = (_b = validator.getCacheControl(part.providerOptions, {
|
|
1507
1578
|
type: "user message part",
|
|
1508
1579
|
canCache: true
|
|
1509
|
-
})) != null ?
|
|
1580
|
+
})) != null ? _b : isLastPart ? validator.getCacheControl(message.providerOptions, {
|
|
1510
1581
|
type: "user message",
|
|
1511
1582
|
canCache: true
|
|
1512
1583
|
}) : void 0;
|
|
@@ -1551,7 +1622,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1551
1622
|
media_type: "application/pdf",
|
|
1552
1623
|
data: convertToBase64(part.data)
|
|
1553
1624
|
},
|
|
1554
|
-
title: (
|
|
1625
|
+
title: (_c = metadata.title) != null ? _c : part.filename,
|
|
1555
1626
|
...metadata.context && { context: metadata.context },
|
|
1556
1627
|
...enableCitations && {
|
|
1557
1628
|
citations: { enabled: true }
|
|
@@ -1575,7 +1646,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1575
1646
|
media_type: "text/plain",
|
|
1576
1647
|
data: convertToString(part.data)
|
|
1577
1648
|
},
|
|
1578
|
-
title: (
|
|
1649
|
+
title: (_d = metadata.title) != null ? _d : part.filename,
|
|
1579
1650
|
...metadata.context && { context: metadata.context },
|
|
1580
1651
|
...enableCitations && {
|
|
1581
1652
|
citations: { enabled: true }
|
|
@@ -1597,10 +1668,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1597
1668
|
for (let i2 = 0; i2 < content.length; i2++) {
|
|
1598
1669
|
const part = content[i2];
|
|
1599
1670
|
const isLastPart = i2 === content.length - 1;
|
|
1600
|
-
const cacheControl = (
|
|
1671
|
+
const cacheControl = (_e = validator.getCacheControl(part.providerOptions, {
|
|
1601
1672
|
type: "tool result part",
|
|
1602
1673
|
canCache: true
|
|
1603
|
-
})) != null ?
|
|
1674
|
+
})) != null ? _e : isLastPart ? validator.getCacheControl(message.providerOptions, {
|
|
1604
1675
|
type: "tool result message",
|
|
1605
1676
|
canCache: true
|
|
1606
1677
|
}) : void 0;
|
|
@@ -1682,16 +1753,16 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1682
1753
|
for (let k = 0; k < content.length; k++) {
|
|
1683
1754
|
const part = content[k];
|
|
1684
1755
|
const isLastContentPart = k === content.length - 1;
|
|
1685
|
-
const cacheControl = (
|
|
1756
|
+
const cacheControl = (_f = validator.getCacheControl(part.providerOptions, {
|
|
1686
1757
|
type: "assistant message part",
|
|
1687
1758
|
canCache: true
|
|
1688
|
-
})) != null ?
|
|
1759
|
+
})) != null ? _f : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
|
|
1689
1760
|
type: "assistant message",
|
|
1690
1761
|
canCache: true
|
|
1691
1762
|
}) : void 0;
|
|
1692
1763
|
switch (part.type) {
|
|
1693
1764
|
case "text": {
|
|
1694
|
-
const textMetadata = (
|
|
1765
|
+
const textMetadata = (_g = part.providerOptions) == null ? void 0 : _g.anthropic;
|
|
1695
1766
|
if ((textMetadata == null ? void 0 : textMetadata.type) === "compaction") {
|
|
1696
1767
|
anthropicContent.push({
|
|
1697
1768
|
type: "compaction",
|
|
@@ -2218,7 +2289,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2218
2289
|
toolChoice,
|
|
2219
2290
|
providerOptions
|
|
2220
2291
|
}) {
|
|
2221
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2292
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2222
2293
|
const warnings = [];
|
|
2223
2294
|
if (frequencyPenalty != null) {
|
|
2224
2295
|
warnings.push({
|
|
@@ -2277,6 +2348,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2277
2348
|
maxOutputTokens: maxOutputTokensForModel,
|
|
2278
2349
|
supportsStructuredOutput,
|
|
2279
2350
|
rejectsSamplingParameters,
|
|
2351
|
+
rejectsThinkingDisabledAboveHighEffort,
|
|
2280
2352
|
isKnownModel
|
|
2281
2353
|
} = getModelCapabilities(this.modelId);
|
|
2282
2354
|
if (!isKnownModel && maxOutputTokens == null) {
|
|
@@ -2311,7 +2383,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2311
2383
|
topP = void 0;
|
|
2312
2384
|
}
|
|
2313
2385
|
}
|
|
2314
|
-
const isAnthropicModel = isKnownModel || this.modelId.
|
|
2386
|
+
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
2315
2387
|
const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : "jsonTool";
|
|
2316
2388
|
const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
2317
2389
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
@@ -2334,10 +2406,18 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2334
2406
|
warnings,
|
|
2335
2407
|
cacheControlValidator
|
|
2336
2408
|
});
|
|
2337
|
-
|
|
2409
|
+
if (rejectsThinkingDisabledAboveHighEffort && ((_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type) === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
2410
|
+
warnings.push({
|
|
2411
|
+
type: "unsupported-setting",
|
|
2412
|
+
setting: "providerOptions.anthropic.effort",
|
|
2413
|
+
details: `effort '${anthropicOptions.effort}' is not supported by ${this.modelId} when thinking is disabled. The effort has been lowered to 'high'.`
|
|
2414
|
+
});
|
|
2415
|
+
anthropicOptions.effort = "high";
|
|
2416
|
+
}
|
|
2417
|
+
const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
|
|
2338
2418
|
const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
|
|
2339
|
-
let thinkingBudget = thinkingType === "enabled" ? (
|
|
2340
|
-
const thinkingDisplay = thinkingType === "adaptive" ? (
|
|
2419
|
+
let thinkingBudget = thinkingType === "enabled" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens : void 0;
|
|
2420
|
+
const thinkingDisplay = thinkingType === "adaptive" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.display : void 0;
|
|
2341
2421
|
const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
|
|
2342
2422
|
const baseArgs = {
|
|
2343
2423
|
// model id:
|
|
@@ -2384,20 +2464,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2384
2464
|
...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
|
|
2385
2465
|
inference_geo: anthropicOptions.inferenceGeo
|
|
2386
2466
|
},
|
|
2387
|
-
...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0 && {
|
|
2467
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) != null && (anthropicOptions.fallbacks === "default" || anthropicOptions.fallbacks.length > 0) && {
|
|
2388
2468
|
fallbacks: anthropicOptions.fallbacks
|
|
2389
2469
|
},
|
|
2390
2470
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
2391
2471
|
cache_control: anthropicOptions.cacheControl
|
|
2392
2472
|
},
|
|
2393
|
-
...((
|
|
2473
|
+
...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
|
|
2394
2474
|
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
2395
2475
|
},
|
|
2396
2476
|
// container with agent skills:
|
|
2397
2477
|
...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
|
|
2398
2478
|
container: {
|
|
2399
2479
|
id: anthropicOptions.container.id,
|
|
2400
|
-
skills: (
|
|
2480
|
+
skills: (_h = anthropicOptions.container.skills) == null ? void 0 : _h.map((skill) => ({
|
|
2401
2481
|
type: skill.type,
|
|
2402
2482
|
skill_id: skill.skillId,
|
|
2403
2483
|
version: skill.version
|
|
@@ -2529,7 +2609,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2529
2609
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
|
|
2530
2610
|
betas.add("fast-mode-2026-02-01");
|
|
2531
2611
|
}
|
|
2532
|
-
if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks)
|
|
2612
|
+
if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) === "default") {
|
|
2613
|
+
betas.add("server-side-fallback-2026-07-01");
|
|
2614
|
+
} else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
|
|
2533
2615
|
betas.add("server-side-fallback-2026-06-01");
|
|
2534
2616
|
}
|
|
2535
2617
|
if (useStructuredOutput) {
|
|
@@ -2572,7 +2654,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2572
2654
|
...betas,
|
|
2573
2655
|
...toolsBetas,
|
|
2574
2656
|
...userSuppliedBetas,
|
|
2575
|
-
...(
|
|
2657
|
+
...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
|
|
2576
2658
|
]),
|
|
2577
2659
|
usesJsonResponseTool: jsonResponseTool != null
|
|
2578
2660
|
};
|
|
@@ -3588,11 +3670,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3588
3670
|
}
|
|
3589
3671
|
};
|
|
3590
3672
|
function getModelCapabilities(modelId) {
|
|
3591
|
-
if (modelId.includes("claude-opus-
|
|
3673
|
+
if (modelId.includes("claude-opus-5")) {
|
|
3592
3674
|
return {
|
|
3593
3675
|
maxOutputTokens: 128e3,
|
|
3594
3676
|
supportsStructuredOutput: true,
|
|
3595
3677
|
rejectsSamplingParameters: true,
|
|
3678
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
3679
|
+
isKnownModel: true
|
|
3680
|
+
};
|
|
3681
|
+
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
|
|
3682
|
+
return {
|
|
3683
|
+
maxOutputTokens: 128e3,
|
|
3684
|
+
supportsStructuredOutput: true,
|
|
3685
|
+
rejectsSamplingParameters: true,
|
|
3686
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3596
3687
|
isKnownModel: true
|
|
3597
3688
|
};
|
|
3598
3689
|
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
@@ -3600,6 +3691,7 @@ function getModelCapabilities(modelId) {
|
|
|
3600
3691
|
maxOutputTokens: 128e3,
|
|
3601
3692
|
supportsStructuredOutput: true,
|
|
3602
3693
|
rejectsSamplingParameters: false,
|
|
3694
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3603
3695
|
isKnownModel: true
|
|
3604
3696
|
};
|
|
3605
3697
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
@@ -3607,6 +3699,7 @@ function getModelCapabilities(modelId) {
|
|
|
3607
3699
|
maxOutputTokens: 64e3,
|
|
3608
3700
|
supportsStructuredOutput: true,
|
|
3609
3701
|
rejectsSamplingParameters: false,
|
|
3702
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3610
3703
|
isKnownModel: true
|
|
3611
3704
|
};
|
|
3612
3705
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
@@ -3614,6 +3707,7 @@ function getModelCapabilities(modelId) {
|
|
|
3614
3707
|
maxOutputTokens: 32e3,
|
|
3615
3708
|
supportsStructuredOutput: true,
|
|
3616
3709
|
rejectsSamplingParameters: false,
|
|
3710
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3617
3711
|
isKnownModel: true
|
|
3618
3712
|
};
|
|
3619
3713
|
} else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
|
|
@@ -3621,6 +3715,7 @@ function getModelCapabilities(modelId) {
|
|
|
3621
3715
|
maxOutputTokens: 64e3,
|
|
3622
3716
|
supportsStructuredOutput: false,
|
|
3623
3717
|
rejectsSamplingParameters: false,
|
|
3718
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3624
3719
|
isKnownModel: true
|
|
3625
3720
|
};
|
|
3626
3721
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
@@ -3628,27 +3723,39 @@ function getModelCapabilities(modelId) {
|
|
|
3628
3723
|
maxOutputTokens: 32e3,
|
|
3629
3724
|
supportsStructuredOutput: false,
|
|
3630
3725
|
rejectsSamplingParameters: false,
|
|
3726
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3631
3727
|
isKnownModel: true
|
|
3632
3728
|
};
|
|
3633
|
-
} else if (modelId.includes("claude-3-
|
|
3729
|
+
} else if (modelId.includes("claude-3-haiku")) {
|
|
3634
3730
|
return {
|
|
3635
|
-
maxOutputTokens:
|
|
3731
|
+
maxOutputTokens: 4096,
|
|
3636
3732
|
supportsStructuredOutput: false,
|
|
3637
3733
|
rejectsSamplingParameters: false,
|
|
3734
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3638
3735
|
isKnownModel: true
|
|
3639
3736
|
};
|
|
3640
|
-
} else if (
|
|
3737
|
+
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
3641
3738
|
return {
|
|
3642
3739
|
maxOutputTokens: 4096,
|
|
3643
3740
|
supportsStructuredOutput: false,
|
|
3644
3741
|
rejectsSamplingParameters: false,
|
|
3645
|
-
|
|
3742
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3743
|
+
isKnownModel: false
|
|
3744
|
+
};
|
|
3745
|
+
} else if (modelId.includes("claude-")) {
|
|
3746
|
+
return {
|
|
3747
|
+
maxOutputTokens: 128e3,
|
|
3748
|
+
supportsStructuredOutput: true,
|
|
3749
|
+
rejectsSamplingParameters: true,
|
|
3750
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
3751
|
+
isKnownModel: false
|
|
3646
3752
|
};
|
|
3647
3753
|
} else {
|
|
3648
3754
|
return {
|
|
3649
3755
|
maxOutputTokens: 4096,
|
|
3650
3756
|
supportsStructuredOutput: false,
|
|
3651
3757
|
rejectsSamplingParameters: false,
|
|
3758
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
3652
3759
|
isKnownModel: false
|
|
3653
3760
|
};
|
|
3654
3761
|
}
|