@ai-sdk/anthropic 4.0.0-beta.5 → 4.0.0-beta.67

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +500 -4
  2. package/README.md +2 -0
  3. package/dist/index.d.ts +265 -68
  4. package/dist/index.js +2636 -1427
  5. package/dist/index.js.map +1 -1
  6. package/dist/internal/index.d.ts +234 -62
  7. package/dist/internal/index.js +2605 -1413
  8. package/dist/internal/index.js.map +1 -1
  9. package/docs/05-anthropic.mdx +303 -20
  10. package/package.json +16 -17
  11. package/src/{anthropic-messages-api.ts → anthropic-api.ts} +158 -17
  12. package/src/anthropic-error.ts +1 -1
  13. package/src/anthropic-files.ts +95 -0
  14. package/src/{anthropic-messages-options.ts → anthropic-language-model-options.ts} +104 -11
  15. package/src/{anthropic-messages-language-model.ts → anthropic-language-model.ts} +494 -96
  16. package/src/anthropic-message-metadata.ts +69 -9
  17. package/src/anthropic-prepare-tools.ts +31 -7
  18. package/src/anthropic-provider.ts +42 -13
  19. package/src/anthropic-tools.ts +31 -0
  20. package/src/convert-anthropic-usage.ts +109 -0
  21. package/src/{convert-to-anthropic-messages-prompt.ts → convert-to-anthropic-prompt.ts} +376 -198
  22. package/src/forward-anthropic-container-id-from-last-step.ts +2 -2
  23. package/src/get-cache-control.ts +5 -2
  24. package/src/index.ts +1 -1
  25. package/src/internal/index.ts +13 -2
  26. package/src/map-anthropic-stop-reason.ts +1 -1
  27. package/src/sanitize-json-schema.ts +203 -0
  28. package/src/skills/anthropic-skills-api.ts +44 -0
  29. package/src/skills/anthropic-skills.ts +132 -0
  30. package/src/tool/advisor_20260301.ts +128 -0
  31. package/src/tool/bash_20241022.ts +84 -13
  32. package/src/tool/bash_20250124.ts +84 -13
  33. package/src/tool/code-execution_20250522.ts +2 -2
  34. package/src/tool/code-execution_20250825.ts +2 -2
  35. package/src/tool/code-execution_20260120.ts +2 -2
  36. package/src/tool/computer_20241022.ts +2 -2
  37. package/src/tool/computer_20250124.ts +2 -2
  38. package/src/tool/computer_20251124.ts +2 -2
  39. package/src/tool/memory_20250818.ts +2 -2
  40. package/src/tool/text-editor_20241022.ts +2 -2
  41. package/src/tool/text-editor_20250124.ts +2 -2
  42. package/src/tool/text-editor_20250429.ts +2 -2
  43. package/src/tool/text-editor_20250728.ts +6 -3
  44. package/src/tool/tool-search-bm25_20251119.ts +2 -2
  45. package/src/tool/tool-search-regex_20251119.ts +2 -2
  46. package/src/tool/web-fetch-20250910.ts +2 -2
  47. package/src/tool/web-fetch-20260209.ts +2 -2
  48. package/src/tool/web-search_20250305.ts +2 -2
  49. package/src/tool/web-search_20260209.ts +2 -2
  50. package/dist/index.d.mts +0 -1090
  51. package/dist/index.mjs +0 -5244
  52. package/dist/index.mjs.map +0 -1
  53. package/dist/internal/index.d.mts +0 -969
  54. package/dist/internal/index.mjs +0 -5136
  55. package/dist/internal/index.mjs.map +0 -1
  56. package/src/convert-anthropic-messages-usage.ts +0 -73
package/dist/index.d.ts CHANGED
@@ -1,15 +1,31 @@
1
- import { JSONObject, ProviderV4, LanguageModelV4 } from '@ai-sdk/provider';
1
+ import { JSONObject, ProviderV4, LanguageModelV4, FilesV4, SkillsV4 } from '@ai-sdk/provider';
2
2
  import { z } from 'zod/v4';
3
3
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
- import { FetchFunction } from '@ai-sdk/provider-utils';
4
+ import { ToolExecuteFunction, Tool, Experimental_SandboxSession, ProviderDefinedTool, FetchFunction } from '@ai-sdk/provider-utils';
5
5
 
6
6
  /**
7
7
  * Represents a single iteration in the usage breakdown.
8
- * When compaction occurs, the API returns an iterations array showing
9
- * usage for each sampling iteration (compaction + message).
8
+ *
9
+ * The API returns an iterations array showing usage for each sampling
10
+ * iteration. Iterations can be:
11
+ * - `compaction`: a context compaction step (billed at executor rates).
12
+ * - `message`: an executor sampling iteration (billed at executor rates).
13
+ * - `advisor_message`: an advisor sub-inference (billed at the advisor
14
+ * model's rates). Advisor token usage is NOT rolled into the top-level
15
+ * usage totals because it bills at a different rate; inspect this array
16
+ * directly for advisor billing.
17
+ * - `fallback_message`: a server-side fallback attempt that served the turn.
18
+ * Inspect this array for exact per-model attribution on a turn that fell
19
+ * back.
10
20
  */
11
- interface AnthropicUsageIteration {
12
- type: 'compaction' | 'message';
21
+ type AnthropicUsageIteration = {
22
+ type: 'compaction' | 'message' | 'advisor_message' | 'fallback_message';
23
+ /**
24
+ * The model that produced this iteration. Populated for the per-model
25
+ * attribution cases (the fallback chain and advisor sub-inferences) and
26
+ * absent otherwise.
27
+ */
28
+ model?: string;
13
29
  /**
14
30
  * Number of input tokens consumed in this iteration.
15
31
  */
@@ -18,11 +34,50 @@ interface AnthropicUsageIteration {
18
34
  * Number of output tokens generated in this iteration.
19
35
  */
20
36
  outputTokens: number;
21
- }
37
+ /**
38
+ * Number of cache-creation input tokens consumed in this iteration.
39
+ */
40
+ cacheCreationInputTokens?: number;
41
+ /**
42
+ * Number of cache-read input tokens consumed in this iteration.
43
+ */
44
+ cacheReadInputTokens?: number;
45
+ };
22
46
  interface AnthropicMessageMetadata {
23
47
  usage: JSONObject;
24
- cacheCreationInputTokens: number | null;
25
48
  stopSequence: string | null;
49
+ /**
50
+ * Details about why the request stopped. Present only when the API returns
51
+ * a `refusal` stop reason together with a `stop_details` object (a
52
+ * classifier block or a model refusal).
53
+ *
54
+ * Branch on the finish reason (`content-filter`), not on this object: the
55
+ * API may return a refusal with no details at all, so this field can be
56
+ * absent even on a refusal and should not be relied upon being present.
57
+ */
58
+ stopDetails?: {
59
+ /**
60
+ * The kind of stop detail. `'refusal'` for classifier blocks and model
61
+ * refusals.
62
+ */
63
+ type: string;
64
+ /**
65
+ * The classifier category that triggered the block, e.g. `'cyber'` or
66
+ * `'bio'`. Absent for model refusals and other cases.
67
+ */
68
+ category?: string;
69
+ /**
70
+ * Human-readable explanation of why the request was blocked. May be
71
+ * absent even on a refusal.
72
+ */
73
+ explanation?: string;
74
+ /**
75
+ * The canonical id of a model to retry directly. Populated only when the
76
+ * request included fallbacks and the fallback attempt could not be made
77
+ * (e.g. the fallback model was rate limited or overloaded).
78
+ */
79
+ recommendedModel?: string;
80
+ };
26
81
  /**
27
82
  * Usage breakdown by iteration when compaction is triggered.
28
83
  *
@@ -128,7 +183,7 @@ interface AnthropicMessageMetadata {
128
183
  } | null;
129
184
  }
130
185
 
131
- type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | (string & {});
186
+ type AnthropicModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-fable-5' | (string & {});
132
187
  declare const anthropicLanguageModelOptions: z.ZodObject<{
133
188
  sendReasoning: z.ZodOptional<z.ZodBoolean>;
134
189
  structuredOutputMode: z.ZodOptional<z.ZodEnum<{
@@ -138,6 +193,10 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
138
193
  }>>;
139
194
  thinking: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
140
195
  type: z.ZodLiteral<"adaptive">;
196
+ display: z.ZodOptional<z.ZodEnum<{
197
+ omitted: "omitted";
198
+ summarized: "summarized";
199
+ }>>;
141
200
  }, z.core.$strip>, z.ZodObject<{
142
201
  type: z.ZodLiteral<"enabled">;
143
202
  budgetTokens: z.ZodOptional<z.ZodNumber>;
@@ -149,6 +208,9 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
149
208
  type: z.ZodLiteral<"ephemeral">;
150
209
  ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
151
210
  }, z.core.$strip>>;
211
+ metadata: z.ZodOptional<z.ZodObject<{
212
+ userId: z.ZodOptional<z.ZodString>;
213
+ }, z.core.$strip>>;
152
214
  mcpServers: z.ZodOptional<z.ZodArray<z.ZodObject<{
153
215
  type: z.ZodLiteral<"url">;
154
216
  name: z.ZodString;
@@ -161,23 +223,47 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
161
223
  }, z.core.$strip>>>;
162
224
  container: z.ZodOptional<z.ZodObject<{
163
225
  id: z.ZodOptional<z.ZodString>;
164
- skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
- type: z.ZodUnion<readonly [z.ZodLiteral<"anthropic">, z.ZodLiteral<"custom">]>;
226
+ skills: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
227
+ type: z.ZodLiteral<"anthropic">;
166
228
  skillId: z.ZodString;
167
229
  version: z.ZodOptional<z.ZodString>;
168
- }, z.core.$strip>>>;
230
+ }, z.core.$strip>, z.ZodObject<{
231
+ type: z.ZodLiteral<"custom">;
232
+ providerReference: z.ZodRecord<z.ZodString, z.ZodString>;
233
+ version: z.ZodOptional<z.ZodString>;
234
+ }, z.core.$strip>]>>>;
169
235
  }, z.core.$strip>>;
170
236
  toolStreaming: z.ZodOptional<z.ZodBoolean>;
171
237
  effort: z.ZodOptional<z.ZodEnum<{
172
238
  low: "low";
173
239
  medium: "medium";
174
240
  high: "high";
241
+ xhigh: "xhigh";
175
242
  max: "max";
176
243
  }>>;
244
+ taskBudget: z.ZodOptional<z.ZodObject<{
245
+ type: z.ZodLiteral<"tokens">;
246
+ total: z.ZodNumber;
247
+ remaining: z.ZodOptional<z.ZodNumber>;
248
+ }, z.core.$strip>>;
177
249
  speed: z.ZodOptional<z.ZodEnum<{
178
250
  fast: "fast";
179
251
  standard: "standard";
180
252
  }>>;
253
+ inferenceGeo: z.ZodOptional<z.ZodEnum<{
254
+ us: "us";
255
+ global: "global";
256
+ }>>;
257
+ fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
258
+ model: z.ZodString;
259
+ max_tokens: z.ZodOptional<z.ZodNumber>;
260
+ thinking: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
261
+ output_config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
262
+ speed: z.ZodOptional<z.ZodEnum<{
263
+ fast: "fast";
264
+ standard: "standard";
265
+ }>>;
266
+ }, z.core.$strip>>>;
181
267
  anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
182
268
  contextManagement: z.ZodOptional<z.ZodObject<{
183
269
  edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -224,27 +310,133 @@ interface AnthropicToolOptions {
224
310
  eagerInputStreaming?: boolean;
225
311
  }
226
312
 
313
+ type Bash20241022Input = {
314
+ /**
315
+ * The bash command to run. Required unless the tool is being restarted.
316
+ */
317
+ command: string;
318
+ /**
319
+ * Specifying true will restart this tool. Otherwise, leave this unspecified.
320
+ */
321
+ restart?: boolean;
322
+ };
323
+ type Bash20241022Options<OUTPUT> = {
324
+ execute?: ToolExecuteFunction<Bash20241022Input, OUTPUT, {}>;
325
+ needsApproval?: Tool<Bash20241022Input, OUTPUT, {}>['needsApproval'];
326
+ toModelOutput?: Tool<Bash20241022Input, OUTPUT, {}>['toModelOutput'];
327
+ onInputStart?: Tool<Bash20241022Input, OUTPUT, {}>['onInputStart'];
328
+ onInputDelta?: Tool<Bash20241022Input, OUTPUT, {}>['onInputDelta'];
329
+ onInputAvailable?: Tool<Bash20241022Input, OUTPUT, {}>['onInputAvailable'];
330
+ };
331
+ type Bash20241022DefaultOutput = Awaited<ReturnType<Experimental_SandboxSession['run']>>;
332
+ declare function bash_20241022(options?: Omit<Bash20241022Options<Bash20241022DefaultOutput>, 'execute'> & {
333
+ execute?: undefined;
334
+ }): ProviderDefinedTool<Bash20241022Input, Bash20241022DefaultOutput, {}>;
335
+ declare function bash_20241022<OUTPUT = never>(options: Omit<Bash20241022Options<OUTPUT>, 'execute'> & {
336
+ execute: null;
337
+ }): ProviderDefinedTool<Bash20241022Input, OUTPUT, {}>;
338
+ declare function bash_20241022<OUTPUT>(options: Omit<Bash20241022Options<OUTPUT>, 'execute'> & {
339
+ execute: Bash20241022Options<OUTPUT>['execute'];
340
+ }): ProviderDefinedTool<Bash20241022Input, OUTPUT, {}>;
341
+
342
+ type Bash20250124Input = {
343
+ /**
344
+ * The bash command to run. Required unless the tool is being restarted.
345
+ */
346
+ command: string;
347
+ /**
348
+ * Specifying true will restart this tool. Otherwise, leave this unspecified.
349
+ */
350
+ restart?: boolean;
351
+ };
352
+ type Bash20250124Options<OUTPUT> = {
353
+ execute?: ToolExecuteFunction<Bash20250124Input, OUTPUT, {}>;
354
+ needsApproval?: Tool<Bash20250124Input, OUTPUT, {}>['needsApproval'];
355
+ toModelOutput?: Tool<Bash20250124Input, OUTPUT, {}>['toModelOutput'];
356
+ onInputStart?: Tool<Bash20250124Input, OUTPUT, {}>['onInputStart'];
357
+ onInputDelta?: Tool<Bash20250124Input, OUTPUT, {}>['onInputDelta'];
358
+ onInputAvailable?: Tool<Bash20250124Input, OUTPUT, {}>['onInputAvailable'];
359
+ };
360
+ type Bash20250124DefaultOutput = Awaited<ReturnType<Experimental_SandboxSession['run']>>;
361
+ declare function bash_20250124(options?: Omit<Bash20250124Options<Bash20250124DefaultOutput>, 'execute'> & {
362
+ execute?: undefined;
363
+ }): ProviderDefinedTool<Bash20250124Input, Bash20250124DefaultOutput, {}>;
364
+ declare function bash_20250124<OUTPUT = never>(options: Omit<Bash20250124Options<OUTPUT>, 'execute'> & {
365
+ execute: null;
366
+ }): ProviderDefinedTool<Bash20250124Input, OUTPUT, {}>;
367
+ declare function bash_20250124<OUTPUT>(options: Omit<Bash20250124Options<OUTPUT>, 'execute'> & {
368
+ execute: Bash20250124Options<OUTPUT>['execute'];
369
+ }): ProviderDefinedTool<Bash20250124Input, OUTPUT, {}>;
370
+
227
371
  declare const anthropicTools: {
372
+ /**
373
+ * Pairs a faster executor model with a higher-intelligence advisor model
374
+ * that provides strategic guidance mid-generation.
375
+ *
376
+ * The advisor lets a faster, lower-cost executor model consult a
377
+ * higher-intelligence advisor model server-side. The advisor reads the
378
+ * executor's full transcript and produces a plan or course correction;
379
+ * the executor continues with the task, informed by the advice. All of
380
+ * this happens inside a single `/v1/messages` request.
381
+ *
382
+ * Beta header `advisor-tool-2026-03-01` is added automatically when this
383
+ * tool is included.
384
+ *
385
+ * Multi-turn conversations: pass the full assistant content (including
386
+ * `advisor_tool_result` blocks) back to the API on subsequent turns. If
387
+ * you omit the advisor tool from `tools` on a follow-up turn while the
388
+ * message history still contains `advisor_tool_result` blocks, the API
389
+ * returns a `400 invalid_request_error`.
390
+ *
391
+ * Supported executor models: Claude Haiku 4.5, Sonnet 4.6, Opus 4.6,
392
+ * Opus 4.7. The advisor must be at least as capable as the executor.
393
+ *
394
+ * @param model - The advisor model ID (required), e.g. `"claude-opus-4-8"`.
395
+ * @param maxUses - Maximum advisor calls per request (per-request cap).
396
+ * @param caching - Enables prompt caching for the advisor's transcript
397
+ * across calls within a conversation. Worthwhile from ~3 advisor calls
398
+ * per conversation.
399
+ */
400
+ advisor_20260301: (args: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
401
+ type: "advisor_result";
402
+ text: string;
403
+ } | {
404
+ type: "advisor_redacted_result";
405
+ encryptedContent: string;
406
+ } | {
407
+ type: "advisor_tool_result_error";
408
+ errorCode: string;
409
+ }, {
410
+ model: string;
411
+ maxUses?: number;
412
+ caching?: {
413
+ type: "ephemeral";
414
+ ttl: "5m" | "1h";
415
+ };
416
+ }, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{}, {
417
+ type: "advisor_result";
418
+ text: string;
419
+ } | {
420
+ type: "advisor_redacted_result";
421
+ encryptedContent: string;
422
+ } | {
423
+ type: "advisor_tool_result_error";
424
+ errorCode: string;
425
+ }, {}>;
228
426
  /**
229
427
  * The bash tool enables Claude to execute shell commands in a persistent bash session,
230
428
  * allowing system operations, script execution, and command-line automation.
231
429
  *
232
430
  * Image results are supported.
233
431
  */
234
- bash_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
235
- command: string;
236
- restart?: boolean;
237
- }, {}>;
432
+ bash_20241022: typeof bash_20241022;
238
433
  /**
239
434
  * The bash tool enables Claude to execute shell commands in a persistent bash session,
240
435
  * allowing system operations, script execution, and command-line automation.
241
436
  *
242
437
  * Image results are supported.
243
438
  */
244
- bash_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
245
- command: string;
246
- restart?: boolean;
247
- }, {}>;
439
+ bash_20250124: typeof bash_20250124;
248
440
  /**
249
441
  * Claude can analyze data, create visualizations, perform complex calculations,
250
442
  * run system commands, create and edit files, and process uploaded files directly within
@@ -253,7 +445,7 @@ declare const anthropicTools: {
253
445
  * The code execution tool allows Claude to run Bash commands and manipulate files,
254
446
  * including writing code, in a secure, sandboxed environment.
255
447
  */
256
- codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
448
+ codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
257
449
  code: string;
258
450
  }, {
259
451
  type: "code_execution_result";
@@ -264,7 +456,7 @@ declare const anthropicTools: {
264
456
  type: "code_execution_output";
265
457
  file_id: string;
266
458
  }>;
267
- }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
459
+ }, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
268
460
  code: string;
269
461
  }, {
270
462
  type: "code_execution_result";
@@ -275,7 +467,7 @@ declare const anthropicTools: {
275
467
  type: "code_execution_output";
276
468
  file_id: string;
277
469
  }>;
278
- }>;
470
+ }, {}>;
279
471
  /**
280
472
  * Claude can analyze data, create visualizations, perform complex calculations,
281
473
  * run system commands, create and edit files, and process uploaded files directly within
@@ -286,7 +478,7 @@ declare const anthropicTools: {
286
478
  *
287
479
  * This is the latest version with enhanced Bash support and file operations.
288
480
  */
289
- codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
481
+ codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
290
482
  type: "programmatic-tool-call";
291
483
  code: string;
292
484
  } | {
@@ -348,7 +540,7 @@ declare const anthropicTools: {
348
540
  new_start: number | null;
349
541
  old_lines: number | null;
350
542
  old_start: number | null;
351
- }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
543
+ }, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
352
544
  type: "programmatic-tool-call";
353
545
  code: string;
354
546
  } | {
@@ -410,7 +602,7 @@ declare const anthropicTools: {
410
602
  new_start: number | null;
411
603
  old_lines: number | null;
412
604
  old_start: number | null;
413
- }>;
605
+ }, {}>;
414
606
  /**
415
607
  * Claude can analyze data, create visualizations, perform complex calculations,
416
608
  * run system commands, create and edit files, and process uploaded files directly within
@@ -423,7 +615,7 @@ declare const anthropicTools: {
423
615
  *
424
616
  * Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
425
617
  */
426
- codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
618
+ codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
427
619
  type: "programmatic-tool-call";
428
620
  code: string;
429
621
  } | {
@@ -494,7 +686,7 @@ declare const anthropicTools: {
494
686
  new_start: number | null;
495
687
  old_lines: number | null;
496
688
  old_start: number | null;
497
- }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
689
+ }, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
498
690
  type: "programmatic-tool-call";
499
691
  code: string;
500
692
  } | {
@@ -565,7 +757,7 @@ declare const anthropicTools: {
565
757
  new_start: number | null;
566
758
  old_lines: number | null;
567
759
  old_start: number | null;
568
- }>;
760
+ }, {}>;
569
761
  /**
570
762
  * Claude can interact with computer environments through the computer use tool, which
571
763
  * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
@@ -576,7 +768,7 @@ declare const anthropicTools: {
576
768
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
577
769
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
578
770
  */
579
- computer_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
771
+ computer_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
580
772
  action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
581
773
  coordinate?: number[];
582
774
  text?: string;
@@ -584,7 +776,7 @@ declare const anthropicTools: {
584
776
  displayWidthPx: number;
585
777
  displayHeightPx: number;
586
778
  displayNumber?: number;
587
- }>;
779
+ }, {}>;
588
780
  /**
589
781
  * Claude can interact with computer environments through the computer use tool, which
590
782
  * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
@@ -595,7 +787,7 @@ declare const anthropicTools: {
595
787
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
596
788
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
597
789
  */
598
- computer_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
790
+ computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
599
791
  action: "key" | "hold_key" | "type" | "cursor_position" | "mouse_move" | "left_mouse_down" | "left_mouse_up" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "triple_click" | "scroll" | "wait" | "screenshot";
600
792
  coordinate?: [number, number];
601
793
  duration?: number;
@@ -607,7 +799,7 @@ declare const anthropicTools: {
607
799
  displayWidthPx: number;
608
800
  displayHeightPx: number;
609
801
  displayNumber?: number;
610
- }>;
802
+ }, {}>;
611
803
  /**
612
804
  * Claude can interact with computer environments through the computer use tool, which
613
805
  * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
@@ -623,7 +815,7 @@ declare const anthropicTools: {
623
815
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
624
816
  * @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
625
817
  */
626
- computer_20251124: _ai_sdk_provider_utils.ProviderToolFactory<{
818
+ computer_20251124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
627
819
  action: "key" | "hold_key" | "type" | "cursor_position" | "mouse_move" | "left_mouse_down" | "left_mouse_up" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "triple_click" | "scroll" | "wait" | "screenshot" | "zoom";
628
820
  coordinate?: [number, number];
629
821
  duration?: number;
@@ -637,7 +829,7 @@ declare const anthropicTools: {
637
829
  displayHeightPx: number;
638
830
  displayNumber?: number;
639
831
  enableZoom?: boolean;
640
- }>;
832
+ }, {}>;
641
833
  /**
642
834
  * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
643
835
  * Claude can create, read, update, and delete files that persist between sessions,
@@ -646,7 +838,7 @@ declare const anthropicTools: {
646
838
  *
647
839
  * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
648
840
  */
649
- memory_20250818: _ai_sdk_provider_utils.ProviderToolFactory<{
841
+ memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
650
842
  command: "view";
651
843
  path: string;
652
844
  view_range?: [number, number];
@@ -671,7 +863,7 @@ declare const anthropicTools: {
671
863
  command: "rename";
672
864
  old_path: string;
673
865
  new_path: string;
674
- }, {}>;
866
+ }, {}, {}>;
675
867
  /**
676
868
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
677
869
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
@@ -679,7 +871,7 @@ declare const anthropicTools: {
679
871
  *
680
872
  * Supported models: Claude Sonnet 3.5
681
873
  */
682
- textEditor_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
874
+ textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
683
875
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
684
876
  path: string;
685
877
  file_text?: string;
@@ -688,7 +880,7 @@ declare const anthropicTools: {
688
880
  insert_text?: string;
689
881
  old_str?: string;
690
882
  view_range?: number[];
691
- }, {}>;
883
+ }, {}, {}>;
692
884
  /**
693
885
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
694
886
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
@@ -696,7 +888,7 @@ declare const anthropicTools: {
696
888
  *
697
889
  * Supported models: Claude Sonnet 3.7
698
890
  */
699
- textEditor_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
891
+ textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
700
892
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
701
893
  path: string;
702
894
  file_text?: string;
@@ -705,7 +897,7 @@ declare const anthropicTools: {
705
897
  insert_text?: string;
706
898
  old_str?: string;
707
899
  view_range?: number[];
708
- }, {}>;
900
+ }, {}, {}>;
709
901
  /**
710
902
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
711
903
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
@@ -715,7 +907,7 @@ declare const anthropicTools: {
715
907
  *
716
908
  * @deprecated Use textEditor_20250728 instead
717
909
  */
718
- textEditor_20250429: _ai_sdk_provider_utils.ProviderToolFactory<{
910
+ textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
719
911
  command: "view" | "create" | "str_replace" | "insert";
720
912
  path: string;
721
913
  file_text?: string;
@@ -724,7 +916,7 @@ declare const anthropicTools: {
724
916
  insert_text?: string;
725
917
  old_str?: string;
726
918
  view_range?: number[];
727
- }, {}>;
919
+ }, {}, {}>;
728
920
  /**
729
921
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
730
922
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
@@ -736,7 +928,7 @@ declare const anthropicTools: {
736
928
  *
737
929
  * @param maxCharacters - Optional maximum number of characters to view in the file
738
930
  */
739
- textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactory<{
931
+ textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactory<{
740
932
  command: "view" | "create" | "str_replace" | "insert";
741
933
  path: string;
742
934
  file_text?: string;
@@ -747,7 +939,7 @@ declare const anthropicTools: {
747
939
  view_range?: number[];
748
940
  }, {
749
941
  maxCharacters?: number;
750
- }>>[0]) => _ai_sdk_provider_utils.Tool<{
942
+ }, {}>>[0]) => _ai_sdk_provider_utils.ProviderDefinedTool<{
751
943
  command: "view" | "create" | "str_replace" | "insert";
752
944
  path: string;
753
945
  file_text?: string;
@@ -756,7 +948,7 @@ declare const anthropicTools: {
756
948
  insert_text?: string;
757
949
  old_str?: string;
758
950
  view_range?: number[];
759
- }, unknown>;
951
+ }, unknown, {}>;
760
952
  /**
761
953
  * Creates a web fetch tool that gives Claude direct access to real-time web content.
762
954
  *
@@ -766,7 +958,7 @@ declare const anthropicTools: {
766
958
  * @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
767
959
  * @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
768
960
  */
769
- webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
961
+ webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
770
962
  url: string;
771
963
  }, {
772
964
  type: "web_fetch_result";
@@ -796,7 +988,7 @@ declare const anthropicTools: {
796
988
  enabled: boolean;
797
989
  };
798
990
  maxContentTokens?: number;
799
- }>>[0]) => _ai_sdk_provider_utils.Tool<{
991
+ }, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
800
992
  url: string;
801
993
  }, {
802
994
  type: "web_fetch_result";
@@ -818,7 +1010,7 @@ declare const anthropicTools: {
818
1010
  };
819
1011
  };
820
1012
  retrievedAt: string | null;
821
- }>;
1013
+ }, {}>;
822
1014
  /**
823
1015
  * Creates a web fetch tool that gives Claude direct access to real-time web content.
824
1016
  *
@@ -828,7 +1020,7 @@ declare const anthropicTools: {
828
1020
  * @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
829
1021
  * @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
830
1022
  */
831
- webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
1023
+ webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
832
1024
  url: string;
833
1025
  }, {
834
1026
  type: "web_fetch_result";
@@ -858,7 +1050,7 @@ declare const anthropicTools: {
858
1050
  enabled: boolean;
859
1051
  };
860
1052
  maxContentTokens?: number;
861
- }>>[0]) => _ai_sdk_provider_utils.Tool<{
1053
+ }, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
862
1054
  url: string;
863
1055
  }, {
864
1056
  type: "web_fetch_result";
@@ -880,7 +1072,7 @@ declare const anthropicTools: {
880
1072
  };
881
1073
  };
882
1074
  retrievedAt: string | null;
883
- }>;
1075
+ }, {}>;
884
1076
  /**
885
1077
  * Creates a web search tool that gives Claude direct access to real-time web content.
886
1078
  *
@@ -889,7 +1081,7 @@ declare const anthropicTools: {
889
1081
  * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
890
1082
  * @param userLocation - Optional user location information to provide geographically relevant search results.
891
1083
  */
892
- webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
1084
+ webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
893
1085
  query: string;
894
1086
  }, {
895
1087
  type: "web_search_result";
@@ -908,7 +1100,7 @@ declare const anthropicTools: {
908
1100
  country?: string;
909
1101
  timezone?: string;
910
1102
  };
911
- }>>[0]) => _ai_sdk_provider_utils.Tool<{
1103
+ }, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
912
1104
  query: string;
913
1105
  }, {
914
1106
  type: "web_search_result";
@@ -916,7 +1108,7 @@ declare const anthropicTools: {
916
1108
  title: string | null;
917
1109
  pageAge: string | null;
918
1110
  encryptedContent: string;
919
- }[]>;
1111
+ }[], {}>;
920
1112
  /**
921
1113
  * Creates a web search tool that gives Claude direct access to real-time web content.
922
1114
  *
@@ -925,7 +1117,7 @@ declare const anthropicTools: {
925
1117
  * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
926
1118
  * @param userLocation - Optional user location information to provide geographically relevant search results.
927
1119
  */
928
- webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
1120
+ webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
929
1121
  query: string;
930
1122
  }, {
931
1123
  type: "web_search_result";
@@ -944,7 +1136,7 @@ declare const anthropicTools: {
944
1136
  country?: string;
945
1137
  timezone?: string;
946
1138
  };
947
- }>>[0]) => _ai_sdk_provider_utils.Tool<{
1139
+ }, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
948
1140
  query: string;
949
1141
  }, {
950
1142
  type: "web_search_result";
@@ -952,7 +1144,7 @@ declare const anthropicTools: {
952
1144
  title: string | null;
953
1145
  pageAge: string | null;
954
1146
  encryptedContent: string;
955
- }[]>;
1147
+ }[], {}>;
956
1148
  /**
957
1149
  * Creates a tool search tool that uses regex patterns to find tools.
958
1150
  *
@@ -966,19 +1158,19 @@ declare const anthropicTools: {
966
1158
  *
967
1159
  * Supported models: Claude Opus 4.5, Claude Sonnet 4.5
968
1160
  */
969
- toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
1161
+ toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
970
1162
  pattern: string;
971
1163
  limit?: number;
972
1164
  }, {
973
1165
  type: "tool_reference";
974
1166
  toolName: string;
975
- }[], {}>>[0]) => _ai_sdk_provider_utils.Tool<{
1167
+ }[], {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
976
1168
  pattern: string;
977
1169
  limit?: number;
978
1170
  }, {
979
1171
  type: "tool_reference";
980
1172
  toolName: string;
981
- }[]>;
1173
+ }[], {}>;
982
1174
  /**
983
1175
  * Creates a tool search tool that uses BM25 (natural language) to find tools.
984
1176
  *
@@ -992,36 +1184,41 @@ declare const anthropicTools: {
992
1184
  *
993
1185
  * Supported models: Claude Opus 4.5, Claude Sonnet 4.5
994
1186
  */
995
- toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
1187
+ toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
996
1188
  query: string;
997
1189
  limit?: number;
998
1190
  }, {
999
1191
  type: "tool_reference";
1000
1192
  toolName: string;
1001
- }[], {}>>[0]) => _ai_sdk_provider_utils.Tool<{
1193
+ }[], {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
1002
1194
  query: string;
1003
1195
  limit?: number;
1004
1196
  }, {
1005
1197
  type: "tool_reference";
1006
1198
  toolName: string;
1007
- }[]>;
1199
+ }[], {}>;
1008
1200
  };
1009
1201
 
1010
1202
  interface AnthropicProvider extends ProviderV4 {
1011
1203
  /**
1012
1204
  * Creates a model for text generation.
1013
1205
  */
1014
- (modelId: AnthropicMessagesModelId): LanguageModelV4;
1206
+ (modelId: AnthropicModelId): LanguageModelV4;
1015
1207
  /**
1016
1208
  * Creates a model for text generation.
1017
1209
  */
1018
- languageModel(modelId: AnthropicMessagesModelId): LanguageModelV4;
1019
- chat(modelId: AnthropicMessagesModelId): LanguageModelV4;
1020
- messages(modelId: AnthropicMessagesModelId): LanguageModelV4;
1210
+ languageModel(modelId: AnthropicModelId): LanguageModelV4;
1211
+ chat(modelId: AnthropicModelId): LanguageModelV4;
1212
+ messages(modelId: AnthropicModelId): LanguageModelV4;
1021
1213
  /**
1022
1214
  * @deprecated Use `embeddingModel` instead.
1023
1215
  */
1024
1216
  textEmbeddingModel(modelId: string): never;
1217
+ files(): FilesV4;
1218
+ /**
1219
+ * Returns a SkillsV4 interface for uploading skills to Anthropic.
1220
+ */
1221
+ skills(): SkillsV4;
1025
1222
  /**
1026
1223
  * Anthropic-specific computer use tool.
1027
1224
  */