@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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +194 -62
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +190 -48
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +194 -62
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +189 -47
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +60 -21
- package/package.json +8 -4
- package/src/anthropic-language-model-options.ts +3 -2
- package/src/anthropic-model-catalog.ts +209 -47
package/docs/05-anthropic.mdx
CHANGED
|
@@ -596,12 +596,32 @@ When the JSON tool cannot be forced (for example with manual thinking) and the
|
|
|
596
596
|
model answers in text without calling it, the text of its final answer is
|
|
597
597
|
returned. Text before a tool call is still dropped.
|
|
598
598
|
|
|
599
|
+
### Sampling
|
|
600
|
+
|
|
601
|
+
`claude-opus-4-7`, `claude-opus-4-8`, and Claude 5 models do not support
|
|
602
|
+
configurable `temperature`, `topP`, or `topK`. The SDK omits these settings
|
|
603
|
+
with a warning. A fixed temperature of `1` may be accepted with adaptive
|
|
604
|
+
thinking, but does not provide a configurable sampling control.
|
|
605
|
+
|
|
606
|
+
Claude 4.5 and 4.6 models accept sampling settings when thinking is disabled.
|
|
607
|
+
The SDK omits sampling settings when thinking is enabled.
|
|
608
|
+
|
|
599
609
|
### Effort
|
|
600
610
|
|
|
601
611
|
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.
|
|
602
612
|
|
|
613
|
+
`claude-opus-4-5` accepts `low`, `medium`, and `high`. `claude-opus-4-6`
|
|
614
|
+
and `claude-sonnet-4-6` also accept `max`, but reject `xhigh`.
|
|
615
|
+
`claude-haiku-4-5` and `claude-sonnet-4-5` do not support the effort option.
|
|
616
|
+
|
|
603
617
|
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.
|
|
604
618
|
|
|
619
|
+
`claude-opus-4-7`, `claude-opus-4-8`, `claude-opus-5`, and `claude-sonnet-5`
|
|
620
|
+
support adaptive thinking but reject
|
|
621
|
+
thinking token budgets. The AI SDK converts
|
|
622
|
+
`thinking: { type: 'enabled', budgetTokens }` to `{ type: 'adaptive' }` and
|
|
623
|
+
emits a warning. Use `effort` to control how much these models think.
|
|
624
|
+
|
|
605
625
|
`claude-haiku-5-5` is the first Haiku model with effort levels and supports all
|
|
606
626
|
five of them. It uses adaptive thinking and does not support thinking token
|
|
607
627
|
budgets: the AI SDK converts `thinking: { type: 'enabled', budgetTokens }` to
|
|
@@ -655,7 +675,7 @@ console.log(usage); // token usage
|
|
|
655
675
|
|
|
656
676
|
### Fast Mode
|
|
657
677
|
|
|
658
|
-
Anthropic supports a [`speed` option](https://code.claude.com/docs/en/fast-mode) for `claude-opus-4-6`
|
|
678
|
+
Anthropic supports a [`speed` option](https://code.claude.com/docs/en/fast-mode) for `claude-opus-4-6`, `claude-opus-4-8`, `claude-opus-5`, `claude-opus-5-5`, and `claude-fable-5-2` that enables faster inference.
|
|
659
679
|
|
|
660
680
|
```ts highlight="8-10"
|
|
661
681
|
import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
|
|
@@ -680,6 +700,9 @@ The `speed` option accepts `'fast'` or `'standard'` (default behavior).
|
|
|
680
700
|
|
|
681
701
|
Task budgets are advisory — they do not enforce a hard token limit. The model will attempt to stay within budget, but actual usage may vary.
|
|
682
702
|
|
|
703
|
+
`claude-opus-4-5`, `claude-opus-4-6`, `claude-sonnet-4-6`,
|
|
704
|
+
`claude-haiku-4-5`, and `claude-sonnet-4-5` reject task budgets.
|
|
705
|
+
|
|
683
706
|
```ts highlight="8-13"
|
|
684
707
|
import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
|
|
685
708
|
import { generateText } from 'ai';
|
|
@@ -735,6 +758,9 @@ const { text } = await generateText({
|
|
|
735
758
|
|
|
736
759
|
The `inferenceGeo` option accepts `'us'` (US-only infrastructure) or `'global'` (default, any available geography).
|
|
737
760
|
|
|
761
|
+
`claude-opus-4-5`, `claude-haiku-4-5`, and `claude-sonnet-4-5` do not
|
|
762
|
+
support this option.
|
|
763
|
+
|
|
738
764
|
### Safety Classifiers and Fallbacks
|
|
739
765
|
|
|
740
766
|
Claude Fable 5 has safeguards that limit its performance in certain areas like cybersecurity, biology, and chemistry, and automated safety checks are run on every request.
|
|
@@ -1150,6 +1176,11 @@ on how to integrate reasoning into your chatbot.
|
|
|
1150
1176
|
|
|
1151
1177
|
Anthropic's Context Management feature allows you to automatically manage conversation context by clearing tool uses or thinking content when certain conditions are met. This helps optimize token usage and manage long conversations more efficiently.
|
|
1152
1178
|
|
|
1179
|
+
`claude-opus-4-5`, `claude-haiku-4-5`, and `claude-sonnet-4-5` accept
|
|
1180
|
+
tool-use clearing configuration, but reject compaction edits and the
|
|
1181
|
+
`compaction` provider option. The model capabilities table lists compaction
|
|
1182
|
+
support separately.
|
|
1183
|
+
|
|
1153
1184
|
You can configure context management using the `contextManagement` provider option:
|
|
1154
1185
|
|
|
1155
1186
|
```ts highlight="7-20"
|
|
@@ -2189,6 +2220,10 @@ when it follows other messages. To keep such a message in place, for example a
|
|
|
2189
2220
|
reminder appended to a conversation that has no initial instructions, set
|
|
2190
2221
|
`providerOptions.anthropic.midConversationSystemMessages: true` on the request.
|
|
2191
2222
|
|
|
2223
|
+
`claude-opus-4-5`, `claude-opus-4-6`, `claude-opus-4-7`,
|
|
2224
|
+
`claude-sonnet-4-6`, `claude-haiku-4-5`, and `claude-sonnet-4-5` reject
|
|
2225
|
+
system messages inside the message history.
|
|
2226
|
+
|
|
2192
2227
|
Use the same value on every request of a conversation. Changing it moves the
|
|
2193
2228
|
message between the top-level `system` field and `messages`, so the next request
|
|
2194
2229
|
misses the prompt cache, and thinking blocks from earlier turns can fail
|
|
@@ -2801,28 +2836,32 @@ and the `mediaType` should be set to `'application/pdf'`.
|
|
|
2801
2836
|
|
|
2802
2837
|
### Model Capabilities
|
|
2803
2838
|
|
|
2839
|
+
<Note>
|
|
2840
|
+
`claude-opus-4-0`, `claude-opus-4-1`, and `claude-sonnet-4-0` are hidden from
|
|
2841
|
+
this catalog because requests returned 404s. Their historical capability
|
|
2842
|
+
declarations could not be revalidated and may be outdated. Their internal
|
|
2843
|
+
request settings are retained for compatibility.
|
|
2844
|
+
</Note>
|
|
2845
|
+
|
|
2804
2846
|
{/* model-capabilities:anthropic-language:start */}
|
|
2805
2847
|
|
|
2806
|
-
| Model | Image Input | Object Generation | Tool Usage | Computer Use
|
|
2807
|
-
| ------------------- | ----------- | ----------------- | ---------- |
|
|
2808
|
-
| `claude-opus-5-5` | <Check /> | <Check /> | <Check /> |
|
|
2809
|
-
| `claude-opus-5` | <Check /> | <Check /> | <Check /> |
|
|
2810
|
-
| `claude-sonnet-5-5` | <Check /> | <Check /> | <Check /> |
|
|
2811
|
-
| `claude-sonnet-5` | <Check /> | <Check /> | <Check /> |
|
|
2812
|
-
| `claude-haiku-5-5` | <Check /> | <Check /> | <Check /> |
|
|
2813
|
-
| `claude-fable-5-2` | <Check /> | <Check /> | <Check /> |
|
|
2814
|
-
| `claude-fable-5-1` | <Check /> | <Check /> | <Check /> |
|
|
2815
|
-
| `claude-fable-5` | <Check /> | <Check /> | <Check /> |
|
|
2816
|
-
| `claude-opus-4-8` | <Check /> | <Check /> | <Check /> |
|
|
2817
|
-
| `claude-opus-4-7` | <Check /> | <Check /> | <Check /> |
|
|
2818
|
-
| `claude-opus-4-6` | <Check /> | <Check /> | <Check /> |
|
|
2819
|
-
| `claude-sonnet-4-6` | <Check /> | <Check /> | <Check /> |
|
|
2820
|
-
| `claude-opus-4-5` | <Check /> | <Check /> | <Check /> |
|
|
2821
|
-
| `claude-haiku-4-5` | <Check /> | <Check /> | <Check /> |
|
|
2822
|
-
| `claude-sonnet-4-5` | <Check /> | <Check /> | <Check /> |
|
|
2823
|
-
| `claude-opus-4-1` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
|
|
2824
|
-
| `claude-opus-4-0` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
|
|
2825
|
-
| `claude-sonnet-4-0` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
|
|
2848
|
+
| Model | Image Input | Object Generation | Tool Usage | Computer Use | Web Search | Tool Search | Compaction |
|
|
2849
|
+
| ------------------- | ----------- | ----------------- | ---------- | --------------------------------------------------------------------- | ---------- | ----------- | ---------- |
|
|
2850
|
+
| `claude-opus-5-5` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_toolset_20260801. | <Check /> | <Check /> | <Check /> |
|
|
2851
|
+
| `claude-opus-5` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20251124 or computer_toolset_20260801. | <Check /> | <Check /> | <Check /> |
|
|
2852
|
+
| `claude-sonnet-5-5` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_toolset_20260801. | <Check /> | <Check /> | <Check /> |
|
|
2853
|
+
| `claude-sonnet-5` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20251124 or computer_toolset_20260801. | <Check /> | <Check /> | <Check /> |
|
|
2854
|
+
| `claude-haiku-5-5` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_toolset_20260801. | <Check /> | <Check /> | <Check /> |
|
|
2855
|
+
| `claude-fable-5-2` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_toolset_20260801. | <Check /> | <Check /> | <Check /> |
|
|
2856
|
+
| `claude-fable-5-1` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20251124 or computer_toolset_20260801. | <Check /> | <Check /> | <Check /> |
|
|
2857
|
+
| `claude-fable-5` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20251124 or computer_toolset_20260801. | <Check /> | <Check /> | <Check /> |
|
|
2858
|
+
| `claude-opus-4-8` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20251124 or computer_toolset_20260801. | <Check /> | <Check /> | <Check /> |
|
|
2859
|
+
| `claude-opus-4-7` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20251124. | <Check /> | <Check /> | <Check /> |
|
|
2860
|
+
| `claude-opus-4-6` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20251124. | <Check /> | <Check /> | <Check /> |
|
|
2861
|
+
| `claude-sonnet-4-6` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20251124. | <Check /> | <Check /> | <Check /> |
|
|
2862
|
+
| `claude-opus-4-5` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20250124 or computer_20251124. | <Check /> | <Check /> | <Cross /> |
|
|
2863
|
+
| `claude-haiku-4-5` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20250124. | <Check /> | <Check /> | <Cross /> |
|
|
2864
|
+
| `claude-sonnet-4-5` | <Check /> | <Check /> | <Check /> | Conditional: Requires computer_20250124. | <Check /> | <Check /> | <Cross /> |
|
|
2826
2865
|
|
|
2827
2866
|
{/* model-capabilities:anthropic-language:end */}
|
|
2828
2867
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/anthropic",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.113",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,16 +35,17 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ai-sdk/provider": "4.0.
|
|
39
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
38
|
+
"@ai-sdk/provider": "4.0.40",
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.87"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@ai-sdk/test-server": "2.0.4",
|
|
43
43
|
"@types/node": "22.19.19",
|
|
44
|
+
"@typescript/native": "npm:typescript@7.0.2",
|
|
44
45
|
"@vercel/ai-tsconfig": "0.0.0",
|
|
45
46
|
"@vercel/ai-tsdown-config": "0.0.0",
|
|
46
47
|
"tsdown": "^0.23.0",
|
|
47
|
-
"typescript": "6.0.
|
|
48
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
48
49
|
"zod": "4.6.7"
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
@@ -75,6 +76,9 @@
|
|
|
75
76
|
"clean": "del-cli docs",
|
|
76
77
|
"type-check": "tsc --noEmit",
|
|
77
78
|
"test": "pnpm test:node && pnpm test:edge",
|
|
79
|
+
"test:node22": "node ../../tools/with-node.mjs 22 pnpm test",
|
|
80
|
+
"test:node24": "node ../../tools/with-node.mjs 24 pnpm test",
|
|
81
|
+
"test:node26": "node ../../tools/with-node.mjs 26 pnpm test",
|
|
78
82
|
"test:update": "pnpm test:node -u",
|
|
79
83
|
"test:watch": "vitest --config vitest.node.config.js",
|
|
80
84
|
"test:edge": "vitest --config vitest.edge.config.js --run",
|
|
@@ -369,8 +369,9 @@ export const anthropicLanguageModelOptions = lazySchema(() =>
|
|
|
369
369
|
.optional(),
|
|
370
370
|
|
|
371
371
|
/**
|
|
372
|
-
* Enable fast mode for faster inference
|
|
373
|
-
*
|
|
372
|
+
* Enable fast mode for faster inference.
|
|
373
|
+
* Supported with claude-opus-4-6, claude-opus-4-8, claude-opus-5, claude-opus-5-5,
|
|
374
|
+
* and claude-fable-5-2.
|
|
374
375
|
*/
|
|
375
376
|
speed: z.enum(['fast', 'standard']).optional(),
|
|
376
377
|
|