@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.
@@ -877,6 +877,34 @@ var anthropicFilePartProviderOptions = z3.object({
877
877
  */
878
878
  context: z3.string().optional()
879
879
  });
880
+ var anthropicSystemMessageProviderOptions = z3.object({
881
+ /**
882
+ * Mid-conversation tool changes. Adds or removes tools from the
883
+ * conversation's tool set between turns without invalidating the prompt
884
+ * cache.
885
+ *
886
+ * Only supported on system messages that appear mid-conversation (not the
887
+ * initial system prompt). A system message carrying tool changes must come
888
+ * right before an assistant message or at the end of the messages.
889
+ *
890
+ * Tools referenced by a `tool_addition` must be declared in the `tools`
891
+ * option (typically with `deferLoading: true` so they are not loaded until
892
+ * the addition surfaces them). The required
893
+ * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
894
+ */
895
+ toolChanges: z3.array(
896
+ z3.discriminatedUnion("type", [
897
+ z3.object({
898
+ type: z3.literal("tool_addition"),
899
+ toolName: z3.string()
900
+ }),
901
+ z3.object({
902
+ type: z3.literal("tool_removal"),
903
+ toolName: z3.string()
904
+ })
905
+ ])
906
+ ).optional()
907
+ });
880
908
  var anthropicLanguageModelOptions = z3.object({
881
909
  /**
882
910
  * Whether to send reasoning to the model.
@@ -1016,30 +1044,35 @@ var anthropicLanguageModelOptions = z3.object({
1016
1044
  */
1017
1045
  inferenceGeo: z3.enum(["us", "global"]).optional(),
1018
1046
  /**
1019
- * Server-side fallback chain.
1047
+ * Server-side fallback configuration.
1020
1048
  *
1021
1049
  * When the primary model's safety classifiers block a turn, the API
1022
- * automatically retries it on the next model in the chain, server-side. A
1023
- * `content-filter` finish reason means the entire chain refused.
1050
+ * automatically retries it server-side on a fallback model. A
1051
+ * `content-filter` finish reason means the fallback(s) refused as well.
1024
1052
  *
1025
- * Each entry is merged into the request as a direct request to that entry's
1026
- * model, so it must be formatted accordingly: `model` is required, and an
1027
- * entry may additionally override `max_tokens`, `thinking`, `output_config`,
1028
- * and `speed` for that attempt only (`speed` additionally requires the speed
1029
- * beta). The value is passed through to the API as-is.
1030
- *
1031
- * The required `server-side-fallback-2026-06-01` beta is added automatically
1032
- * when this option is set.
1053
+ * - `'default'` (recommended): the API routes the retry to Anthropic's
1054
+ * recommended fallback model based on the refusal category. Requires the
1055
+ * `server-side-fallback-2026-07-01` beta, which is added automatically.
1056
+ * - Array form: an explicit fallback chain. Each entry is merged into the
1057
+ * request as a direct request to that entry's model, so it must be
1058
+ * formatted accordingly: `model` is required, and an entry may
1059
+ * additionally override `max_tokens`, `thinking`, `output_config`, and
1060
+ * `speed` for that attempt only (`speed` additionally requires the speed
1061
+ * beta). The value is passed through to the API as-is, and the
1062
+ * `server-side-fallback-2026-06-01` beta is added automatically.
1033
1063
  */
1034
- fallbacks: z3.array(
1035
- z3.object({
1036
- model: z3.string(),
1037
- max_tokens: z3.number().int().optional(),
1038
- thinking: z3.record(z3.string(), z3.unknown()).optional(),
1039
- output_config: z3.record(z3.string(), z3.unknown()).optional(),
1040
- speed: z3.enum(["fast", "standard"]).optional()
1041
- })
1042
- ).optional(),
1064
+ fallbacks: z3.union([
1065
+ z3.literal("default"),
1066
+ z3.array(
1067
+ z3.object({
1068
+ model: z3.string(),
1069
+ max_tokens: z3.number().int().optional(),
1070
+ thinking: z3.record(z3.string(), z3.unknown()).optional(),
1071
+ output_config: z3.record(z3.string(), z3.unknown()).optional(),
1072
+ speed: z3.enum(["fast", "standard"]).optional()
1073
+ })
1074
+ )
1075
+ ]).optional(),
1043
1076
  /**
1044
1077
  * A set of beta features to enable.
1045
1078
  * Allow a provider to receive the full `betas` set if it needs it.
@@ -2249,7 +2282,7 @@ async function convertToAnthropicMessagesPrompt({
2249
2282
  cacheControlValidator,
2250
2283
  toolNameMapping
2251
2284
  }) {
2252
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2285
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
2253
2286
  const betas = /* @__PURE__ */ new Set();
2254
2287
  const blocks = groupIntoBlocks(prompt);
2255
2288
  const validator = cacheControlValidator || new CacheControlValidator();
@@ -2281,19 +2314,52 @@ async function convertToAnthropicMessagesPrompt({
2281
2314
  const type = block.type;
2282
2315
  switch (type) {
2283
2316
  case "system": {
2284
- const content = block.messages.map(({ content: content2, providerOptions }) => ({
2285
- type: "text",
2286
- text: content2,
2287
- cache_control: validator.getCacheControl(providerOptions, {
2288
- type: "system message",
2289
- canCache: true
2290
- })
2291
- }));
2292
- if (system == null) {
2293
- system = content;
2317
+ const content = [];
2318
+ let toolChangeCount = 0;
2319
+ for (const { content: text, providerOptions } of block.messages) {
2320
+ const systemMessageOptions = await parseProviderOptions({
2321
+ provider: "anthropic",
2322
+ providerOptions,
2323
+ schema: anthropicSystemMessageProviderOptions
2324
+ });
2325
+ const toolChanges = (_a = systemMessageOptions == null ? void 0 : systemMessageOptions.toolChanges) != null ? _a : [];
2326
+ if (text !== "" || toolChanges.length === 0) {
2327
+ content.push({
2328
+ type: "text",
2329
+ text,
2330
+ cache_control: validator.getCacheControl(providerOptions, {
2331
+ type: "system message",
2332
+ canCache: true
2333
+ })
2334
+ });
2335
+ }
2336
+ for (const toolChange of toolChanges) {
2337
+ toolChangeCount++;
2338
+ content.push({
2339
+ type: toolChange.type,
2340
+ tool: {
2341
+ type: "tool_reference",
2342
+ name: toolNameMapping.toProviderToolName(toolChange.toolName)
2343
+ }
2344
+ });
2345
+ }
2346
+ }
2347
+ if (i === 0 || system == null && toolChangeCount === 0) {
2348
+ if (toolChangeCount > 0) {
2349
+ warnings.push({
2350
+ type: "other",
2351
+ 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."
2352
+ });
2353
+ }
2354
+ system = content.filter(
2355
+ (part) => part.type === "text"
2356
+ );
2294
2357
  } else {
2295
2358
  messages.push({ role: "system", content });
2296
2359
  betas.add("mid-conversation-system-2026-04-07");
2360
+ if (toolChangeCount > 0) {
2361
+ betas.add("mid-conversation-tool-changes-2026-07-01");
2362
+ }
2297
2363
  }
2298
2364
  break;
2299
2365
  }
@@ -2306,10 +2372,10 @@ async function convertToAnthropicMessagesPrompt({
2306
2372
  for (let j = 0; j < content.length; j++) {
2307
2373
  const part = content[j];
2308
2374
  const isLastPart = j === content.length - 1;
2309
- const cacheControl = (_a = validator.getCacheControl(part.providerOptions, {
2375
+ const cacheControl = (_b = validator.getCacheControl(part.providerOptions, {
2310
2376
  type: "user message part",
2311
2377
  canCache: true
2312
- })) != null ? _a : isLastPart ? validator.getCacheControl(message.providerOptions, {
2378
+ })) != null ? _b : isLastPart ? validator.getCacheControl(message.providerOptions, {
2313
2379
  type: "user message",
2314
2380
  canCache: true
2315
2381
  }) : void 0;
@@ -2354,7 +2420,7 @@ async function convertToAnthropicMessagesPrompt({
2354
2420
  media_type: "application/pdf",
2355
2421
  data: convertToBase64(part.data)
2356
2422
  },
2357
- title: (_b = metadata.title) != null ? _b : part.filename,
2423
+ title: (_c = metadata.title) != null ? _c : part.filename,
2358
2424
  ...metadata.context && { context: metadata.context },
2359
2425
  ...enableCitations && {
2360
2426
  citations: { enabled: true }
@@ -2378,7 +2444,7 @@ async function convertToAnthropicMessagesPrompt({
2378
2444
  media_type: "text/plain",
2379
2445
  data: convertToString(part.data)
2380
2446
  },
2381
- title: (_c = metadata.title) != null ? _c : part.filename,
2447
+ title: (_d = metadata.title) != null ? _d : part.filename,
2382
2448
  ...metadata.context && { context: metadata.context },
2383
2449
  ...enableCitations && {
2384
2450
  citations: { enabled: true }
@@ -2403,17 +2469,17 @@ async function convertToAnthropicMessagesPrompt({
2403
2469
  continue;
2404
2470
  }
2405
2471
  const output = part.output;
2406
- const outputProviderOptions = "providerOptions" in output ? output.providerOptions : output.type === "content" ? (_d = output.value.find(
2472
+ const outputProviderOptions = "providerOptions" in output ? output.providerOptions : output.type === "content" ? (_e = output.value.find(
2407
2473
  (contentPart) => contentPart.providerOptions != null
2408
- )) == null ? void 0 : _d.providerOptions : void 0;
2474
+ )) == null ? void 0 : _e.providerOptions : void 0;
2409
2475
  const isLastPart = i2 === content.length - 1;
2410
- const cacheControl = (_f = (_e = validator.getCacheControl(part.providerOptions, {
2476
+ const cacheControl = (_g = (_f = validator.getCacheControl(part.providerOptions, {
2411
2477
  type: "tool result part",
2412
2478
  canCache: true
2413
- })) != null ? _e : validator.getCacheControl(outputProviderOptions, {
2479
+ })) != null ? _f : validator.getCacheControl(outputProviderOptions, {
2414
2480
  type: "tool result output",
2415
2481
  canCache: true
2416
- })) != null ? _f : isLastPart ? validator.getCacheControl(message.providerOptions, {
2482
+ })) != null ? _g : isLastPart ? validator.getCacheControl(message.providerOptions, {
2417
2483
  type: "tool result message",
2418
2484
  canCache: true
2419
2485
  }) : void 0;
@@ -2503,7 +2569,7 @@ async function convertToAnthropicMessagesPrompt({
2503
2569
  contentValue = output.value;
2504
2570
  break;
2505
2571
  case "execution-denied":
2506
- contentValue = (_g = output.reason) != null ? _g : "Tool call execution denied.";
2572
+ contentValue = (_h = output.reason) != null ? _h : "Tool call execution denied.";
2507
2573
  break;
2508
2574
  case "json":
2509
2575
  case "error-json":
@@ -2540,16 +2606,16 @@ async function convertToAnthropicMessagesPrompt({
2540
2606
  for (let k = 0; k < content.length; k++) {
2541
2607
  const part = content[k];
2542
2608
  const isLastContentPart = k === content.length - 1;
2543
- const cacheControl = (_h = validator.getCacheControl(part.providerOptions, {
2609
+ const cacheControl = (_i = validator.getCacheControl(part.providerOptions, {
2544
2610
  type: "assistant message part",
2545
2611
  canCache: true
2546
- })) != null ? _h : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
2612
+ })) != null ? _i : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
2547
2613
  type: "assistant message",
2548
2614
  canCache: true
2549
2615
  }) : void 0;
2550
2616
  switch (part.type) {
2551
2617
  case "text": {
2552
- const textMetadata = (_i = part.providerOptions) == null ? void 0 : _i.anthropic;
2618
+ const textMetadata = (_j = part.providerOptions) == null ? void 0 : _j.anthropic;
2553
2619
  if ((textMetadata == null ? void 0 : textMetadata.type) === "compaction") {
2554
2620
  anthropicContent.push({
2555
2621
  type: "compaction",
@@ -2625,10 +2691,10 @@ async function convertToAnthropicMessagesPrompt({
2625
2691
  const providerToolName = toolNameMapping.toProviderToolName(
2626
2692
  part.toolName
2627
2693
  );
2628
- const isMcpToolUse = ((_k = (_j = part.providerOptions) == null ? void 0 : _j.anthropic) == null ? void 0 : _k.type) === "mcp-tool-use";
2694
+ const isMcpToolUse = ((_l = (_k = part.providerOptions) == null ? void 0 : _k.anthropic) == null ? void 0 : _l.type) === "mcp-tool-use";
2629
2695
  if (isMcpToolUse) {
2630
2696
  mcpToolUseIds.add(part.toolCallId);
2631
- const serverName = (_m = (_l = part.providerOptions) == null ? void 0 : _l.anthropic) == null ? void 0 : _m.serverName;
2697
+ const serverName = (_n = (_m = part.providerOptions) == null ? void 0 : _m.anthropic) == null ? void 0 : _n.serverName;
2632
2698
  if (serverName == null || typeof serverName !== "string") {
2633
2699
  warnings.push({
2634
2700
  type: "other",
@@ -2704,7 +2770,7 @@ async function convertToAnthropicMessagesPrompt({
2704
2770
  }
2705
2771
  break;
2706
2772
  }
2707
- const callerOptions = (_n = part.providerOptions) == null ? void 0 : _n.anthropic;
2773
+ const callerOptions = (_o = part.providerOptions) == null ? void 0 : _o.anthropic;
2708
2774
  const caller = (callerOptions == null ? void 0 : callerOptions.caller) ? (callerOptions.caller.type === "code_execution_20250825" || callerOptions.caller.type === "code_execution_20260120") && callerOptions.caller.toolId ? {
2709
2775
  type: callerOptions.caller.type,
2710
2776
  tool_id: callerOptions.caller.toolId
@@ -2757,7 +2823,7 @@ async function convertToAnthropicMessagesPrompt({
2757
2823
  tool_use_id: part.toolCallId,
2758
2824
  content: {
2759
2825
  type: "code_execution_tool_result_error",
2760
- error_code: (_o = errorInfo.errorCode) != null ? _o : "unknown"
2826
+ error_code: (_p = errorInfo.errorCode) != null ? _p : "unknown"
2761
2827
  },
2762
2828
  cache_control: cacheControl
2763
2829
  });
@@ -2768,7 +2834,7 @@ async function convertToAnthropicMessagesPrompt({
2768
2834
  cache_control: cacheControl,
2769
2835
  content: {
2770
2836
  type: "bash_code_execution_tool_result_error",
2771
- error_code: (_p = errorInfo.errorCode) != null ? _p : "unknown"
2837
+ error_code: (_q = errorInfo.errorCode) != null ? _q : "unknown"
2772
2838
  }
2773
2839
  });
2774
2840
  }
@@ -2801,7 +2867,7 @@ async function convertToAnthropicMessagesPrompt({
2801
2867
  stdout: codeExecutionOutput.stdout,
2802
2868
  stderr: codeExecutionOutput.stderr,
2803
2869
  return_code: codeExecutionOutput.return_code,
2804
- content: (_q = codeExecutionOutput.content) != null ? _q : []
2870
+ content: (_r = codeExecutionOutput.content) != null ? _r : []
2805
2871
  },
2806
2872
  cache_control: cacheControl
2807
2873
  });
@@ -2819,7 +2885,7 @@ async function convertToAnthropicMessagesPrompt({
2819
2885
  encrypted_stdout: codeExecutionOutput.encrypted_stdout,
2820
2886
  stderr: codeExecutionOutput.stderr,
2821
2887
  return_code: codeExecutionOutput.return_code,
2822
- content: (_r = codeExecutionOutput.content) != null ? _r : []
2888
+ content: (_s = codeExecutionOutput.content) != null ? _s : []
2823
2889
  },
2824
2890
  cache_control: cacheControl
2825
2891
  });
@@ -2838,7 +2904,7 @@ async function convertToAnthropicMessagesPrompt({
2838
2904
  stdout: codeExecutionOutput.stdout,
2839
2905
  stderr: codeExecutionOutput.stderr,
2840
2906
  return_code: codeExecutionOutput.return_code,
2841
- content: (_s = codeExecutionOutput.content) != null ? _s : []
2907
+ content: (_t = codeExecutionOutput.content) != null ? _t : []
2842
2908
  },
2843
2909
  cache_control: cacheControl
2844
2910
  });
@@ -2868,7 +2934,7 @@ async function convertToAnthropicMessagesPrompt({
2868
2934
  tool_use_id: part.toolCallId,
2869
2935
  content: {
2870
2936
  type: "web_fetch_tool_result_error",
2871
- error_code: (_t = (await extractErrorValue(output.value)).errorCode) != null ? _t : "unavailable"
2937
+ error_code: (_u = (await extractErrorValue(output.value)).errorCode) != null ? _u : "unavailable"
2872
2938
  },
2873
2939
  cache_control: cacheControl
2874
2940
  });
@@ -2915,7 +2981,7 @@ async function convertToAnthropicMessagesPrompt({
2915
2981
  tool_use_id: part.toolCallId,
2916
2982
  content: {
2917
2983
  type: "web_search_tool_result_error",
2918
- error_code: (_u = (await extractErrorValue(output.value)).errorCode) != null ? _u : "unavailable"
2984
+ error_code: (_v = (await extractErrorValue(output.value)).errorCode) != null ? _v : "unavailable"
2919
2985
  },
2920
2986
  cache_control: cacheControl
2921
2987
  });
@@ -3373,7 +3439,7 @@ var AnthropicMessagesLanguageModel = class {
3373
3439
  providerOptions,
3374
3440
  stream
3375
3441
  }) {
3376
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
3442
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
3377
3443
  const warnings = [];
3378
3444
  if (frequencyPenalty != null) {
3379
3445
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -3429,6 +3495,7 @@ var AnthropicMessagesLanguageModel = class {
3429
3495
  maxOutputTokens: maxOutputTokensForModel,
3430
3496
  supportsStructuredOutput: modelSupportsStructuredOutput,
3431
3497
  rejectsSamplingParameters,
3498
+ rejectsThinkingDisabledAboveHighEffort,
3432
3499
  isKnownModel
3433
3500
  } = getModelCapabilities(this.modelId);
3434
3501
  if (!isKnownModel && maxOutputTokens == null) {
@@ -3515,11 +3582,19 @@ var AnthropicMessagesLanguageModel = class {
3515
3582
  cacheControlValidator,
3516
3583
  toolNameMapping
3517
3584
  });
3518
- const thinkingType = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type;
3585
+ if (rejectsThinkingDisabledAboveHighEffort && ((_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type) === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
3586
+ warnings.push({
3587
+ type: "unsupported",
3588
+ feature: "providerOptions.anthropic.effort",
3589
+ details: `effort '${anthropicOptions.effort}' is not supported by ${this.modelId} when thinking is disabled. The effort has been lowered to 'high'.`
3590
+ });
3591
+ anthropicOptions.effort = "high";
3592
+ }
3593
+ const thinkingType = (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.type;
3519
3594
  const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
3520
3595
  const sendThinking = isThinking || thinkingType === "disabled";
3521
- let thinkingBudget = thinkingType === "enabled" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.budgetTokens : void 0;
3522
- const thinkingDisplay = thinkingType === "adaptive" ? (_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.display : void 0;
3596
+ let thinkingBudget = thinkingType === "enabled" ? (_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.budgetTokens : void 0;
3597
+ const thinkingDisplay = thinkingType === "adaptive" ? (_h = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _h.display : void 0;
3523
3598
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
3524
3599
  const baseArgs = {
3525
3600
  // model id:
@@ -3566,13 +3641,13 @@ var AnthropicMessagesLanguageModel = class {
3566
3641
  ...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
3567
3642
  inference_geo: anthropicOptions.inferenceGeo
3568
3643
  },
3569
- ...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0 && {
3644
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) != null && (anthropicOptions.fallbacks === "default" || anthropicOptions.fallbacks.length > 0) && {
3570
3645
  fallbacks: anthropicOptions.fallbacks
3571
3646
  },
3572
3647
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
3573
3648
  cache_control: anthropicOptions.cacheControl
3574
3649
  },
3575
- ...((_h = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _h.userId) != null && {
3650
+ ...((_i = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _i.userId) != null && {
3576
3651
  metadata: { user_id: anthropicOptions.metadata.userId }
3577
3652
  },
3578
3653
  // mcp servers:
@@ -3745,10 +3820,12 @@ var AnthropicMessagesLanguageModel = class {
3745
3820
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3746
3821
  betas.add("fast-mode-2026-02-01");
3747
3822
  }
3748
- if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
3823
+ if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) === "default") {
3824
+ betas.add("server-side-fallback-2026-07-01");
3825
+ } else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
3749
3826
  betas.add("server-side-fallback-2026-06-01");
3750
3827
  }
3751
- const defaultEagerInputStreaming = stream && ((_i = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _i : true);
3828
+ const defaultEagerInputStreaming = stream && ((_j = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _j : true);
3752
3829
  const {
3753
3830
  tools: anthropicTools2,
3754
3831
  toolChoice: anthropicToolChoice,
@@ -3787,7 +3864,7 @@ var AnthropicMessagesLanguageModel = class {
3787
3864
  ...betas,
3788
3865
  ...toolsBetas,
3789
3866
  ...userSuppliedBetas,
3790
- ...(_j = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _j : []
3867
+ ...(_k = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _k : []
3791
3868
  ]),
3792
3869
  usesJsonResponseTool: jsonResponseTool != null,
3793
3870
  toolNameMapping,
@@ -5233,11 +5310,20 @@ var AnthropicMessagesLanguageModel = class {
5233
5310
  }
5234
5311
  };
5235
5312
  function getModelCapabilities(modelId) {
5236
- if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
5313
+ if (modelId.includes("claude-opus-5")) {
5314
+ return {
5315
+ maxOutputTokens: 128e3,
5316
+ supportsStructuredOutput: true,
5317
+ rejectsSamplingParameters: true,
5318
+ rejectsThinkingDisabledAboveHighEffort: true,
5319
+ isKnownModel: true
5320
+ };
5321
+ } else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
5237
5322
  return {
5238
5323
  maxOutputTokens: 128e3,
5239
5324
  supportsStructuredOutput: true,
5240
5325
  rejectsSamplingParameters: true,
5326
+ rejectsThinkingDisabledAboveHighEffort: false,
5241
5327
  isKnownModel: true
5242
5328
  };
5243
5329
  } else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
@@ -5245,6 +5331,7 @@ function getModelCapabilities(modelId) {
5245
5331
  maxOutputTokens: 128e3,
5246
5332
  supportsStructuredOutput: true,
5247
5333
  rejectsSamplingParameters: false,
5334
+ rejectsThinkingDisabledAboveHighEffort: false,
5248
5335
  isKnownModel: true
5249
5336
  };
5250
5337
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
@@ -5252,6 +5339,7 @@ function getModelCapabilities(modelId) {
5252
5339
  maxOutputTokens: 64e3,
5253
5340
  supportsStructuredOutput: true,
5254
5341
  rejectsSamplingParameters: false,
5342
+ rejectsThinkingDisabledAboveHighEffort: false,
5255
5343
  isKnownModel: true
5256
5344
  };
5257
5345
  } else if (modelId.includes("claude-opus-4-1")) {
@@ -5259,6 +5347,7 @@ function getModelCapabilities(modelId) {
5259
5347
  maxOutputTokens: 32e3,
5260
5348
  supportsStructuredOutput: true,
5261
5349
  rejectsSamplingParameters: false,
5350
+ rejectsThinkingDisabledAboveHighEffort: false,
5262
5351
  isKnownModel: true
5263
5352
  };
5264
5353
  } else if (modelId.includes("claude-sonnet-4-")) {
@@ -5266,6 +5355,7 @@ function getModelCapabilities(modelId) {
5266
5355
  maxOutputTokens: 64e3,
5267
5356
  supportsStructuredOutput: false,
5268
5357
  rejectsSamplingParameters: false,
5358
+ rejectsThinkingDisabledAboveHighEffort: false,
5269
5359
  isKnownModel: true
5270
5360
  };
5271
5361
  } else if (modelId.includes("claude-opus-4-")) {
@@ -5273,6 +5363,7 @@ function getModelCapabilities(modelId) {
5273
5363
  maxOutputTokens: 32e3,
5274
5364
  supportsStructuredOutput: false,
5275
5365
  rejectsSamplingParameters: false,
5366
+ rejectsThinkingDisabledAboveHighEffort: false,
5276
5367
  isKnownModel: true
5277
5368
  };
5278
5369
  } else if (modelId.includes("claude-3-haiku")) {
@@ -5280,6 +5371,7 @@ function getModelCapabilities(modelId) {
5280
5371
  maxOutputTokens: 4096,
5281
5372
  supportsStructuredOutput: false,
5282
5373
  rejectsSamplingParameters: false,
5374
+ rejectsThinkingDisabledAboveHighEffort: false,
5283
5375
  isKnownModel: true
5284
5376
  };
5285
5377
  } else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
@@ -5287,6 +5379,7 @@ function getModelCapabilities(modelId) {
5287
5379
  maxOutputTokens: 4096,
5288
5380
  supportsStructuredOutput: false,
5289
5381
  rejectsSamplingParameters: false,
5382
+ rejectsThinkingDisabledAboveHighEffort: false,
5290
5383
  isKnownModel: false
5291
5384
  };
5292
5385
  } else if (modelId.includes("claude-")) {
@@ -5294,6 +5387,7 @@ function getModelCapabilities(modelId) {
5294
5387
  maxOutputTokens: 128e3,
5295
5388
  supportsStructuredOutput: true,
5296
5389
  rejectsSamplingParameters: true,
5390
+ rejectsThinkingDisabledAboveHighEffort: true,
5297
5391
  isKnownModel: false
5298
5392
  };
5299
5393
  } else {
@@ -5301,6 +5395,7 @@ function getModelCapabilities(modelId) {
5301
5395
  maxOutputTokens: 4096,
5302
5396
  supportsStructuredOutput: false,
5303
5397
  rejectsSamplingParameters: false,
5398
+ rejectsThinkingDisabledAboveHighEffort: false,
5304
5399
  isKnownModel: false
5305
5400
  };
5306
5401
  }