@ai-sdk/anthropic 3.0.42 → 3.0.44
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 +13 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +2 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +2 -2
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +25 -0
- package/package.json +2 -2
- package/src/anthropic-messages-api.ts +2 -0
- package/src/anthropic-messages-language-model.ts +1 -1
- package/src/anthropic-messages-options.ts +1 -1
package/docs/05-anthropic.mdx
CHANGED
|
@@ -125,6 +125,10 @@ The following optional provider options are available for Anthropic models:
|
|
|
125
125
|
|
|
126
126
|
Optional. See [Effort section](#effort) for more details.
|
|
127
127
|
|
|
128
|
+
- `speed` _"fast" | "standard"_
|
|
129
|
+
|
|
130
|
+
Optional. See [Fast Mode section](#fast-mode) for more details.
|
|
131
|
+
|
|
128
132
|
- `thinking` _object_
|
|
129
133
|
|
|
130
134
|
Optional. See [Reasoning section](#reasoning) for more details.
|
|
@@ -192,6 +196,27 @@ console.log(text); // resulting text
|
|
|
192
196
|
console.log(usage); // token usage
|
|
193
197
|
```
|
|
194
198
|
|
|
199
|
+
### Fast Mode
|
|
200
|
+
|
|
201
|
+
Anthropic supports a [`speed` option](https://code.claude.com/docs/en/fast-mode) for `claude-opus-4-6` that enables faster inference with approximately 2.5x faster output token speeds.
|
|
202
|
+
|
|
203
|
+
```ts highlight="8-10"
|
|
204
|
+
import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
|
|
205
|
+
import { generateText } from 'ai';
|
|
206
|
+
|
|
207
|
+
const { text } = await generateText({
|
|
208
|
+
model: anthropic('claude-opus-4-6'),
|
|
209
|
+
prompt: 'Write a short poem about the sea.',
|
|
210
|
+
providerOptions: {
|
|
211
|
+
anthropic: {
|
|
212
|
+
speed: 'fast',
|
|
213
|
+
} satisfies AnthropicLanguageModelOptions,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The `speed` option accepts `'fast'` or `'standard'` (default behavior).
|
|
219
|
+
|
|
195
220
|
### Reasoning
|
|
196
221
|
|
|
197
222
|
Anthropic has reasoning support for `claude-opus-4-20250514`, `claude-sonnet-4-20250514`, and `claude-3-7-sonnet-20250219` models.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/anthropic",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.44",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@ai-sdk/provider": "3.0.8",
|
|
40
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
40
|
+
"@ai-sdk/provider-utils": "4.0.15"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "20.17.24",
|
|
@@ -439,6 +439,8 @@ export type AnthropicTool =
|
|
|
439
439
|
name: string;
|
|
440
440
|
};
|
|
441
441
|
|
|
442
|
+
export type AnthropicSpeed = 'fast' | 'standard';
|
|
443
|
+
|
|
442
444
|
export type AnthropicToolChoice =
|
|
443
445
|
| { type: 'auto' | 'any'; disable_parallel_tool_use?: boolean }
|
|
444
446
|
| { type: 'tool'; name: string; disable_parallel_tool_use?: boolean };
|
|
@@ -174,7 +174,7 @@ export const anthropicLanguageModelOptions = z.object({
|
|
|
174
174
|
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
175
175
|
* Only supported with claude-opus-4-6.
|
|
176
176
|
*/
|
|
177
|
-
speed: z.
|
|
177
|
+
speed: z.enum(['fast', 'standard']).optional(),
|
|
178
178
|
|
|
179
179
|
contextManagement: z
|
|
180
180
|
.object({
|