@ai-sdk/anthropic 4.0.112 → 4.0.113

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.js CHANGED
@@ -180,6 +180,12 @@ const anthropicProviderOptions = { language: {
180
180
  contextManagement: { description: "Server-side context management." }
181
181
  } };
182
182
  const onlyWithoutThinking = { condition: "Only supported when thinking is disabled." };
183
+ const computerToolsetOnly = { condition: "Requires computer_toolset_20260801." };
184
+ const recentComputerProtocols = { condition: "Requires computer_20251124 or computer_toolset_20260801." };
185
+ const computer20250124Only = { condition: "Requires computer_20250124." };
186
+ const computer20251124Only = { condition: "Requires computer_20251124." };
187
+ const computer2025Protocols = { condition: "Requires computer_20250124 or computer_20251124." };
188
+ const contextManagementWithoutCompaction = { condition: "Use clear_tool_uses_20250919; compaction edits are unsupported." };
183
189
  /**
184
190
  * Language model matrix: model IDs by capability. To add a model, add a row and
185
191
  * fill in every column.
@@ -201,12 +207,16 @@ const languageModelDefinitions = {
201
207
  "xhigh",
202
208
  "max"
203
209
  ],
204
- sampling: onlyWithoutThinking,
210
+ sampling: false,
205
211
  forcedToolUse: false,
212
+ computerUse: computerToolsetOnly,
206
213
  toolSearch: true,
207
214
  compaction: true,
215
+ contextManagement: true,
216
+ midConversationSystemMessages: true,
217
+ inferenceGeo: true,
208
218
  effort: true,
209
- speed: false,
219
+ speed: true,
210
220
  taskBudget: "unknown"
211
221
  },
212
222
  "claude-opus-5": {
@@ -215,7 +225,7 @@ const languageModelDefinitions = {
215
225
  knownModel: true,
216
226
  nativeStructuredOutput: true,
217
227
  thinking: {
218
- modes: ["adaptive", "budget"],
228
+ modes: ["adaptive"],
219
229
  canBeDisabled: "up-to-high-effort"
220
230
  },
221
231
  reasoningEfforts: [
@@ -225,12 +235,16 @@ const languageModelDefinitions = {
225
235
  "xhigh",
226
236
  "max"
227
237
  ],
228
- sampling: onlyWithoutThinking,
238
+ sampling: false,
229
239
  forcedToolUse: true,
240
+ computerUse: recentComputerProtocols,
230
241
  toolSearch: true,
231
242
  compaction: true,
243
+ contextManagement: true,
244
+ midConversationSystemMessages: true,
245
+ inferenceGeo: true,
232
246
  effort: true,
233
- speed: false,
247
+ speed: true,
234
248
  taskBudget: "unknown"
235
249
  },
236
250
  "claude-sonnet-5-5": {
@@ -249,10 +263,14 @@ const languageModelDefinitions = {
249
263
  "xhigh",
250
264
  "max"
251
265
  ],
252
- sampling: onlyWithoutThinking,
266
+ sampling: false,
253
267
  forcedToolUse: false,
268
+ computerUse: computerToolsetOnly,
254
269
  toolSearch: true,
255
270
  compaction: true,
271
+ contextManagement: true,
272
+ midConversationSystemMessages: true,
273
+ inferenceGeo: true,
256
274
  effort: true,
257
275
  speed: false,
258
276
  taskBudget: "unknown"
@@ -263,7 +281,7 @@ const languageModelDefinitions = {
263
281
  knownModel: true,
264
282
  nativeStructuredOutput: true,
265
283
  thinking: {
266
- modes: ["adaptive", "budget"],
284
+ modes: ["adaptive"],
267
285
  canBeDisabled: "always"
268
286
  },
269
287
  reasoningEfforts: [
@@ -273,10 +291,14 @@ const languageModelDefinitions = {
273
291
  "xhigh",
274
292
  "max"
275
293
  ],
276
- sampling: onlyWithoutThinking,
294
+ sampling: false,
277
295
  forcedToolUse: true,
296
+ computerUse: recentComputerProtocols,
278
297
  toolSearch: true,
279
298
  compaction: true,
299
+ contextManagement: true,
300
+ midConversationSystemMessages: true,
301
+ inferenceGeo: true,
280
302
  effort: true,
281
303
  speed: false,
282
304
  taskBudget: "unknown"
@@ -297,10 +319,14 @@ const languageModelDefinitions = {
297
319
  "xhigh",
298
320
  "max"
299
321
  ],
300
- sampling: onlyWithoutThinking,
322
+ sampling: false,
301
323
  forcedToolUse: true,
324
+ computerUse: computerToolsetOnly,
302
325
  toolSearch: true,
303
326
  compaction: true,
327
+ contextManagement: true,
328
+ midConversationSystemMessages: true,
329
+ inferenceGeo: true,
304
330
  effort: true,
305
331
  speed: false,
306
332
  taskBudget: "unknown"
@@ -321,12 +347,16 @@ const languageModelDefinitions = {
321
347
  "xhigh",
322
348
  "max"
323
349
  ],
324
- sampling: onlyWithoutThinking,
350
+ sampling: false,
325
351
  forcedToolUse: false,
352
+ computerUse: computerToolsetOnly,
326
353
  toolSearch: true,
327
354
  compaction: true,
355
+ contextManagement: true,
356
+ midConversationSystemMessages: true,
357
+ inferenceGeo: true,
328
358
  effort: true,
329
- speed: false,
359
+ speed: true,
330
360
  taskBudget: "unknown"
331
361
  },
332
362
  "claude-fable-5-1": {
@@ -345,10 +375,14 @@ const languageModelDefinitions = {
345
375
  "xhigh",
346
376
  "max"
347
377
  ],
348
- sampling: onlyWithoutThinking,
378
+ sampling: false,
349
379
  forcedToolUse: false,
380
+ computerUse: recentComputerProtocols,
350
381
  toolSearch: true,
351
382
  compaction: true,
383
+ contextManagement: true,
384
+ midConversationSystemMessages: true,
385
+ inferenceGeo: true,
352
386
  effort: true,
353
387
  speed: false,
354
388
  taskBudget: "unknown"
@@ -369,10 +403,14 @@ const languageModelDefinitions = {
369
403
  "xhigh",
370
404
  "max"
371
405
  ],
372
- sampling: onlyWithoutThinking,
406
+ sampling: false,
373
407
  forcedToolUse: true,
408
+ computerUse: recentComputerProtocols,
374
409
  toolSearch: true,
375
410
  compaction: true,
411
+ contextManagement: true,
412
+ midConversationSystemMessages: true,
413
+ inferenceGeo: true,
376
414
  effort: true,
377
415
  speed: false,
378
416
  taskBudget: "unknown"
@@ -383,7 +421,7 @@ const languageModelDefinitions = {
383
421
  knownModel: true,
384
422
  nativeStructuredOutput: true,
385
423
  thinking: {
386
- modes: ["adaptive", "budget"],
424
+ modes: ["adaptive"],
387
425
  canBeDisabled: "always"
388
426
  },
389
427
  reasoningEfforts: [
@@ -393,12 +431,16 @@ const languageModelDefinitions = {
393
431
  "xhigh",
394
432
  "max"
395
433
  ],
396
- sampling: onlyWithoutThinking,
434
+ sampling: false,
397
435
  forcedToolUse: true,
436
+ computerUse: recentComputerProtocols,
398
437
  toolSearch: true,
399
438
  compaction: true,
439
+ contextManagement: true,
440
+ midConversationSystemMessages: true,
441
+ inferenceGeo: true,
400
442
  effort: true,
401
- speed: false,
443
+ speed: true,
402
444
  taskBudget: "unknown"
403
445
  },
404
446
  "claude-opus-4-7": {
@@ -407,7 +449,7 @@ const languageModelDefinitions = {
407
449
  knownModel: true,
408
450
  nativeStructuredOutput: true,
409
451
  thinking: {
410
- modes: ["adaptive", "budget"],
452
+ modes: ["adaptive"],
411
453
  canBeDisabled: "always"
412
454
  },
413
455
  reasoningEfforts: [
@@ -417,10 +459,14 @@ const languageModelDefinitions = {
417
459
  "xhigh",
418
460
  "max"
419
461
  ],
420
- sampling: onlyWithoutThinking,
462
+ sampling: false,
421
463
  forcedToolUse: true,
464
+ computerUse: computer20251124Only,
422
465
  toolSearch: true,
423
466
  compaction: true,
467
+ contextManagement: true,
468
+ midConversationSystemMessages: false,
469
+ inferenceGeo: true,
424
470
  effort: true,
425
471
  speed: false,
426
472
  taskBudget: true
@@ -434,14 +480,23 @@ const languageModelDefinitions = {
434
480
  modes: ["adaptive", "budget"],
435
481
  canBeDisabled: "always"
436
482
  },
437
- reasoningEfforts: void 0,
438
- sampling: true,
483
+ reasoningEfforts: [
484
+ "low",
485
+ "medium",
486
+ "high",
487
+ "max"
488
+ ],
489
+ sampling: onlyWithoutThinking,
439
490
  forcedToolUse: true,
491
+ computerUse: computer20251124Only,
440
492
  toolSearch: true,
441
493
  compaction: true,
494
+ contextManagement: true,
495
+ midConversationSystemMessages: false,
496
+ inferenceGeo: true,
442
497
  effort: true,
443
498
  speed: true,
444
- taskBudget: "unknown"
499
+ taskBudget: false
445
500
  },
446
501
  "claude-sonnet-4-6": {
447
502
  documented: true,
@@ -452,14 +507,23 @@ const languageModelDefinitions = {
452
507
  modes: ["adaptive", "budget"],
453
508
  canBeDisabled: "always"
454
509
  },
455
- reasoningEfforts: void 0,
456
- sampling: true,
510
+ reasoningEfforts: [
511
+ "low",
512
+ "medium",
513
+ "high",
514
+ "max"
515
+ ],
516
+ sampling: onlyWithoutThinking,
457
517
  forcedToolUse: true,
518
+ computerUse: computer20251124Only,
458
519
  toolSearch: true,
459
520
  compaction: true,
521
+ contextManagement: true,
522
+ midConversationSystemMessages: false,
523
+ inferenceGeo: true,
460
524
  effort: true,
461
525
  speed: false,
462
- taskBudget: "unknown"
526
+ taskBudget: false
463
527
  },
464
528
  "claude-opus-4-5": {
465
529
  documented: true,
@@ -470,14 +534,22 @@ const languageModelDefinitions = {
470
534
  modes: ["budget"],
471
535
  canBeDisabled: "always"
472
536
  },
473
- reasoningEfforts: void 0,
474
- sampling: true,
537
+ reasoningEfforts: [
538
+ "low",
539
+ "medium",
540
+ "high"
541
+ ],
542
+ sampling: onlyWithoutThinking,
475
543
  forcedToolUse: true,
544
+ computerUse: computer2025Protocols,
476
545
  toolSearch: true,
477
546
  compaction: false,
547
+ contextManagement: contextManagementWithoutCompaction,
548
+ midConversationSystemMessages: false,
549
+ inferenceGeo: false,
478
550
  effort: true,
479
551
  speed: false,
480
- taskBudget: "unknown"
552
+ taskBudget: false
481
553
  },
482
554
  "claude-haiku-4-5": {
483
555
  documented: true,
@@ -488,14 +560,18 @@ const languageModelDefinitions = {
488
560
  modes: ["budget"],
489
561
  canBeDisabled: "always"
490
562
  },
491
- reasoningEfforts: void 0,
492
- sampling: true,
563
+ reasoningEfforts: [],
564
+ sampling: onlyWithoutThinking,
493
565
  forcedToolUse: true,
566
+ computerUse: computer20250124Only,
494
567
  toolSearch: true,
495
568
  compaction: false,
569
+ contextManagement: contextManagementWithoutCompaction,
570
+ midConversationSystemMessages: false,
571
+ inferenceGeo: false,
496
572
  effort: false,
497
573
  speed: false,
498
- taskBudget: "unknown"
574
+ taskBudget: false
499
575
  },
500
576
  "claude-sonnet-4-5": {
501
577
  documented: true,
@@ -506,17 +582,21 @@ const languageModelDefinitions = {
506
582
  modes: ["budget"],
507
583
  canBeDisabled: "always"
508
584
  },
509
- reasoningEfforts: void 0,
510
- sampling: true,
585
+ reasoningEfforts: [],
586
+ sampling: onlyWithoutThinking,
511
587
  forcedToolUse: true,
588
+ computerUse: computer20250124Only,
512
589
  toolSearch: true,
513
590
  compaction: false,
591
+ contextManagement: contextManagementWithoutCompaction,
592
+ midConversationSystemMessages: false,
593
+ inferenceGeo: false,
514
594
  effort: false,
515
595
  speed: false,
516
- taskBudget: "unknown"
596
+ taskBudget: false
517
597
  },
518
598
  "claude-opus-4-1": {
519
- documented: true,
599
+ documented: false,
520
600
  maxOutputTokens: 32e3,
521
601
  knownModel: true,
522
602
  nativeStructuredOutput: true,
@@ -527,14 +607,18 @@ const languageModelDefinitions = {
527
607
  reasoningEfforts: void 0,
528
608
  sampling: true,
529
609
  forcedToolUse: true,
610
+ computerUse: true,
530
611
  toolSearch: false,
531
612
  compaction: false,
613
+ contextManagement: true,
614
+ midConversationSystemMessages: true,
615
+ inferenceGeo: true,
532
616
  effort: false,
533
617
  speed: false,
534
618
  taskBudget: "unknown"
535
619
  },
536
620
  "claude-opus-4-0": {
537
- documented: true,
621
+ documented: false,
538
622
  maxOutputTokens: 32e3,
539
623
  knownModel: true,
540
624
  nativeStructuredOutput: false,
@@ -545,14 +629,18 @@ const languageModelDefinitions = {
545
629
  reasoningEfforts: void 0,
546
630
  sampling: true,
547
631
  forcedToolUse: true,
632
+ computerUse: true,
548
633
  toolSearch: false,
549
634
  compaction: false,
635
+ contextManagement: true,
636
+ midConversationSystemMessages: true,
637
+ inferenceGeo: true,
550
638
  effort: false,
551
639
  speed: false,
552
640
  taskBudget: "unknown"
553
641
  },
554
642
  "claude-sonnet-4-0": {
555
- documented: true,
643
+ documented: false,
556
644
  maxOutputTokens: 64e3,
557
645
  knownModel: true,
558
646
  nativeStructuredOutput: false,
@@ -563,8 +651,12 @@ const languageModelDefinitions = {
563
651
  reasoningEfforts: void 0,
564
652
  sampling: true,
565
653
  forcedToolUse: true,
654
+ computerUse: true,
566
655
  toolSearch: false,
567
656
  compaction: false,
657
+ contextManagement: true,
658
+ midConversationSystemMessages: true,
659
+ inferenceGeo: true,
568
660
  effort: false,
569
661
  speed: false,
570
662
  taskBudget: "unknown"
@@ -581,8 +673,12 @@ const languageModelDefinitions = {
581
673
  reasoningEfforts: void 0,
582
674
  sampling: true,
583
675
  forcedToolUse: true,
676
+ computerUse: "unknown",
584
677
  toolSearch: "unknown",
585
678
  compaction: "unknown",
679
+ contextManagement: "unknown",
680
+ midConversationSystemMessages: "unknown",
681
+ inferenceGeo: "unknown",
586
682
  effort: "unknown",
587
683
  speed: "unknown",
588
684
  taskBudget: "unknown"
@@ -596,11 +692,15 @@ const languageModelDefinitions = {
596
692
  modes: ["budget"],
597
693
  canBeDisabled: "always"
598
694
  },
599
- reasoningEfforts: void 0,
600
- sampling: true,
695
+ reasoningEfforts: [],
696
+ sampling: onlyWithoutThinking,
601
697
  forcedToolUse: true,
698
+ computerUse: "unknown",
602
699
  toolSearch: "unknown",
603
700
  compaction: "unknown",
701
+ contextManagement: "unknown",
702
+ midConversationSystemMessages: "unknown",
703
+ inferenceGeo: "unknown",
604
704
  effort: "unknown",
605
705
  speed: "unknown",
606
706
  taskBudget: "unknown"
@@ -617,8 +717,12 @@ const languageModelDefinitions = {
617
717
  reasoningEfforts: void 0,
618
718
  sampling: true,
619
719
  forcedToolUse: true,
720
+ computerUse: "unknown",
620
721
  toolSearch: "unknown",
621
722
  compaction: "unknown",
723
+ contextManagement: "unknown",
724
+ midConversationSystemMessages: "unknown",
725
+ inferenceGeo: "unknown",
622
726
  effort: "unknown",
623
727
  speed: "unknown",
624
728
  taskBudget: "unknown"
@@ -635,8 +739,12 @@ const languageModelDefinitions = {
635
739
  reasoningEfforts: void 0,
636
740
  sampling: true,
637
741
  forcedToolUse: true,
742
+ computerUse: "unknown",
638
743
  toolSearch: "unknown",
639
744
  compaction: "unknown",
745
+ contextManagement: "unknown",
746
+ midConversationSystemMessages: "unknown",
747
+ inferenceGeo: "unknown",
640
748
  effort: "unknown",
641
749
  speed: "unknown",
642
750
  taskBudget: "unknown"
@@ -650,11 +758,19 @@ const languageModelDefinitions = {
650
758
  modes: ["budget"],
651
759
  canBeDisabled: "always"
652
760
  },
653
- reasoningEfforts: void 0,
654
- sampling: true,
761
+ reasoningEfforts: [
762
+ "low",
763
+ "medium",
764
+ "high"
765
+ ],
766
+ sampling: onlyWithoutThinking,
655
767
  forcedToolUse: true,
768
+ computerUse: "unknown",
656
769
  toolSearch: "unknown",
657
770
  compaction: "unknown",
771
+ contextManagement: "unknown",
772
+ midConversationSystemMessages: "unknown",
773
+ inferenceGeo: "unknown",
658
774
  effort: "unknown",
659
775
  speed: "unknown",
660
776
  taskBudget: "unknown"
@@ -671,8 +787,12 @@ const languageModelDefinitions = {
671
787
  reasoningEfforts: void 0,
672
788
  sampling: true,
673
789
  forcedToolUse: true,
790
+ computerUse: "unknown",
674
791
  toolSearch: "unknown",
675
792
  compaction: "unknown",
793
+ contextManagement: "unknown",
794
+ midConversationSystemMessages: "unknown",
795
+ inferenceGeo: "unknown",
676
796
  effort: "unknown",
677
797
  speed: "unknown",
678
798
  taskBudget: "unknown"
@@ -686,11 +806,15 @@ const languageModelDefinitions = {
686
806
  modes: ["budget"],
687
807
  canBeDisabled: "always"
688
808
  },
689
- reasoningEfforts: void 0,
690
- sampling: true,
809
+ reasoningEfforts: [],
810
+ sampling: onlyWithoutThinking,
691
811
  forcedToolUse: true,
812
+ computerUse: "unknown",
692
813
  toolSearch: "unknown",
693
814
  compaction: "unknown",
815
+ contextManagement: "unknown",
816
+ midConversationSystemMessages: "unknown",
817
+ inferenceGeo: "unknown",
694
818
  effort: "unknown",
695
819
  speed: "unknown",
696
820
  taskBudget: "unknown"
@@ -718,7 +842,7 @@ function createAnthropicLanguageModelEntry(row) {
718
842
  usage: documentedSupport,
719
843
  streaming: documentedSupport,
720
844
  forcedChoice: row.forcedToolUse,
721
- computerUse: documentedSupport,
845
+ computerUse: row.computerUse,
722
846
  webSearch: documentedSupport,
723
847
  toolSearch: row.toolSearch
724
848
  },
@@ -742,6 +866,11 @@ function createAnthropicLanguageModelEntry(row) {
742
866
  compaction: row.compaction
743
867
  } },
744
868
  providerOptions: { language: declareProviderOptions(anthropicProviderOptions.language, documentedSupport, {
869
+ structuredOutputMode: row.documented && !row.forcedToolUse ? { condition: "Use auto or outputFormat; jsonTool is converted to outputFormat." } : documentedSupport,
870
+ compaction: row.compaction,
871
+ contextManagement: row.contextManagement,
872
+ midConversationSystemMessages: row.midConversationSystemMessages,
873
+ inferenceGeo: row.inferenceGeo,
745
874
  includePings: true,
746
875
  thinking: row.thinking !== false,
747
876
  effort: row.effort,
@@ -778,10 +907,14 @@ const unknownClaudeModel = {
778
907
  "xhigh",
779
908
  "max"
780
909
  ],
781
- sampling: onlyWithoutThinking,
910
+ sampling: "unknown",
782
911
  forcedToolUse: true,
912
+ computerUse: "unknown",
783
913
  toolSearch: "unknown",
784
914
  compaction: "unknown",
915
+ contextManagement: "unknown",
916
+ midConversationSystemMessages: "unknown",
917
+ inferenceGeo: "unknown",
785
918
  effort: "unknown",
786
919
  speed: "unknown",
787
920
  taskBudget: "unknown"
@@ -799,8 +932,12 @@ const unknownLegacyModel = {
799
932
  reasoningEfforts: void 0,
800
933
  sampling: true,
801
934
  forcedToolUse: true,
935
+ computerUse: "unknown",
802
936
  toolSearch: "unknown",
803
937
  compaction: "unknown",
938
+ contextManagement: "unknown",
939
+ midConversationSystemMessages: "unknown",
940
+ inferenceGeo: "unknown",
804
941
  effort: "unknown",
805
942
  speed: "unknown",
806
943
  taskBudget: "unknown"
@@ -904,8 +1041,12 @@ function getUnlistedModelRow(modelId) {
904
1041
  return {
905
1042
  ...unlistedModelFamilies.find((family) => family.matches(modelId))?.row ?? unknownLegacyModel,
906
1043
  documented: false,
1044
+ computerUse: "unknown",
907
1045
  toolSearch: "unknown",
908
1046
  compaction: "unknown",
1047
+ contextManagement: "unknown",
1048
+ midConversationSystemMessages: "unknown",
1049
+ inferenceGeo: "unknown",
909
1050
  effort: "unknown",
910
1051
  speed: "unknown",
911
1052
  taskBudget: "unknown"
@@ -918,7 +1059,7 @@ function getAnthropicModelCapabilities(modelId) {
918
1059
  maxOutputTokens: requestConfig.maxOutputTokens,
919
1060
  supportsStructuredOutput: language.structuredOutput.native,
920
1061
  supportsAdaptiveThinking: language.reasoning.adaptive,
921
- rejectsSamplingParameters: language.sampling.temperature !== true,
1062
+ rejectsSamplingParameters: language.sampling.temperature === false || language.sampling.temperature === "unknown",
922
1063
  supportsXhighEffort: language.reasoning.supportsXhighEffort,
923
1064
  rejectsThinkingDisabledAboveHighEffort: !language.reasoning.canDisableAboveHighEffort,
924
1065
  rejectsThinkingDisabled: !language.reasoning.canDisable,
@@ -1941,8 +2082,9 @@ userId: z.string().optional() }).optional(),
1941
2082
  remaining: z.number().int().min(0).optional()
1942
2083
  }).optional(),
1943
2084
  /**
1944
- * Enable fast mode for faster inference (2.5x faster output token speeds).
1945
- * Only supported with claude-opus-4-6.
2085
+ * Enable fast mode for faster inference.
2086
+ * Supported with claude-opus-4-6, claude-opus-4-8, claude-opus-5, claude-opus-5-5,
2087
+ * and claude-fable-5-2.
1946
2088
  */
1947
2089
  speed: z.enum(["fast", "standard"]).optional(),
1948
2090
  /**
@@ -8151,7 +8293,7 @@ var AnthropicSkills = class {
8151
8293
  };
8152
8294
  //#endregion
8153
8295
  //#region src/version.ts
8154
- const VERSION = "4.0.112";
8296
+ const VERSION = "4.0.113";
8155
8297
  //#endregion
8156
8298
  //#region src/anthropic-provider.ts
8157
8299
  const ANTHROPIC_API_URL = "https://api.anthropic.com";