@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.
@@ -2,7 +2,7 @@ import { LanguageModelV2, JSONSchema7, SharedV2ProviderMetadata, LanguageModelV2
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-fable-5' | 'claude-sonnet-5' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-fable-5' | 'claude-sonnet-5' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -2,7 +2,7 @@ import { LanguageModelV2, JSONSchema7, SharedV2ProviderMetadata, LanguageModelV2
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-fable-5' | 'claude-sonnet-5' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-fable-5' | 'claude-sonnet-5' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -659,7 +659,40 @@ var anthropicFilePartProviderOptions = import_v43.z.object({
659
659
  */
660
660
  context: import_v43.z.string().optional()
661
661
  });
662
+ var anthropicSystemMessageProviderOptions = import_v43.z.object({
663
+ /**
664
+ * Mid-conversation tool changes. Adds or removes tools from the
665
+ * conversation's tool set between turns without invalidating the prompt
666
+ * cache.
667
+ *
668
+ * Only supported on system messages that appear mid-conversation (not the
669
+ * initial system prompt). A system message carrying tool changes must come
670
+ * right before an assistant message or at the end of the messages.
671
+ *
672
+ * Tools referenced by a `tool_addition` must be declared in the `tools`
673
+ * option (typically with `deferLoading: true` so they are not loaded until
674
+ * the addition surfaces them). The required
675
+ * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
676
+ */
677
+ toolChanges: import_v43.z.array(
678
+ import_v43.z.discriminatedUnion("type", [
679
+ import_v43.z.object({
680
+ type: import_v43.z.literal("tool_addition"),
681
+ toolName: import_v43.z.string()
682
+ }),
683
+ import_v43.z.object({
684
+ type: import_v43.z.literal("tool_removal"),
685
+ toolName: import_v43.z.string()
686
+ })
687
+ ])
688
+ ).optional()
689
+ });
662
690
  var anthropicProviderOptions = import_v43.z.object({
691
+ /**
692
+ * Whether to send reasoning to the model.
693
+ *
694
+ * This allows you to deactivate reasoning inputs for models that do not support them.
695
+ */
663
696
  sendReasoning: import_v43.z.boolean().optional(),
664
697
  /**
665
698
  * Determines how structured outputs are generated.
@@ -768,30 +801,35 @@ var anthropicProviderOptions = import_v43.z.object({
768
801
  */
769
802
  inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
770
803
  /**
771
- * Server-side fallback chain.
804
+ * Server-side fallback configuration.
772
805
  *
773
806
  * When the primary model's safety classifiers block a turn, the API
774
- * automatically retries it on the next model in the chain, server-side. A
775
- * `content-filter` finish reason means the entire chain refused.
776
- *
777
- * Each entry is merged into the request as a direct request to that entry's
778
- * model, so it must be formatted accordingly: `model` is required, and an
779
- * entry may additionally override `max_tokens`, `thinking`, `output_config`,
780
- * and `speed` for that attempt only (`speed` additionally requires the speed
781
- * beta). The value is passed through to the API as-is.
807
+ * automatically retries it server-side on a fallback model. A
808
+ * `content-filter` finish reason means the fallback(s) refused as well.
782
809
  *
783
- * The required `server-side-fallback-2026-06-01` beta is added automatically
784
- * when this option is set.
810
+ * - `'default'` (recommended): the API routes the retry to Anthropic's
811
+ * recommended fallback model based on the refusal category. Requires the
812
+ * `server-side-fallback-2026-07-01` beta, which is added automatically.
813
+ * - Array form: an explicit fallback chain. Each entry is merged into the
814
+ * request as a direct request to that entry's model, so it must be
815
+ * formatted accordingly: `model` is required, and an entry may
816
+ * additionally override `max_tokens`, `thinking`, `output_config`, and
817
+ * `speed` for that attempt only (`speed` additionally requires the speed
818
+ * beta). The value is passed through to the API as-is, and the
819
+ * `server-side-fallback-2026-06-01` beta is added automatically.
785
820
  */
786
- fallbacks: import_v43.z.array(
787
- import_v43.z.object({
788
- model: import_v43.z.string(),
789
- max_tokens: import_v43.z.number().int().optional(),
790
- thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
791
- output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
792
- speed: import_v43.z.enum(["fast", "standard"]).optional()
793
- })
794
- ).optional(),
821
+ fallbacks: import_v43.z.union([
822
+ import_v43.z.literal("default"),
823
+ import_v43.z.array(
824
+ import_v43.z.object({
825
+ model: import_v43.z.string(),
826
+ max_tokens: import_v43.z.number().int().optional(),
827
+ thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
828
+ output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
829
+ speed: import_v43.z.enum(["fast", "standard"]).optional()
830
+ })
831
+ )
832
+ ]).optional(),
795
833
  /**
796
834
  * Context management configuration for automatic context window management.
797
835
  * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
@@ -1430,7 +1468,7 @@ async function convertToAnthropicMessagesPrompt({
1430
1468
  warnings,
1431
1469
  cacheControlValidator
1432
1470
  }) {
1433
- var _a, _b, _c, _d, _e, _f;
1471
+ var _a, _b, _c, _d, _e, _f, _g;
1434
1472
  const betas = /* @__PURE__ */ new Set();
1435
1473
  const blocks = groupIntoBlocks(prompt);
1436
1474
  const validator = cacheControlValidator || new CacheControlValidator();
@@ -1462,19 +1500,52 @@ async function convertToAnthropicMessagesPrompt({
1462
1500
  const type = block.type;
1463
1501
  switch (type) {
1464
1502
  case "system": {
1465
- const content = block.messages.map(({ content: content2, providerOptions }) => ({
1466
- type: "text",
1467
- text: content2,
1468
- cache_control: validator.getCacheControl(providerOptions, {
1469
- type: "system message",
1470
- canCache: true
1471
- })
1472
- }));
1473
- if (system == null) {
1474
- system = content;
1503
+ const content = [];
1504
+ let toolChangeCount = 0;
1505
+ for (const { content: text, providerOptions } of block.messages) {
1506
+ const systemMessageOptions = await (0, import_provider_utils9.parseProviderOptions)({
1507
+ provider: "anthropic",
1508
+ providerOptions,
1509
+ schema: anthropicSystemMessageProviderOptions
1510
+ });
1511
+ const toolChanges = (_a = systemMessageOptions == null ? void 0 : systemMessageOptions.toolChanges) != null ? _a : [];
1512
+ if (text !== "" || toolChanges.length === 0) {
1513
+ content.push({
1514
+ type: "text",
1515
+ text,
1516
+ cache_control: validator.getCacheControl(providerOptions, {
1517
+ type: "system message",
1518
+ canCache: true
1519
+ })
1520
+ });
1521
+ }
1522
+ for (const toolChange of toolChanges) {
1523
+ toolChangeCount++;
1524
+ content.push({
1525
+ type: toolChange.type,
1526
+ tool: {
1527
+ type: "tool_reference",
1528
+ name: toolChange.toolName
1529
+ }
1530
+ });
1531
+ }
1532
+ }
1533
+ if (i === 0 || system == null && toolChangeCount === 0) {
1534
+ if (toolChangeCount > 0) {
1535
+ warnings.push({
1536
+ type: "other",
1537
+ 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."
1538
+ });
1539
+ }
1540
+ system = content.filter(
1541
+ (part) => part.type === "text"
1542
+ );
1475
1543
  } else {
1476
1544
  messages.push({ role: "system", content });
1477
1545
  betas.add("mid-conversation-system-2026-04-07");
1546
+ if (toolChangeCount > 0) {
1547
+ betas.add("mid-conversation-tool-changes-2026-07-01");
1548
+ }
1478
1549
  }
1479
1550
  break;
1480
1551
  }
@@ -1487,10 +1558,10 @@ async function convertToAnthropicMessagesPrompt({
1487
1558
  for (let j = 0; j < content.length; j++) {
1488
1559
  const part = content[j];
1489
1560
  const isLastPart = j === content.length - 1;
1490
- const cacheControl = (_a = validator.getCacheControl(part.providerOptions, {
1561
+ const cacheControl = (_b = validator.getCacheControl(part.providerOptions, {
1491
1562
  type: "user message part",
1492
1563
  canCache: true
1493
- })) != null ? _a : isLastPart ? validator.getCacheControl(message.providerOptions, {
1564
+ })) != null ? _b : isLastPart ? validator.getCacheControl(message.providerOptions, {
1494
1565
  type: "user message",
1495
1566
  canCache: true
1496
1567
  }) : void 0;
@@ -1535,7 +1606,7 @@ async function convertToAnthropicMessagesPrompt({
1535
1606
  media_type: "application/pdf",
1536
1607
  data: (0, import_provider_utils9.convertToBase64)(part.data)
1537
1608
  },
1538
- title: (_b = metadata.title) != null ? _b : part.filename,
1609
+ title: (_c = metadata.title) != null ? _c : part.filename,
1539
1610
  ...metadata.context && { context: metadata.context },
1540
1611
  ...enableCitations && {
1541
1612
  citations: { enabled: true }
@@ -1559,7 +1630,7 @@ async function convertToAnthropicMessagesPrompt({
1559
1630
  media_type: "text/plain",
1560
1631
  data: convertToString(part.data)
1561
1632
  },
1562
- title: (_c = metadata.title) != null ? _c : part.filename,
1633
+ title: (_d = metadata.title) != null ? _d : part.filename,
1563
1634
  ...metadata.context && { context: metadata.context },
1564
1635
  ...enableCitations && {
1565
1636
  citations: { enabled: true }
@@ -1581,10 +1652,10 @@ async function convertToAnthropicMessagesPrompt({
1581
1652
  for (let i2 = 0; i2 < content.length; i2++) {
1582
1653
  const part = content[i2];
1583
1654
  const isLastPart = i2 === content.length - 1;
1584
- const cacheControl = (_d = validator.getCacheControl(part.providerOptions, {
1655
+ const cacheControl = (_e = validator.getCacheControl(part.providerOptions, {
1585
1656
  type: "tool result part",
1586
1657
  canCache: true
1587
- })) != null ? _d : isLastPart ? validator.getCacheControl(message.providerOptions, {
1658
+ })) != null ? _e : isLastPart ? validator.getCacheControl(message.providerOptions, {
1588
1659
  type: "tool result message",
1589
1660
  canCache: true
1590
1661
  }) : void 0;
@@ -1666,16 +1737,16 @@ async function convertToAnthropicMessagesPrompt({
1666
1737
  for (let k = 0; k < content.length; k++) {
1667
1738
  const part = content[k];
1668
1739
  const isLastContentPart = k === content.length - 1;
1669
- const cacheControl = (_e = validator.getCacheControl(part.providerOptions, {
1740
+ const cacheControl = (_f = validator.getCacheControl(part.providerOptions, {
1670
1741
  type: "assistant message part",
1671
1742
  canCache: true
1672
- })) != null ? _e : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
1743
+ })) != null ? _f : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
1673
1744
  type: "assistant message",
1674
1745
  canCache: true
1675
1746
  }) : void 0;
1676
1747
  switch (part.type) {
1677
1748
  case "text": {
1678
- const textMetadata = (_f = part.providerOptions) == null ? void 0 : _f.anthropic;
1749
+ const textMetadata = (_g = part.providerOptions) == null ? void 0 : _g.anthropic;
1679
1750
  if ((textMetadata == null ? void 0 : textMetadata.type) === "compaction") {
1680
1751
  anthropicContent.push({
1681
1752
  type: "compaction",
@@ -2202,7 +2273,7 @@ var AnthropicMessagesLanguageModel = class {
2202
2273
  toolChoice,
2203
2274
  providerOptions
2204
2275
  }) {
2205
- var _a, _b, _c, _d, _e, _f, _g, _h;
2276
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2206
2277
  const warnings = [];
2207
2278
  if (frequencyPenalty != null) {
2208
2279
  warnings.push({
@@ -2261,6 +2332,7 @@ var AnthropicMessagesLanguageModel = class {
2261
2332
  maxOutputTokens: maxOutputTokensForModel,
2262
2333
  supportsStructuredOutput,
2263
2334
  rejectsSamplingParameters,
2335
+ rejectsThinkingDisabledAboveHighEffort,
2264
2336
  isKnownModel
2265
2337
  } = getModelCapabilities(this.modelId);
2266
2338
  if (!isKnownModel && maxOutputTokens == null) {
@@ -2295,7 +2367,7 @@ var AnthropicMessagesLanguageModel = class {
2295
2367
  topP = void 0;
2296
2368
  }
2297
2369
  }
2298
- const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
2370
+ const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
2299
2371
  const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : "jsonTool";
2300
2372
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2301
2373
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
@@ -2318,10 +2390,18 @@ var AnthropicMessagesLanguageModel = class {
2318
2390
  warnings,
2319
2391
  cacheControlValidator
2320
2392
  });
2321
- const thinkingType = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type;
2393
+ if (rejectsThinkingDisabledAboveHighEffort && ((_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type) === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
2394
+ warnings.push({
2395
+ type: "unsupported-setting",
2396
+ setting: "providerOptions.anthropic.effort",
2397
+ details: `effort '${anthropicOptions.effort}' is not supported by ${this.modelId} when thinking is disabled. The effort has been lowered to 'high'.`
2398
+ });
2399
+ anthropicOptions.effort = "high";
2400
+ }
2401
+ const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
2322
2402
  const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
2323
- let thinkingBudget = thinkingType === "enabled" ? (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.budgetTokens : void 0;
2324
- const thinkingDisplay = thinkingType === "adaptive" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.display : void 0;
2403
+ let thinkingBudget = thinkingType === "enabled" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens : void 0;
2404
+ const thinkingDisplay = thinkingType === "adaptive" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.display : void 0;
2325
2405
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2326
2406
  const baseArgs = {
2327
2407
  // model id:
@@ -2368,20 +2448,20 @@ var AnthropicMessagesLanguageModel = class {
2368
2448
  ...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
2369
2449
  inference_geo: anthropicOptions.inferenceGeo
2370
2450
  },
2371
- ...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0 && {
2451
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) != null && (anthropicOptions.fallbacks === "default" || anthropicOptions.fallbacks.length > 0) && {
2372
2452
  fallbacks: anthropicOptions.fallbacks
2373
2453
  },
2374
2454
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
2375
2455
  cache_control: anthropicOptions.cacheControl
2376
2456
  },
2377
- ...((_f = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _f.userId) != null && {
2457
+ ...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
2378
2458
  metadata: { user_id: anthropicOptions.metadata.userId }
2379
2459
  },
2380
2460
  // container with agent skills:
2381
2461
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
2382
2462
  container: {
2383
2463
  id: anthropicOptions.container.id,
2384
- skills: (_g = anthropicOptions.container.skills) == null ? void 0 : _g.map((skill) => ({
2464
+ skills: (_h = anthropicOptions.container.skills) == null ? void 0 : _h.map((skill) => ({
2385
2465
  type: skill.type,
2386
2466
  skill_id: skill.skillId,
2387
2467
  version: skill.version
@@ -2513,7 +2593,9 @@ var AnthropicMessagesLanguageModel = class {
2513
2593
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
2514
2594
  betas.add("fast-mode-2026-02-01");
2515
2595
  }
2516
- if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
2596
+ if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) === "default") {
2597
+ betas.add("server-side-fallback-2026-07-01");
2598
+ } else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
2517
2599
  betas.add("server-side-fallback-2026-06-01");
2518
2600
  }
2519
2601
  if (useStructuredOutput) {
@@ -2556,7 +2638,7 @@ var AnthropicMessagesLanguageModel = class {
2556
2638
  ...betas,
2557
2639
  ...toolsBetas,
2558
2640
  ...userSuppliedBetas,
2559
- ...(_h = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _h : []
2641
+ ...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
2560
2642
  ]),
2561
2643
  usesJsonResponseTool: jsonResponseTool != null
2562
2644
  };
@@ -3572,11 +3654,20 @@ var AnthropicMessagesLanguageModel = class {
3572
3654
  }
3573
3655
  };
3574
3656
  function getModelCapabilities(modelId) {
3575
- if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
3657
+ if (modelId.includes("claude-opus-5")) {
3576
3658
  return {
3577
3659
  maxOutputTokens: 128e3,
3578
3660
  supportsStructuredOutput: true,
3579
3661
  rejectsSamplingParameters: true,
3662
+ rejectsThinkingDisabledAboveHighEffort: true,
3663
+ isKnownModel: true
3664
+ };
3665
+ } else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
3666
+ return {
3667
+ maxOutputTokens: 128e3,
3668
+ supportsStructuredOutput: true,
3669
+ rejectsSamplingParameters: true,
3670
+ rejectsThinkingDisabledAboveHighEffort: false,
3580
3671
  isKnownModel: true
3581
3672
  };
3582
3673
  } else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
@@ -3584,6 +3675,7 @@ function getModelCapabilities(modelId) {
3584
3675
  maxOutputTokens: 128e3,
3585
3676
  supportsStructuredOutput: true,
3586
3677
  rejectsSamplingParameters: false,
3678
+ rejectsThinkingDisabledAboveHighEffort: false,
3587
3679
  isKnownModel: true
3588
3680
  };
3589
3681
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
@@ -3591,6 +3683,7 @@ function getModelCapabilities(modelId) {
3591
3683
  maxOutputTokens: 64e3,
3592
3684
  supportsStructuredOutput: true,
3593
3685
  rejectsSamplingParameters: false,
3686
+ rejectsThinkingDisabledAboveHighEffort: false,
3594
3687
  isKnownModel: true
3595
3688
  };
3596
3689
  } else if (modelId.includes("claude-opus-4-1")) {
@@ -3598,6 +3691,7 @@ function getModelCapabilities(modelId) {
3598
3691
  maxOutputTokens: 32e3,
3599
3692
  supportsStructuredOutput: true,
3600
3693
  rejectsSamplingParameters: false,
3694
+ rejectsThinkingDisabledAboveHighEffort: false,
3601
3695
  isKnownModel: true
3602
3696
  };
3603
3697
  } else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
@@ -3605,6 +3699,7 @@ function getModelCapabilities(modelId) {
3605
3699
  maxOutputTokens: 64e3,
3606
3700
  supportsStructuredOutput: false,
3607
3701
  rejectsSamplingParameters: false,
3702
+ rejectsThinkingDisabledAboveHighEffort: false,
3608
3703
  isKnownModel: true
3609
3704
  };
3610
3705
  } else if (modelId.includes("claude-opus-4-")) {
@@ -3612,27 +3707,39 @@ function getModelCapabilities(modelId) {
3612
3707
  maxOutputTokens: 32e3,
3613
3708
  supportsStructuredOutput: false,
3614
3709
  rejectsSamplingParameters: false,
3710
+ rejectsThinkingDisabledAboveHighEffort: false,
3615
3711
  isKnownModel: true
3616
3712
  };
3617
- } else if (modelId.includes("claude-3-5-haiku")) {
3713
+ } else if (modelId.includes("claude-3-haiku")) {
3618
3714
  return {
3619
- maxOutputTokens: 8192,
3715
+ maxOutputTokens: 4096,
3620
3716
  supportsStructuredOutput: false,
3621
3717
  rejectsSamplingParameters: false,
3718
+ rejectsThinkingDisabledAboveHighEffort: false,
3622
3719
  isKnownModel: true
3623
3720
  };
3624
- } else if (modelId.includes("claude-3-haiku")) {
3721
+ } else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
3625
3722
  return {
3626
3723
  maxOutputTokens: 4096,
3627
3724
  supportsStructuredOutput: false,
3628
3725
  rejectsSamplingParameters: false,
3629
- isKnownModel: true
3726
+ rejectsThinkingDisabledAboveHighEffort: false,
3727
+ isKnownModel: false
3728
+ };
3729
+ } else if (modelId.includes("claude-")) {
3730
+ return {
3731
+ maxOutputTokens: 128e3,
3732
+ supportsStructuredOutput: true,
3733
+ rejectsSamplingParameters: true,
3734
+ rejectsThinkingDisabledAboveHighEffort: true,
3735
+ isKnownModel: false
3630
3736
  };
3631
3737
  } else {
3632
3738
  return {
3633
3739
  maxOutputTokens: 4096,
3634
3740
  supportsStructuredOutput: false,
3635
3741
  rejectsSamplingParameters: false,
3742
+ rejectsThinkingDisabledAboveHighEffort: false,
3636
3743
  isKnownModel: false
3637
3744
  };
3638
3745
  }