@ai-sdk/anthropic 3.0.101 → 3.0.102

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/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  } from "@ai-sdk/provider-utils";
13
13
 
14
14
  // src/version.ts
15
- var VERSION = true ? "3.0.101" : "0.0.0-test";
15
+ var VERSION = true ? "3.0.102" : "0.0.0-test";
16
16
 
17
17
  // src/anthropic-messages-language-model.ts
18
18
  import {
@@ -893,6 +893,34 @@ var anthropicFilePartProviderOptions = z3.object({
893
893
  */
894
894
  context: z3.string().optional()
895
895
  });
896
+ var anthropicSystemMessageProviderOptions = z3.object({
897
+ /**
898
+ * Mid-conversation tool changes. Adds or removes tools from the
899
+ * conversation's tool set between turns without invalidating the prompt
900
+ * cache.
901
+ *
902
+ * Only supported on system messages that appear mid-conversation (not the
903
+ * initial system prompt). A system message carrying tool changes must come
904
+ * right before an assistant message or at the end of the messages.
905
+ *
906
+ * Tools referenced by a `tool_addition` must be declared in the `tools`
907
+ * option (typically with `deferLoading: true` so they are not loaded until
908
+ * the addition surfaces them). The required
909
+ * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
910
+ */
911
+ toolChanges: z3.array(
912
+ z3.discriminatedUnion("type", [
913
+ z3.object({
914
+ type: z3.literal("tool_addition"),
915
+ toolName: z3.string()
916
+ }),
917
+ z3.object({
918
+ type: z3.literal("tool_removal"),
919
+ toolName: z3.string()
920
+ })
921
+ ])
922
+ ).optional()
923
+ });
896
924
  var anthropicLanguageModelOptions = z3.object({
897
925
  /**
898
926
  * Whether to send reasoning to the model.
@@ -1032,30 +1060,35 @@ var anthropicLanguageModelOptions = z3.object({
1032
1060
  */
1033
1061
  inferenceGeo: z3.enum(["us", "global"]).optional(),
1034
1062
  /**
1035
- * Server-side fallback chain.
1063
+ * Server-side fallback configuration.
1036
1064
  *
1037
1065
  * When the primary model's safety classifiers block a turn, the API
1038
- * automatically retries it on the next model in the chain, server-side. A
1039
- * `content-filter` finish reason means the entire chain refused.
1066
+ * automatically retries it server-side on a fallback model. A
1067
+ * `content-filter` finish reason means the fallback(s) refused as well.
1040
1068
  *
1041
- * Each entry is merged into the request as a direct request to that entry's
1042
- * model, so it must be formatted accordingly: `model` is required, and an
1043
- * entry may additionally override `max_tokens`, `thinking`, `output_config`,
1044
- * and `speed` for that attempt only (`speed` additionally requires the speed
1045
- * beta). The value is passed through to the API as-is.
1046
- *
1047
- * The required `server-side-fallback-2026-06-01` beta is added automatically
1048
- * when this option is set.
1069
+ * - `'default'` (recommended): the API routes the retry to Anthropic's
1070
+ * recommended fallback model based on the refusal category. Requires the
1071
+ * `server-side-fallback-2026-07-01` beta, which is added automatically.
1072
+ * - Array form: an explicit fallback chain. Each entry is merged into the
1073
+ * request as a direct request to that entry's model, so it must be
1074
+ * formatted accordingly: `model` is required, and an entry may
1075
+ * additionally override `max_tokens`, `thinking`, `output_config`, and
1076
+ * `speed` for that attempt only (`speed` additionally requires the speed
1077
+ * beta). The value is passed through to the API as-is, and the
1078
+ * `server-side-fallback-2026-06-01` beta is added automatically.
1049
1079
  */
1050
- fallbacks: z3.array(
1051
- z3.object({
1052
- model: z3.string(),
1053
- max_tokens: z3.number().int().optional(),
1054
- thinking: z3.record(z3.string(), z3.unknown()).optional(),
1055
- output_config: z3.record(z3.string(), z3.unknown()).optional(),
1056
- speed: z3.enum(["fast", "standard"]).optional()
1057
- })
1058
- ).optional(),
1080
+ fallbacks: z3.union([
1081
+ z3.literal("default"),
1082
+ z3.array(
1083
+ z3.object({
1084
+ model: z3.string(),
1085
+ max_tokens: z3.number().int().optional(),
1086
+ thinking: z3.record(z3.string(), z3.unknown()).optional(),
1087
+ output_config: z3.record(z3.string(), z3.unknown()).optional(),
1088
+ speed: z3.enum(["fast", "standard"]).optional()
1089
+ })
1090
+ )
1091
+ ]).optional(),
1059
1092
  /**
1060
1093
  * A set of beta features to enable.
1061
1094
  * Allow a provider to receive the full `betas` set if it needs it.
@@ -2265,7 +2298,7 @@ async function convertToAnthropicMessagesPrompt({
2265
2298
  cacheControlValidator,
2266
2299
  toolNameMapping
2267
2300
  }) {
2268
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2301
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
2269
2302
  const betas = /* @__PURE__ */ new Set();
2270
2303
  const blocks = groupIntoBlocks(prompt);
2271
2304
  const validator = cacheControlValidator || new CacheControlValidator();
@@ -2297,19 +2330,52 @@ async function convertToAnthropicMessagesPrompt({
2297
2330
  const type = block.type;
2298
2331
  switch (type) {
2299
2332
  case "system": {
2300
- const content = block.messages.map(({ content: content2, providerOptions }) => ({
2301
- type: "text",
2302
- text: content2,
2303
- cache_control: validator.getCacheControl(providerOptions, {
2304
- type: "system message",
2305
- canCache: true
2306
- })
2307
- }));
2308
- if (system == null) {
2309
- system = content;
2333
+ const content = [];
2334
+ let toolChangeCount = 0;
2335
+ for (const { content: text, providerOptions } of block.messages) {
2336
+ const systemMessageOptions = await parseProviderOptions({
2337
+ provider: "anthropic",
2338
+ providerOptions,
2339
+ schema: anthropicSystemMessageProviderOptions
2340
+ });
2341
+ const toolChanges = (_a = systemMessageOptions == null ? void 0 : systemMessageOptions.toolChanges) != null ? _a : [];
2342
+ if (text !== "" || toolChanges.length === 0) {
2343
+ content.push({
2344
+ type: "text",
2345
+ text,
2346
+ cache_control: validator.getCacheControl(providerOptions, {
2347
+ type: "system message",
2348
+ canCache: true
2349
+ })
2350
+ });
2351
+ }
2352
+ for (const toolChange of toolChanges) {
2353
+ toolChangeCount++;
2354
+ content.push({
2355
+ type: toolChange.type,
2356
+ tool: {
2357
+ type: "tool_reference",
2358
+ name: toolNameMapping.toProviderToolName(toolChange.toolName)
2359
+ }
2360
+ });
2361
+ }
2362
+ }
2363
+ if (i === 0 || system == null && toolChangeCount === 0) {
2364
+ if (toolChangeCount > 0) {
2365
+ warnings.push({
2366
+ type: "other",
2367
+ 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."
2368
+ });
2369
+ }
2370
+ system = content.filter(
2371
+ (part) => part.type === "text"
2372
+ );
2310
2373
  } else {
2311
2374
  messages.push({ role: "system", content });
2312
2375
  betas.add("mid-conversation-system-2026-04-07");
2376
+ if (toolChangeCount > 0) {
2377
+ betas.add("mid-conversation-tool-changes-2026-07-01");
2378
+ }
2313
2379
  }
2314
2380
  break;
2315
2381
  }
@@ -2322,10 +2388,10 @@ async function convertToAnthropicMessagesPrompt({
2322
2388
  for (let j = 0; j < content.length; j++) {
2323
2389
  const part = content[j];
2324
2390
  const isLastPart = j === content.length - 1;
2325
- const cacheControl = (_a = validator.getCacheControl(part.providerOptions, {
2391
+ const cacheControl = (_b = validator.getCacheControl(part.providerOptions, {
2326
2392
  type: "user message part",
2327
2393
  canCache: true
2328
- })) != null ? _a : isLastPart ? validator.getCacheControl(message.providerOptions, {
2394
+ })) != null ? _b : isLastPart ? validator.getCacheControl(message.providerOptions, {
2329
2395
  type: "user message",
2330
2396
  canCache: true
2331
2397
  }) : void 0;
@@ -2370,7 +2436,7 @@ async function convertToAnthropicMessagesPrompt({
2370
2436
  media_type: "application/pdf",
2371
2437
  data: convertToBase64(part.data)
2372
2438
  },
2373
- title: (_b = metadata.title) != null ? _b : part.filename,
2439
+ title: (_c = metadata.title) != null ? _c : part.filename,
2374
2440
  ...metadata.context && { context: metadata.context },
2375
2441
  ...enableCitations && {
2376
2442
  citations: { enabled: true }
@@ -2394,7 +2460,7 @@ async function convertToAnthropicMessagesPrompt({
2394
2460
  media_type: "text/plain",
2395
2461
  data: convertToString(part.data)
2396
2462
  },
2397
- title: (_c = metadata.title) != null ? _c : part.filename,
2463
+ title: (_d = metadata.title) != null ? _d : part.filename,
2398
2464
  ...metadata.context && { context: metadata.context },
2399
2465
  ...enableCitations && {
2400
2466
  citations: { enabled: true }
@@ -2419,17 +2485,17 @@ async function convertToAnthropicMessagesPrompt({
2419
2485
  continue;
2420
2486
  }
2421
2487
  const output = part.output;
2422
- const outputProviderOptions = "providerOptions" in output ? output.providerOptions : output.type === "content" ? (_d = output.value.find(
2488
+ const outputProviderOptions = "providerOptions" in output ? output.providerOptions : output.type === "content" ? (_e = output.value.find(
2423
2489
  (contentPart) => contentPart.providerOptions != null
2424
- )) == null ? void 0 : _d.providerOptions : void 0;
2490
+ )) == null ? void 0 : _e.providerOptions : void 0;
2425
2491
  const isLastPart = i2 === content.length - 1;
2426
- const cacheControl = (_f = (_e = validator.getCacheControl(part.providerOptions, {
2492
+ const cacheControl = (_g = (_f = validator.getCacheControl(part.providerOptions, {
2427
2493
  type: "tool result part",
2428
2494
  canCache: true
2429
- })) != null ? _e : validator.getCacheControl(outputProviderOptions, {
2495
+ })) != null ? _f : validator.getCacheControl(outputProviderOptions, {
2430
2496
  type: "tool result output",
2431
2497
  canCache: true
2432
- })) != null ? _f : isLastPart ? validator.getCacheControl(message.providerOptions, {
2498
+ })) != null ? _g : isLastPart ? validator.getCacheControl(message.providerOptions, {
2433
2499
  type: "tool result message",
2434
2500
  canCache: true
2435
2501
  }) : void 0;
@@ -2519,7 +2585,7 @@ async function convertToAnthropicMessagesPrompt({
2519
2585
  contentValue = output.value;
2520
2586
  break;
2521
2587
  case "execution-denied":
2522
- contentValue = (_g = output.reason) != null ? _g : "Tool call execution denied.";
2588
+ contentValue = (_h = output.reason) != null ? _h : "Tool call execution denied.";
2523
2589
  break;
2524
2590
  case "json":
2525
2591
  case "error-json":
@@ -2556,16 +2622,16 @@ async function convertToAnthropicMessagesPrompt({
2556
2622
  for (let k = 0; k < content.length; k++) {
2557
2623
  const part = content[k];
2558
2624
  const isLastContentPart = k === content.length - 1;
2559
- const cacheControl = (_h = validator.getCacheControl(part.providerOptions, {
2625
+ const cacheControl = (_i = validator.getCacheControl(part.providerOptions, {
2560
2626
  type: "assistant message part",
2561
2627
  canCache: true
2562
- })) != null ? _h : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
2628
+ })) != null ? _i : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
2563
2629
  type: "assistant message",
2564
2630
  canCache: true
2565
2631
  }) : void 0;
2566
2632
  switch (part.type) {
2567
2633
  case "text": {
2568
- const textMetadata = (_i = part.providerOptions) == null ? void 0 : _i.anthropic;
2634
+ const textMetadata = (_j = part.providerOptions) == null ? void 0 : _j.anthropic;
2569
2635
  if ((textMetadata == null ? void 0 : textMetadata.type) === "compaction") {
2570
2636
  anthropicContent.push({
2571
2637
  type: "compaction",
@@ -2641,10 +2707,10 @@ async function convertToAnthropicMessagesPrompt({
2641
2707
  const providerToolName = toolNameMapping.toProviderToolName(
2642
2708
  part.toolName
2643
2709
  );
2644
- const isMcpToolUse = ((_k = (_j = part.providerOptions) == null ? void 0 : _j.anthropic) == null ? void 0 : _k.type) === "mcp-tool-use";
2710
+ const isMcpToolUse = ((_l = (_k = part.providerOptions) == null ? void 0 : _k.anthropic) == null ? void 0 : _l.type) === "mcp-tool-use";
2645
2711
  if (isMcpToolUse) {
2646
2712
  mcpToolUseIds.add(part.toolCallId);
2647
- const serverName = (_m = (_l = part.providerOptions) == null ? void 0 : _l.anthropic) == null ? void 0 : _m.serverName;
2713
+ const serverName = (_n = (_m = part.providerOptions) == null ? void 0 : _m.anthropic) == null ? void 0 : _n.serverName;
2648
2714
  if (serverName == null || typeof serverName !== "string") {
2649
2715
  warnings.push({
2650
2716
  type: "other",
@@ -2720,7 +2786,7 @@ async function convertToAnthropicMessagesPrompt({
2720
2786
  }
2721
2787
  break;
2722
2788
  }
2723
- const callerOptions = (_n = part.providerOptions) == null ? void 0 : _n.anthropic;
2789
+ const callerOptions = (_o = part.providerOptions) == null ? void 0 : _o.anthropic;
2724
2790
  const caller = (callerOptions == null ? void 0 : callerOptions.caller) ? (callerOptions.caller.type === "code_execution_20250825" || callerOptions.caller.type === "code_execution_20260120") && callerOptions.caller.toolId ? {
2725
2791
  type: callerOptions.caller.type,
2726
2792
  tool_id: callerOptions.caller.toolId
@@ -2773,7 +2839,7 @@ async function convertToAnthropicMessagesPrompt({
2773
2839
  tool_use_id: part.toolCallId,
2774
2840
  content: {
2775
2841
  type: "code_execution_tool_result_error",
2776
- error_code: (_o = errorInfo.errorCode) != null ? _o : "unknown"
2842
+ error_code: (_p = errorInfo.errorCode) != null ? _p : "unknown"
2777
2843
  },
2778
2844
  cache_control: cacheControl
2779
2845
  });
@@ -2784,7 +2850,7 @@ async function convertToAnthropicMessagesPrompt({
2784
2850
  cache_control: cacheControl,
2785
2851
  content: {
2786
2852
  type: "bash_code_execution_tool_result_error",
2787
- error_code: (_p = errorInfo.errorCode) != null ? _p : "unknown"
2853
+ error_code: (_q = errorInfo.errorCode) != null ? _q : "unknown"
2788
2854
  }
2789
2855
  });
2790
2856
  }
@@ -2817,7 +2883,7 @@ async function convertToAnthropicMessagesPrompt({
2817
2883
  stdout: codeExecutionOutput.stdout,
2818
2884
  stderr: codeExecutionOutput.stderr,
2819
2885
  return_code: codeExecutionOutput.return_code,
2820
- content: (_q = codeExecutionOutput.content) != null ? _q : []
2886
+ content: (_r = codeExecutionOutput.content) != null ? _r : []
2821
2887
  },
2822
2888
  cache_control: cacheControl
2823
2889
  });
@@ -2835,7 +2901,7 @@ async function convertToAnthropicMessagesPrompt({
2835
2901
  encrypted_stdout: codeExecutionOutput.encrypted_stdout,
2836
2902
  stderr: codeExecutionOutput.stderr,
2837
2903
  return_code: codeExecutionOutput.return_code,
2838
- content: (_r = codeExecutionOutput.content) != null ? _r : []
2904
+ content: (_s = codeExecutionOutput.content) != null ? _s : []
2839
2905
  },
2840
2906
  cache_control: cacheControl
2841
2907
  });
@@ -2854,7 +2920,7 @@ async function convertToAnthropicMessagesPrompt({
2854
2920
  stdout: codeExecutionOutput.stdout,
2855
2921
  stderr: codeExecutionOutput.stderr,
2856
2922
  return_code: codeExecutionOutput.return_code,
2857
- content: (_s = codeExecutionOutput.content) != null ? _s : []
2923
+ content: (_t = codeExecutionOutput.content) != null ? _t : []
2858
2924
  },
2859
2925
  cache_control: cacheControl
2860
2926
  });
@@ -2884,7 +2950,7 @@ async function convertToAnthropicMessagesPrompt({
2884
2950
  tool_use_id: part.toolCallId,
2885
2951
  content: {
2886
2952
  type: "web_fetch_tool_result_error",
2887
- error_code: (_t = (await extractErrorValue(output.value)).errorCode) != null ? _t : "unavailable"
2953
+ error_code: (_u = (await extractErrorValue(output.value)).errorCode) != null ? _u : "unavailable"
2888
2954
  },
2889
2955
  cache_control: cacheControl
2890
2956
  });
@@ -2931,7 +2997,7 @@ async function convertToAnthropicMessagesPrompt({
2931
2997
  tool_use_id: part.toolCallId,
2932
2998
  content: {
2933
2999
  type: "web_search_tool_result_error",
2934
- error_code: (_u = (await extractErrorValue(output.value)).errorCode) != null ? _u : "unavailable"
3000
+ error_code: (_v = (await extractErrorValue(output.value)).errorCode) != null ? _v : "unavailable"
2935
3001
  },
2936
3002
  cache_control: cacheControl
2937
3003
  });
@@ -3389,7 +3455,7 @@ var AnthropicMessagesLanguageModel = class {
3389
3455
  providerOptions,
3390
3456
  stream
3391
3457
  }) {
3392
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
3458
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
3393
3459
  const warnings = [];
3394
3460
  if (frequencyPenalty != null) {
3395
3461
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -3445,6 +3511,7 @@ var AnthropicMessagesLanguageModel = class {
3445
3511
  maxOutputTokens: maxOutputTokensForModel,
3446
3512
  supportsStructuredOutput: modelSupportsStructuredOutput,
3447
3513
  rejectsSamplingParameters,
3514
+ rejectsThinkingDisabledAboveHighEffort,
3448
3515
  isKnownModel
3449
3516
  } = getModelCapabilities(this.modelId);
3450
3517
  if (!isKnownModel && maxOutputTokens == null) {
@@ -3531,11 +3598,19 @@ var AnthropicMessagesLanguageModel = class {
3531
3598
  cacheControlValidator,
3532
3599
  toolNameMapping
3533
3600
  });
3534
- const thinkingType = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type;
3601
+ if (rejectsThinkingDisabledAboveHighEffort && ((_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type) === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
3602
+ warnings.push({
3603
+ type: "unsupported",
3604
+ feature: "providerOptions.anthropic.effort",
3605
+ details: `effort '${anthropicOptions.effort}' is not supported by ${this.modelId} when thinking is disabled. The effort has been lowered to 'high'.`
3606
+ });
3607
+ anthropicOptions.effort = "high";
3608
+ }
3609
+ const thinkingType = (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.type;
3535
3610
  const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
3536
3611
  const sendThinking = isThinking || thinkingType === "disabled";
3537
- let thinkingBudget = thinkingType === "enabled" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.budgetTokens : void 0;
3538
- const thinkingDisplay = thinkingType === "adaptive" ? (_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.display : void 0;
3612
+ let thinkingBudget = thinkingType === "enabled" ? (_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.budgetTokens : void 0;
3613
+ const thinkingDisplay = thinkingType === "adaptive" ? (_h = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _h.display : void 0;
3539
3614
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
3540
3615
  const baseArgs = {
3541
3616
  // model id:
@@ -3582,13 +3657,13 @@ var AnthropicMessagesLanguageModel = class {
3582
3657
  ...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
3583
3658
  inference_geo: anthropicOptions.inferenceGeo
3584
3659
  },
3585
- ...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0 && {
3660
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) != null && (anthropicOptions.fallbacks === "default" || anthropicOptions.fallbacks.length > 0) && {
3586
3661
  fallbacks: anthropicOptions.fallbacks
3587
3662
  },
3588
3663
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
3589
3664
  cache_control: anthropicOptions.cacheControl
3590
3665
  },
3591
- ...((_h = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _h.userId) != null && {
3666
+ ...((_i = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _i.userId) != null && {
3592
3667
  metadata: { user_id: anthropicOptions.metadata.userId }
3593
3668
  },
3594
3669
  // mcp servers:
@@ -3761,10 +3836,12 @@ var AnthropicMessagesLanguageModel = class {
3761
3836
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3762
3837
  betas.add("fast-mode-2026-02-01");
3763
3838
  }
3764
- if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
3839
+ if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) === "default") {
3840
+ betas.add("server-side-fallback-2026-07-01");
3841
+ } else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
3765
3842
  betas.add("server-side-fallback-2026-06-01");
3766
3843
  }
3767
- const defaultEagerInputStreaming = stream && ((_i = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _i : true);
3844
+ const defaultEagerInputStreaming = stream && ((_j = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _j : true);
3768
3845
  const {
3769
3846
  tools: anthropicTools2,
3770
3847
  toolChoice: anthropicToolChoice,
@@ -3803,7 +3880,7 @@ var AnthropicMessagesLanguageModel = class {
3803
3880
  ...betas,
3804
3881
  ...toolsBetas,
3805
3882
  ...userSuppliedBetas,
3806
- ...(_j = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _j : []
3883
+ ...(_k = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _k : []
3807
3884
  ]),
3808
3885
  usesJsonResponseTool: jsonResponseTool != null,
3809
3886
  toolNameMapping,
@@ -5249,11 +5326,20 @@ var AnthropicMessagesLanguageModel = class {
5249
5326
  }
5250
5327
  };
5251
5328
  function getModelCapabilities(modelId) {
5252
- if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
5329
+ if (modelId.includes("claude-opus-5")) {
5330
+ return {
5331
+ maxOutputTokens: 128e3,
5332
+ supportsStructuredOutput: true,
5333
+ rejectsSamplingParameters: true,
5334
+ rejectsThinkingDisabledAboveHighEffort: true,
5335
+ isKnownModel: true
5336
+ };
5337
+ } else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
5253
5338
  return {
5254
5339
  maxOutputTokens: 128e3,
5255
5340
  supportsStructuredOutput: true,
5256
5341
  rejectsSamplingParameters: true,
5342
+ rejectsThinkingDisabledAboveHighEffort: false,
5257
5343
  isKnownModel: true
5258
5344
  };
5259
5345
  } else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
@@ -5261,6 +5347,7 @@ function getModelCapabilities(modelId) {
5261
5347
  maxOutputTokens: 128e3,
5262
5348
  supportsStructuredOutput: true,
5263
5349
  rejectsSamplingParameters: false,
5350
+ rejectsThinkingDisabledAboveHighEffort: false,
5264
5351
  isKnownModel: true
5265
5352
  };
5266
5353
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
@@ -5268,6 +5355,7 @@ function getModelCapabilities(modelId) {
5268
5355
  maxOutputTokens: 64e3,
5269
5356
  supportsStructuredOutput: true,
5270
5357
  rejectsSamplingParameters: false,
5358
+ rejectsThinkingDisabledAboveHighEffort: false,
5271
5359
  isKnownModel: true
5272
5360
  };
5273
5361
  } else if (modelId.includes("claude-opus-4-1")) {
@@ -5275,6 +5363,7 @@ function getModelCapabilities(modelId) {
5275
5363
  maxOutputTokens: 32e3,
5276
5364
  supportsStructuredOutput: true,
5277
5365
  rejectsSamplingParameters: false,
5366
+ rejectsThinkingDisabledAboveHighEffort: false,
5278
5367
  isKnownModel: true
5279
5368
  };
5280
5369
  } else if (modelId.includes("claude-sonnet-4-")) {
@@ -5282,6 +5371,7 @@ function getModelCapabilities(modelId) {
5282
5371
  maxOutputTokens: 64e3,
5283
5372
  supportsStructuredOutput: false,
5284
5373
  rejectsSamplingParameters: false,
5374
+ rejectsThinkingDisabledAboveHighEffort: false,
5285
5375
  isKnownModel: true
5286
5376
  };
5287
5377
  } else if (modelId.includes("claude-opus-4-")) {
@@ -5289,6 +5379,7 @@ function getModelCapabilities(modelId) {
5289
5379
  maxOutputTokens: 32e3,
5290
5380
  supportsStructuredOutput: false,
5291
5381
  rejectsSamplingParameters: false,
5382
+ rejectsThinkingDisabledAboveHighEffort: false,
5292
5383
  isKnownModel: true
5293
5384
  };
5294
5385
  } else if (modelId.includes("claude-3-haiku")) {
@@ -5296,6 +5387,7 @@ function getModelCapabilities(modelId) {
5296
5387
  maxOutputTokens: 4096,
5297
5388
  supportsStructuredOutput: false,
5298
5389
  rejectsSamplingParameters: false,
5390
+ rejectsThinkingDisabledAboveHighEffort: false,
5299
5391
  isKnownModel: true
5300
5392
  };
5301
5393
  } else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
@@ -5303,6 +5395,7 @@ function getModelCapabilities(modelId) {
5303
5395
  maxOutputTokens: 4096,
5304
5396
  supportsStructuredOutput: false,
5305
5397
  rejectsSamplingParameters: false,
5398
+ rejectsThinkingDisabledAboveHighEffort: false,
5306
5399
  isKnownModel: false
5307
5400
  };
5308
5401
  } else if (modelId.includes("claude-")) {
@@ -5310,6 +5403,7 @@ function getModelCapabilities(modelId) {
5310
5403
  maxOutputTokens: 128e3,
5311
5404
  supportsStructuredOutput: true,
5312
5405
  rejectsSamplingParameters: true,
5406
+ rejectsThinkingDisabledAboveHighEffort: true,
5313
5407
  isKnownModel: false
5314
5408
  };
5315
5409
  } else {
@@ -5317,6 +5411,7 @@ function getModelCapabilities(modelId) {
5317
5411
  maxOutputTokens: 4096,
5318
5412
  supportsStructuredOutput: false,
5319
5413
  rejectsSamplingParameters: false,
5414
+ rejectsThinkingDisabledAboveHighEffort: false,
5320
5415
  isKnownModel: false
5321
5416
  };
5322
5417
  }