@ai-sdk/anthropic 4.0.99 → 4.0.101

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.
@@ -548,8 +548,8 @@ const result = streamText({
548
548
  });
549
549
  ```
550
550
 
551
- For `claude-sonnet-5-5`, `claude-opus-5-5`, and `claude-fable-5-1`, the
552
- default `"auto"` mode uses native structured outputs through
551
+ For `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5-1`, and
552
+ `claude-fable-5-2`, the default `"auto"` mode uses native structured outputs through
553
553
  `output_config.format`. These models reject forced tool use, so the
554
554
  `"jsonTool"` mode cannot be used with them. If you
555
555
  request `"jsonTool"` anyway, the provider falls back to `"outputFormat"` and
@@ -584,7 +584,7 @@ returned. Text before a tool call is still dropped.
584
584
 
585
585
  ### Effort
586
586
 
587
- Anthropic introduced an `effort` option with `claude-opus-4-5` that affects thinking, text responses, and function calls. Effort defaults to `high` and you can set it to `medium` or `low` to save tokens and to lower time-to-last-token latency (TTLT). `claude-opus-4-7`, `claude-opus-4-8`, `claude-opus-5`, `claude-opus-5-5`, `claude-fable-5`, `claude-fable-5-1`, `claude-sonnet-5`, `claude-sonnet-5-5`, and `claude-haiku-5-5` additionally support `xhigh` for maximum reasoning effort.
587
+ Anthropic introduced an `effort` option with `claude-opus-4-5` that affects thinking, text responses, and function calls. Effort defaults to `high` and you can set it to `medium` or `low` to save tokens and to lower time-to-last-token latency (TTLT). `claude-opus-4-7`, `claude-opus-4-8`, `claude-opus-5`, `claude-opus-5-5`, `claude-fable-5`, `claude-fable-5-1`, `claude-fable-5-2`, `claude-sonnet-5`, `claude-sonnet-5-5`, and `claude-haiku-5-5` additionally support `xhigh` for maximum reasoning effort.
588
588
 
589
589
  On `claude-opus-5` and `claude-haiku-5-5`, thinking can only be disabled at effort levels up to and including `high`. When you combine `thinking: { type: 'disabled' }` with `effort: 'xhigh'` or `effort: 'max'`, the AI SDK lowers the effort to `high` and emits a warning instead of sending a request that the API would reject.
590
590
 
@@ -597,6 +597,13 @@ thinks. Unlike `claude-sonnet-5-5`, thinking can still be turned off with
597
597
  Start at `medium` effort and test other levels rather than carrying over the
598
598
  settings you used on `claude-haiku-4-5`.
599
599
 
600
+ On `claude-fable-5-2`, thinking is always adaptive and cannot be disabled. It
601
+ supports `low`, `medium`, `high` (the API default), `xhigh`, and `max` effort.
602
+ The `medium` and `xhigh` levels behave differently than on `claude-fable-5-1`,
603
+ so start at `high` and re-test `medium` and your current setting rather than
604
+ carrying over the effort you tuned for `claude-fable-5-1`. Reserve `xhigh` for
605
+ the hardest long-running work where you have measured a gain.
606
+
600
607
  On `claude-opus-5-5`, thinking is always adaptive and cannot be disabled, so
601
608
  `effort` is the main control for latency and cost. The API default effort for
602
609
  `claude-opus-5-5` is `medium`. Start there and test other levels rather than
@@ -891,8 +898,8 @@ const { text } = await generateText({
891
898
 
892
899
  ##### Adaptive-Only Models
893
900
 
894
- `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5`, and
895
- `claude-fable-5-1` always run adaptive thinking. The API rejects
901
+ `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5`, `claude-fable-5-1`,
902
+ and `claude-fable-5-2` always run adaptive thinking. The API rejects
896
903
  `thinking: { type: 'disabled' }` and budget-based
897
904
  `thinking: { type: 'enabled' }` for these models. To keep existing code
898
905
  working, the provider:
@@ -993,8 +1000,8 @@ console.log(text);
993
1000
 
994
1001
  ##### Thinking Updates
995
1002
 
996
- Use `display: 'updates'` with `claude-sonnet-5-5`, `claude-opus-5-5`, or
997
- `claude-fable-5-1` to stream thinking summaries between tool calls. These models
1003
+ Use `display: 'updates'` with `claude-sonnet-5-5`, `claude-opus-5-5`,
1004
+ `claude-fable-5-1`, or `claude-fable-5-2` to stream thinking summaries between tool calls. These models
998
1005
  return progress notes between tool calls as thinking blocks rather than text, so
999
1006
  without this setting a long tool-calling turn can look silent. The provider adds
1000
1007
  the required `thinking-display-updates-2026-08-18` beta header automatically:
@@ -1022,7 +1029,28 @@ const result = streamText({
1022
1029
 
1023
1030
  ##### Thinking Binding Controls
1024
1031
 
1025
- Fable 5.1, Opus 5.5, and Sonnet 5.5 can recover from a thinking-block prefix
1032
+ Fable 5.2, Fable 5.1, Opus 5.5, and Sonnet 5.5 use preserved thinking. Each
1033
+ thinking block from an earlier assistant turn is bound to the request content
1034
+ before it: the system prompt, the tools, and the earlier messages. If that
1035
+ content changes between requests, the thinking blocks after the change become
1036
+ invalid. By default, the API then rejects the request with a 400 error ("The
1037
+ block is bound to a different conversation"). Keep the message history
1038
+ append-only, and keep the system prompt and tools stable, where you can.
1039
+
1040
+ This also applies inside a single multi-step `generateText` or `streamText`
1041
+ call. When `prepareStep` returns a different `system`, `activeTools`, or
1042
+ `messages` for a later step, the thinking from the earlier steps is sent with
1043
+ the changed content, and the next step fails. Editing or removing earlier
1044
+ messages between turns, or changing the system prompt or tools between turns,
1045
+ has the same effect.
1046
+
1047
+ If your application changes this content, set
1048
+ `blockBinding.prefixMismatchBehavior` to `drop_block` (see below). The API then
1049
+ drops the invalid thinking blocks instead of rejecting the request. The model
1050
+ thinks again for the dropped context, which can increase output token usage, so
1051
+ measure token usage on your own workloads before you rely on it.
1052
+
1053
+ Fable 5.2, Fable 5.1, Opus 5.5, and Sonnet 5.5 can recover from a thinking-block prefix
1026
1054
  mismatch by dropping the mismatched block. Set
1027
1055
  `blockBinding.prefixMismatchBehavior` to `drop_block`, or set it to `error` to
1028
1056
  reject the request. You can provide block binding by itself to preserve the
@@ -1661,10 +1689,10 @@ const computerTool = anthropic.tools.computer_20251124({
1661
1689
 
1662
1690
  <Note>
1663
1691
  Use `computerToolset_20260801` for Claude Sonnet 5.5 and Opus 5.5 (required),
1664
- Opus 5, Sonnet 5, Fable 5, Fable 5.1, and Opus 4.8. Use `computer_20251124`
1665
- for Claude Opus 4.5 through Opus 4.7, which support the zoom action. Use
1666
- `computer_20250124` for Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus
1667
- 4, and Sonnet 3.7.
1692
+ Opus 5, Sonnet 5, Fable 5, Fable 5.1, Fable 5.2, and Opus 4.8. Use
1693
+ `computer_20251124` for Claude Opus 4.5 through Opus 4.7, which support the
1694
+ zoom action. Use `computer_20250124` for Claude Sonnet 4.5, Haiku 4.5, Opus
1695
+ 4.1, Sonnet 4, Opus 4, and Sonnet 3.7.
1668
1696
  </Note>
1669
1697
 
1670
1698
  #### Computer Toolset
@@ -2067,8 +2095,8 @@ This sends `tool_reference` blocks to Anthropic, which loads the corresponding d
2067
2095
 
2068
2096
  ### Mid-Conversation System Controls
2069
2097
 
2070
- With `claude-sonnet-5-5`, `claude-opus-5-5`, and `claude-fable-5-1`, use an
2071
- empty system message to change effort from the next user turn. A separate
2098
+ With `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5-1`, and
2099
+ `claude-fable-5-2`, use an empty system message to change effort from the next user turn. A separate
2072
2100
  system message containing text can provide a turn-scoped reminder with
2073
2101
  `clearAt: 'next_user_message'`: its text applies until the next user message. Keep the reminder after a user turn and
2074
2102
  before an assistant turn, or at the end of the messages array.
@@ -2744,6 +2772,7 @@ and the `mediaType` should be set to `'application/pdf'`.
2744
2772
  | `claude-sonnet-5-5` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
2745
2773
  | `claude-sonnet-5` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
2746
2774
  | `claude-haiku-5-5` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
2775
+ | `claude-fable-5-2` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
2747
2776
  | `claude-fable-5-1` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
2748
2777
  | `claude-fable-5` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
2749
2778
  | `claude-opus-4-8` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "4.0.99",
3
+ "version": "4.0.101",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@ai-sdk/provider": "4.0.37",
39
- "@ai-sdk/provider-utils": "5.0.76"
39
+ "@ai-sdk/provider-utils": "5.0.78"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@ai-sdk/test-server": "2.0.4",
@@ -29,6 +29,7 @@ export type AnthropicModelId =
29
29
  | 'claude-opus-5-5'
30
30
  | 'claude-fable-5'
31
31
  | 'claude-fable-5-1'
32
+ | 'claude-fable-5-2'
32
33
  | 'claude-sonnet-5'
33
34
  | 'claude-sonnet-5-5'
34
35
  | (string & {});
@@ -181,7 +181,9 @@ const runtimeRules: readonly {
181
181
  }),
182
182
  },
183
183
  {
184
- matches: modelId => modelId.includes('claude-fable-5-1'),
184
+ matches: modelId =>
185
+ modelId.includes('claude-fable-5-2') ||
186
+ modelId.includes('claude-fable-5-1'),
185
187
  definition: defineRuntime({
186
188
  ...currentClaudeWithoutSampling,
187
189
  thinkingCanBeDisabled: false,
@@ -252,6 +254,7 @@ const documentedModels: Readonly<Record<string, DocumentedCapabilities>> = {
252
254
  'claude-sonnet-5-5': { toolSearch: true, compaction: true, effort: true },
253
255
  'claude-sonnet-5': { toolSearch: true, compaction: true, effort: true },
254
256
  'claude-haiku-5-5': { toolSearch: true, compaction: true, effort: true },
257
+ 'claude-fable-5-2': { toolSearch: true, compaction: true, effort: true },
255
258
  'claude-fable-5-1': { toolSearch: true, compaction: true, effort: true },
256
259
  'claude-fable-5': { toolSearch: true, compaction: true, effort: true },
257
260
  'claude-opus-4-8': { toolSearch: true, compaction: true, effort: true },