@ai-sdk/anthropic 2.0.27 → 2.0.29

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
@@ -28,14 +28,14 @@ module.exports = __toCommonJS(src_exports);
28
28
 
29
29
  // src/anthropic-provider.ts
30
30
  var import_provider4 = require("@ai-sdk/provider");
31
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
31
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/version.ts
34
- var VERSION = true ? "2.0.27" : "0.0.0-test";
34
+ var VERSION = true ? "2.0.29" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
38
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
38
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
39
39
 
40
40
  // src/anthropic-error.ts
41
41
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -163,6 +163,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
163
163
  })
164
164
  ])
165
165
  }),
166
+ // code execution results for code_execution_20250522 tool:
166
167
  import_v42.z.object({
167
168
  type: import_v42.z.literal("code_execution_tool_result"),
168
169
  tool_use_id: import_v42.z.string(),
@@ -178,6 +179,62 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
178
179
  error_code: import_v42.z.string()
179
180
  })
180
181
  ])
182
+ }),
183
+ // bash code execution results for code_execution_20250825 tool:
184
+ import_v42.z.object({
185
+ type: import_v42.z.literal("bash_code_execution_tool_result"),
186
+ tool_use_id: import_v42.z.string(),
187
+ content: import_v42.z.discriminatedUnion("type", [
188
+ import_v42.z.object({
189
+ type: import_v42.z.literal("bash_code_execution_result"),
190
+ content: import_v42.z.array(
191
+ import_v42.z.object({
192
+ type: import_v42.z.literal("bash_code_execution_output"),
193
+ file_id: import_v42.z.string()
194
+ })
195
+ ),
196
+ stdout: import_v42.z.string(),
197
+ stderr: import_v42.z.string(),
198
+ return_code: import_v42.z.number()
199
+ }),
200
+ import_v42.z.object({
201
+ type: import_v42.z.literal("bash_code_execution_tool_result_error"),
202
+ error_code: import_v42.z.string()
203
+ })
204
+ ])
205
+ }),
206
+ // text editor code execution results for code_execution_20250825 tool:
207
+ import_v42.z.object({
208
+ type: import_v42.z.literal("text_editor_code_execution_tool_result"),
209
+ tool_use_id: import_v42.z.string(),
210
+ content: import_v42.z.discriminatedUnion("type", [
211
+ import_v42.z.object({
212
+ type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
213
+ error_code: import_v42.z.string()
214
+ }),
215
+ import_v42.z.object({
216
+ type: import_v42.z.literal("text_editor_code_execution_view_result"),
217
+ content: import_v42.z.string(),
218
+ file_type: import_v42.z.string(),
219
+ num_lines: import_v42.z.number().nullable(),
220
+ start_line: import_v42.z.number().nullable(),
221
+ total_lines: import_v42.z.number().nullable()
222
+ }),
223
+ import_v42.z.object({
224
+ type: import_v42.z.literal("text_editor_code_execution_create_result"),
225
+ is_file_update: import_v42.z.boolean()
226
+ }),
227
+ import_v42.z.object({
228
+ type: import_v42.z.literal(
229
+ "text_editor_code_execution_str_replace_result"
230
+ ),
231
+ lines: import_v42.z.array(import_v42.z.string()).nullable(),
232
+ new_lines: import_v42.z.number().nullable(),
233
+ new_start: import_v42.z.number().nullable(),
234
+ old_lines: import_v42.z.number().nullable(),
235
+ old_start: import_v42.z.number().nullable()
236
+ })
237
+ ])
181
238
  })
182
239
  ])
183
240
  ),
@@ -278,6 +335,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
278
335
  })
279
336
  ])
280
337
  }),
338
+ // code execution results for code_execution_20250522 tool:
281
339
  import_v42.z.object({
282
340
  type: import_v42.z.literal("code_execution_tool_result"),
283
341
  tool_use_id: import_v42.z.string(),
@@ -293,6 +351,62 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
293
351
  error_code: import_v42.z.string()
294
352
  })
295
353
  ])
354
+ }),
355
+ // bash code execution results for code_execution_20250825 tool:
356
+ import_v42.z.object({
357
+ type: import_v42.z.literal("bash_code_execution_tool_result"),
358
+ tool_use_id: import_v42.z.string(),
359
+ content: import_v42.z.discriminatedUnion("type", [
360
+ import_v42.z.object({
361
+ type: import_v42.z.literal("bash_code_execution_result"),
362
+ content: import_v42.z.array(
363
+ import_v42.z.object({
364
+ type: import_v42.z.literal("bash_code_execution_output"),
365
+ file_id: import_v42.z.string()
366
+ })
367
+ ),
368
+ stdout: import_v42.z.string(),
369
+ stderr: import_v42.z.string(),
370
+ return_code: import_v42.z.number()
371
+ }),
372
+ import_v42.z.object({
373
+ type: import_v42.z.literal("bash_code_execution_tool_result_error"),
374
+ error_code: import_v42.z.string()
375
+ })
376
+ ])
377
+ }),
378
+ // text editor code execution results for code_execution_20250825 tool:
379
+ import_v42.z.object({
380
+ type: import_v42.z.literal("text_editor_code_execution_tool_result"),
381
+ tool_use_id: import_v42.z.string(),
382
+ content: import_v42.z.discriminatedUnion("type", [
383
+ import_v42.z.object({
384
+ type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
385
+ error_code: import_v42.z.string()
386
+ }),
387
+ import_v42.z.object({
388
+ type: import_v42.z.literal("text_editor_code_execution_view_result"),
389
+ content: import_v42.z.string(),
390
+ file_type: import_v42.z.string(),
391
+ num_lines: import_v42.z.number().nullable(),
392
+ start_line: import_v42.z.number().nullable(),
393
+ total_lines: import_v42.z.number().nullable()
394
+ }),
395
+ import_v42.z.object({
396
+ type: import_v42.z.literal("text_editor_code_execution_create_result"),
397
+ is_file_update: import_v42.z.boolean()
398
+ }),
399
+ import_v42.z.object({
400
+ type: import_v42.z.literal(
401
+ "text_editor_code_execution_str_replace_result"
402
+ ),
403
+ lines: import_v42.z.array(import_v42.z.string()).nullable(),
404
+ new_lines: import_v42.z.number().nullable(),
405
+ new_start: import_v42.z.number().nullable(),
406
+ old_lines: import_v42.z.number().nullable(),
407
+ old_start: import_v42.z.number().nullable()
408
+ })
409
+ ])
296
410
  })
297
411
  ])
298
412
  }),
@@ -618,6 +732,14 @@ async function prepareTools({
618
732
  });
619
733
  break;
620
734
  }
735
+ case "anthropic.code_execution_20250825": {
736
+ betas.add("code-execution-2025-08-25");
737
+ anthropicTools2.push({
738
+ type: "code_execution_20250825",
739
+ name: "code_execution"
740
+ });
741
+ break;
742
+ }
621
743
  case "anthropic.computer_20250124": {
622
744
  betas.add("computer-use-2025-01-24");
623
745
  anthropicTools2.push({
@@ -692,6 +814,14 @@ async function prepareTools({
692
814
  });
693
815
  break;
694
816
  }
817
+ case "anthropic.memory_20250818": {
818
+ betas.add("context-management-2025-06-27");
819
+ anthropicTools2.push({
820
+ name: "memory",
821
+ type: "memory_20250818"
822
+ });
823
+ break;
824
+ }
695
825
  case "anthropic.web_fetch_20250910": {
696
826
  betas.add("web-fetch-2025-09-10");
697
827
  const args = await (0, import_provider_utils7.validateTypes)({
@@ -791,7 +921,7 @@ async function prepareTools({
791
921
 
792
922
  // src/convert-to-anthropic-messages-prompt.ts
793
923
  var import_provider2 = require("@ai-sdk/provider");
794
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
924
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
795
925
 
796
926
  // src/tool/code-execution_20250522.ts
797
927
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
@@ -823,6 +953,95 @@ var codeExecution_20250522 = (args = {}) => {
823
953
  return factory4(args);
824
954
  };
825
955
 
956
+ // src/tool/code-execution_20250825.ts
957
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
958
+ var import_v48 = require("zod/v4");
959
+ var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
960
+ () => (0, import_provider_utils9.zodSchema)(
961
+ import_v48.z.discriminatedUnion("type", [
962
+ import_v48.z.object({
963
+ type: import_v48.z.literal("bash_code_execution_result"),
964
+ content: import_v48.z.array(
965
+ import_v48.z.object({
966
+ type: import_v48.z.literal("bash_code_execution_output"),
967
+ file_id: import_v48.z.string()
968
+ })
969
+ ),
970
+ stdout: import_v48.z.string(),
971
+ stderr: import_v48.z.string(),
972
+ return_code: import_v48.z.number()
973
+ }),
974
+ import_v48.z.object({
975
+ type: import_v48.z.literal("bash_code_execution_tool_result_error"),
976
+ error_code: import_v48.z.string()
977
+ }),
978
+ import_v48.z.object({
979
+ type: import_v48.z.literal("text_editor_code_execution_tool_result_error"),
980
+ error_code: import_v48.z.string()
981
+ }),
982
+ import_v48.z.object({
983
+ type: import_v48.z.literal("text_editor_code_execution_view_result"),
984
+ content: import_v48.z.string(),
985
+ file_type: import_v48.z.string(),
986
+ num_lines: import_v48.z.number().nullable(),
987
+ start_line: import_v48.z.number().nullable(),
988
+ total_lines: import_v48.z.number().nullable()
989
+ }),
990
+ import_v48.z.object({
991
+ type: import_v48.z.literal("text_editor_code_execution_create_result"),
992
+ is_file_update: import_v48.z.boolean()
993
+ }),
994
+ import_v48.z.object({
995
+ type: import_v48.z.literal("text_editor_code_execution_str_replace_result"),
996
+ lines: import_v48.z.array(import_v48.z.string()).nullable(),
997
+ new_lines: import_v48.z.number().nullable(),
998
+ new_start: import_v48.z.number().nullable(),
999
+ old_lines: import_v48.z.number().nullable(),
1000
+ old_start: import_v48.z.number().nullable()
1001
+ })
1002
+ ])
1003
+ )
1004
+ );
1005
+ var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
1006
+ () => (0, import_provider_utils9.zodSchema)(
1007
+ import_v48.z.discriminatedUnion("type", [
1008
+ import_v48.z.object({
1009
+ type: import_v48.z.literal("bash_code_execution"),
1010
+ command: import_v48.z.string()
1011
+ }),
1012
+ import_v48.z.discriminatedUnion("command", [
1013
+ import_v48.z.object({
1014
+ type: import_v48.z.literal("text_editor_code_execution"),
1015
+ command: import_v48.z.literal("view"),
1016
+ path: import_v48.z.string()
1017
+ }),
1018
+ import_v48.z.object({
1019
+ type: import_v48.z.literal("text_editor_code_execution"),
1020
+ command: import_v48.z.literal("create"),
1021
+ path: import_v48.z.string(),
1022
+ file_text: import_v48.z.string().nullish()
1023
+ }),
1024
+ import_v48.z.object({
1025
+ type: import_v48.z.literal("text_editor_code_execution"),
1026
+ command: import_v48.z.literal("str_replace"),
1027
+ path: import_v48.z.string(),
1028
+ old_str: import_v48.z.string(),
1029
+ new_str: import_v48.z.string()
1030
+ })
1031
+ ])
1032
+ ])
1033
+ )
1034
+ );
1035
+ var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
1036
+ id: "anthropic.code_execution_20250825",
1037
+ name: "code_execution",
1038
+ inputSchema: codeExecution_20250825InputSchema,
1039
+ outputSchema: codeExecution_20250825OutputSchema
1040
+ });
1041
+ var codeExecution_20250825 = (args = {}) => {
1042
+ return factory5(args);
1043
+ };
1044
+
826
1045
  // src/convert-to-anthropic-messages-prompt.ts
827
1046
  function convertToString(data) {
828
1047
  if (typeof data === "string") {
@@ -852,7 +1071,7 @@ async function convertToAnthropicMessagesPrompt({
852
1071
  const messages = [];
853
1072
  async function shouldEnableCitations(providerMetadata) {
854
1073
  var _a2, _b2;
855
- const anthropicOptions = await (0, import_provider_utils9.parseProviderOptions)({
1074
+ const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
856
1075
  provider: "anthropic",
857
1076
  providerOptions: providerMetadata,
858
1077
  schema: anthropicFilePartProviderOptions
@@ -860,7 +1079,7 @@ async function convertToAnthropicMessagesPrompt({
860
1079
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
861
1080
  }
862
1081
  async function getDocumentMetadata(providerMetadata) {
863
- const anthropicOptions = await (0, import_provider_utils9.parseProviderOptions)({
1082
+ const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
864
1083
  provider: "anthropic",
865
1084
  providerOptions: providerMetadata,
866
1085
  schema: anthropicFilePartProviderOptions
@@ -917,7 +1136,7 @@ async function convertToAnthropicMessagesPrompt({
917
1136
  } : {
918
1137
  type: "base64",
919
1138
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
920
- data: (0, import_provider_utils9.convertToBase64)(part.data)
1139
+ data: (0, import_provider_utils10.convertToBase64)(part.data)
921
1140
  },
922
1141
  cache_control: cacheControl
923
1142
  });
@@ -937,7 +1156,7 @@ async function convertToAnthropicMessagesPrompt({
937
1156
  } : {
938
1157
  type: "base64",
939
1158
  media_type: "application/pdf",
940
- data: (0, import_provider_utils9.convertToBase64)(part.data)
1159
+ data: (0, import_provider_utils10.convertToBase64)(part.data)
941
1160
  },
942
1161
  title: (_b = metadata.title) != null ? _b : part.filename,
943
1162
  ...metadata.context && { context: metadata.context },
@@ -1084,7 +1303,7 @@ async function convertToAnthropicMessagesPrompt({
1084
1303
  }
1085
1304
  case "reasoning": {
1086
1305
  if (sendReasoning) {
1087
- const reasoningMetadata = await (0, import_provider_utils9.parseProviderOptions)({
1306
+ const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
1088
1307
  provider: "anthropic",
1089
1308
  providerOptions: part.providerOptions,
1090
1309
  schema: anthropicReasoningMetadataSchema
@@ -1125,7 +1344,17 @@ async function convertToAnthropicMessagesPrompt({
1125
1344
  }
1126
1345
  case "tool-call": {
1127
1346
  if (part.providerExecuted) {
1128
- if (part.toolName === "code_execution" || part.toolName === "web_fetch" || part.toolName === "web_search") {
1347
+ if (part.toolName === "code_execution" && part.input != null && typeof part.input === "object" && "type" in part.input && typeof part.input.type === "string" && (part.input.type === "bash_code_execution" || part.input.type === "text_editor_code_execution")) {
1348
+ anthropicContent.push({
1349
+ type: "server_tool_use",
1350
+ id: part.toolCallId,
1351
+ name: part.input.type,
1352
+ // map back to subtool name
1353
+ input: part.input,
1354
+ cache_control: cacheControl
1355
+ });
1356
+ } else if (part.toolName === "code_execution" || // code execution 20250522
1357
+ part.toolName === "web_fetch" || part.toolName === "web_search") {
1129
1358
  anthropicContent.push({
1130
1359
  type: "server_tool_use",
1131
1360
  id: part.toolCallId,
@@ -1160,21 +1389,48 @@ async function convertToAnthropicMessagesPrompt({
1160
1389
  });
1161
1390
  break;
1162
1391
  }
1163
- const codeExecutionOutput = await (0, import_provider_utils9.validateTypes)({
1164
- value: output.value,
1165
- schema: codeExecution_20250522OutputSchema
1166
- });
1167
- anthropicContent.push({
1168
- type: "code_execution_tool_result",
1169
- tool_use_id: part.toolCallId,
1170
- content: {
1171
- type: codeExecutionOutput.type,
1172
- stdout: codeExecutionOutput.stdout,
1173
- stderr: codeExecutionOutput.stderr,
1174
- return_code: codeExecutionOutput.return_code
1175
- },
1176
- cache_control: cacheControl
1177
- });
1392
+ if (output.value == null || typeof output.value !== "object" || !("type" in output.value) || typeof output.value.type !== "string") {
1393
+ warnings.push({
1394
+ type: "other",
1395
+ message: `provider executed tool result output value is not a valid code execution result for tool ${part.toolName}`
1396
+ });
1397
+ break;
1398
+ }
1399
+ if (output.value.type === "code_execution_result") {
1400
+ const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
1401
+ value: output.value,
1402
+ schema: codeExecution_20250522OutputSchema
1403
+ });
1404
+ anthropicContent.push({
1405
+ type: "code_execution_tool_result",
1406
+ tool_use_id: part.toolCallId,
1407
+ content: {
1408
+ type: codeExecutionOutput.type,
1409
+ stdout: codeExecutionOutput.stdout,
1410
+ stderr: codeExecutionOutput.stderr,
1411
+ return_code: codeExecutionOutput.return_code
1412
+ },
1413
+ cache_control: cacheControl
1414
+ });
1415
+ } else {
1416
+ const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
1417
+ value: output.value,
1418
+ schema: codeExecution_20250825OutputSchema
1419
+ });
1420
+ anthropicContent.push(
1421
+ codeExecutionOutput.type === "bash_code_execution_result" || codeExecutionOutput.type === "bash_code_execution_tool_result_error" ? {
1422
+ type: "bash_code_execution_tool_result",
1423
+ tool_use_id: part.toolCallId,
1424
+ cache_control: cacheControl,
1425
+ content: codeExecutionOutput
1426
+ } : {
1427
+ type: "text_editor_code_execution_tool_result",
1428
+ tool_use_id: part.toolCallId,
1429
+ cache_control: cacheControl,
1430
+ content: codeExecutionOutput
1431
+ }
1432
+ );
1433
+ }
1178
1434
  break;
1179
1435
  }
1180
1436
  if (part.toolName === "web_fetch") {
@@ -1186,7 +1442,7 @@ async function convertToAnthropicMessagesPrompt({
1186
1442
  });
1187
1443
  break;
1188
1444
  }
1189
- const webFetchOutput = await (0, import_provider_utils9.validateTypes)({
1445
+ const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
1190
1446
  value: output.value,
1191
1447
  schema: webFetch_20250910OutputSchema
1192
1448
  });
@@ -1221,7 +1477,7 @@ async function convertToAnthropicMessagesPrompt({
1221
1477
  });
1222
1478
  break;
1223
1479
  }
1224
- const webSearchOutput = await (0, import_provider_utils9.validateTypes)({
1480
+ const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
1225
1481
  value: output.value,
1226
1482
  schema: webSearch_20250305OutputSchema
1227
1483
  });
@@ -1366,7 +1622,7 @@ var AnthropicMessagesLanguageModel = class {
1366
1622
  var _a;
1367
1623
  this.modelId = modelId;
1368
1624
  this.config = config;
1369
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils10.generateId;
1625
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
1370
1626
  }
1371
1627
  supportsUrl(url) {
1372
1628
  return url.protocol === "https:";
@@ -1435,7 +1691,7 @@ var AnthropicMessagesLanguageModel = class {
1435
1691
  description: "Respond with a JSON object.",
1436
1692
  inputSchema: responseFormat.schema
1437
1693
  } : void 0;
1438
- const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
1694
+ const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
1439
1695
  provider: "anthropic",
1440
1696
  providerOptions,
1441
1697
  schema: anthropicProviderOptions
@@ -1527,8 +1783,8 @@ var AnthropicMessagesLanguageModel = class {
1527
1783
  betas,
1528
1784
  headers
1529
1785
  }) {
1530
- return (0, import_provider_utils10.combineHeaders)(
1531
- await (0, import_provider_utils10.resolve)(this.config.headers),
1786
+ return (0, import_provider_utils11.combineHeaders)(
1787
+ await (0, import_provider_utils11.resolve)(this.config.headers),
1532
1788
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {},
1533
1789
  headers
1534
1790
  );
@@ -1572,12 +1828,12 @@ var AnthropicMessagesLanguageModel = class {
1572
1828
  responseHeaders,
1573
1829
  value: response,
1574
1830
  rawValue: rawResponse
1575
- } = await (0, import_provider_utils10.postJsonToApi)({
1831
+ } = await (0, import_provider_utils11.postJsonToApi)({
1576
1832
  url: this.buildRequestUrl(false),
1577
1833
  headers: await this.getHeaders({ betas, headers: options.headers }),
1578
1834
  body: this.transformRequestBody(args),
1579
1835
  failedResponseHandler: anthropicFailedResponseHandler,
1580
- successfulResponseHandler: (0, import_provider_utils10.createJsonResponseHandler)(
1836
+ successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
1581
1837
  anthropicMessagesResponseSchema
1582
1838
  ),
1583
1839
  abortSignal: options.abortSignal,
@@ -1644,7 +1900,15 @@ var AnthropicMessagesLanguageModel = class {
1644
1900
  break;
1645
1901
  }
1646
1902
  case "server_tool_use": {
1647
- if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
1903
+ if (part.name === "text_editor_code_execution" || part.name === "bash_code_execution") {
1904
+ content.push({
1905
+ type: "tool-call",
1906
+ toolCallId: part.id,
1907
+ toolName: "code_execution",
1908
+ input: JSON.stringify({ type: part.name, ...part.input }),
1909
+ providerExecuted: true
1910
+ });
1911
+ } else if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
1648
1912
  content.push({
1649
1913
  type: "tool-call",
1650
1914
  toolCallId: part.id,
@@ -1740,6 +2004,7 @@ var AnthropicMessagesLanguageModel = class {
1740
2004
  }
1741
2005
  break;
1742
2006
  }
2007
+ // code execution 20250522:
1743
2008
  case "code_execution_tool_result": {
1744
2009
  if (part.content.type === "code_execution_result") {
1745
2010
  content.push({
@@ -1769,6 +2034,18 @@ var AnthropicMessagesLanguageModel = class {
1769
2034
  }
1770
2035
  break;
1771
2036
  }
2037
+ // code execution 20250825:
2038
+ case "bash_code_execution_tool_result":
2039
+ case "text_editor_code_execution_tool_result": {
2040
+ content.push({
2041
+ type: "tool-result",
2042
+ toolCallId: part.tool_use_id,
2043
+ toolName: "code_execution",
2044
+ result: part.content,
2045
+ providerExecuted: true
2046
+ });
2047
+ break;
2048
+ }
1772
2049
  }
1773
2050
  }
1774
2051
  return {
@@ -1804,12 +2081,12 @@ var AnthropicMessagesLanguageModel = class {
1804
2081
  const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
1805
2082
  const citationDocuments = this.extractCitationDocuments(options.prompt);
1806
2083
  const body = { ...args, stream: true };
1807
- const { responseHeaders, value: response } = await (0, import_provider_utils10.postJsonToApi)({
2084
+ const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
1808
2085
  url: this.buildRequestUrl(true),
1809
2086
  headers: await this.getHeaders({ betas, headers: options.headers }),
1810
2087
  body: this.transformRequestBody(body),
1811
2088
  failedResponseHandler: anthropicFailedResponseHandler,
1812
- successfulResponseHandler: (0, import_provider_utils10.createEventSourceResponseHandler)(
2089
+ successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
1813
2090
  anthropicMessagesChunkSchema
1814
2091
  ),
1815
2092
  abortSignal: options.abortSignal,
@@ -1885,7 +2162,8 @@ var AnthropicMessagesLanguageModel = class {
1885
2162
  type: "tool-call",
1886
2163
  toolCallId: value.content_block.id,
1887
2164
  toolName: value.content_block.name,
1888
- input: ""
2165
+ input: "",
2166
+ firstDelta: true
1889
2167
  };
1890
2168
  controller.enqueue(
1891
2169
  usesJsonResponseTool ? { type: "text-start", id: String(value.index) } : {
@@ -1897,18 +2175,29 @@ var AnthropicMessagesLanguageModel = class {
1897
2175
  return;
1898
2176
  }
1899
2177
  case "server_tool_use": {
1900
- if (value.content_block.name === "web_fetch" || value.content_block.name === "web_search" || value.content_block.name === "code_execution") {
2178
+ if ([
2179
+ "web_fetch",
2180
+ "web_search",
2181
+ // code execution 20250825:
2182
+ "code_execution",
2183
+ // code execution 20250825 text editor:
2184
+ "text_editor_code_execution",
2185
+ // code execution 20250825 bash:
2186
+ "bash_code_execution"
2187
+ ].includes(value.content_block.name)) {
1901
2188
  contentBlocks[value.index] = {
1902
2189
  type: "tool-call",
1903
2190
  toolCallId: value.content_block.id,
1904
2191
  toolName: value.content_block.name,
1905
2192
  input: "",
1906
- providerExecuted: true
2193
+ providerExecuted: true,
2194
+ firstDelta: true
1907
2195
  };
2196
+ const mappedToolName = value.content_block.name === "text_editor_code_execution" || value.content_block.name === "bash_code_execution" ? "code_execution" : value.content_block.name;
1908
2197
  controller.enqueue({
1909
2198
  type: "tool-input-start",
1910
2199
  id: value.content_block.id,
1911
- toolName: value.content_block.name,
2200
+ toolName: mappedToolName,
1912
2201
  providerExecuted: true
1913
2202
  });
1914
2203
  }
@@ -2000,6 +2289,7 @@ var AnthropicMessagesLanguageModel = class {
2000
2289
  }
2001
2290
  return;
2002
2291
  }
2292
+ // code execution 20250522:
2003
2293
  case "code_execution_tool_result": {
2004
2294
  const part = value.content_block;
2005
2295
  if (part.content.type === "code_execution_result") {
@@ -2030,6 +2320,19 @@ var AnthropicMessagesLanguageModel = class {
2030
2320
  }
2031
2321
  return;
2032
2322
  }
2323
+ // code execution 20250825:
2324
+ case "bash_code_execution_tool_result":
2325
+ case "text_editor_code_execution_tool_result": {
2326
+ const part = value.content_block;
2327
+ controller.enqueue({
2328
+ type: "tool-result",
2329
+ toolCallId: part.tool_use_id,
2330
+ toolName: "code_execution",
2331
+ result: part.content,
2332
+ providerExecuted: true
2333
+ });
2334
+ return;
2335
+ }
2033
2336
  default: {
2034
2337
  const _exhaustiveCheck = contentBlockType;
2035
2338
  throw new Error(
@@ -2062,7 +2365,14 @@ var AnthropicMessagesLanguageModel = class {
2062
2365
  type: "tool-input-end",
2063
2366
  id: contentBlock.toolCallId
2064
2367
  });
2065
- controller.enqueue(contentBlock);
2368
+ const toolName = contentBlock.toolName === "text_editor_code_execution" || contentBlock.toolName === "bash_code_execution" ? "code_execution" : contentBlock.toolName;
2369
+ controller.enqueue({
2370
+ type: "tool-call",
2371
+ toolCallId: contentBlock.toolCallId,
2372
+ toolName,
2373
+ input: contentBlock.input,
2374
+ providerExecuted: contentBlock.providerExecuted
2375
+ });
2066
2376
  }
2067
2377
  break;
2068
2378
  }
@@ -2110,7 +2420,10 @@ var AnthropicMessagesLanguageModel = class {
2110
2420
  }
2111
2421
  case "input_json_delta": {
2112
2422
  const contentBlock = contentBlocks[value.index];
2113
- const delta = value.delta.partial_json;
2423
+ let delta = value.delta.partial_json;
2424
+ if (delta.length === 0) {
2425
+ return;
2426
+ }
2114
2427
  if (usesJsonResponseTool) {
2115
2428
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "text") {
2116
2429
  return;
@@ -2124,12 +2437,16 @@ var AnthropicMessagesLanguageModel = class {
2124
2437
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
2125
2438
  return;
2126
2439
  }
2440
+ if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
2441
+ delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
2442
+ }
2127
2443
  controller.enqueue({
2128
2444
  type: "tool-input-delta",
2129
2445
  id: contentBlock.toolCallId,
2130
2446
  delta
2131
2447
  });
2132
2448
  contentBlock.input += delta;
2449
+ contentBlock.firstDelta = false;
2133
2450
  }
2134
2451
  return;
2135
2452
  }
@@ -2215,46 +2532,46 @@ var AnthropicMessagesLanguageModel = class {
2215
2532
  };
2216
2533
 
2217
2534
  // src/tool/bash_20241022.ts
2218
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
2219
- var import_v48 = require("zod/v4");
2220
- var bash_20241022InputSchema = (0, import_provider_utils11.lazySchema)(
2221
- () => (0, import_provider_utils11.zodSchema)(
2222
- import_v48.z.object({
2223
- command: import_v48.z.string(),
2224
- restart: import_v48.z.boolean().optional()
2535
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
2536
+ var import_v49 = require("zod/v4");
2537
+ var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
2538
+ () => (0, import_provider_utils12.zodSchema)(
2539
+ import_v49.z.object({
2540
+ command: import_v49.z.string(),
2541
+ restart: import_v49.z.boolean().optional()
2225
2542
  })
2226
2543
  )
2227
2544
  );
2228
- var bash_20241022 = (0, import_provider_utils11.createProviderDefinedToolFactory)({
2545
+ var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
2229
2546
  id: "anthropic.bash_20241022",
2230
2547
  name: "bash",
2231
2548
  inputSchema: bash_20241022InputSchema
2232
2549
  });
2233
2550
 
2234
2551
  // src/tool/bash_20250124.ts
2235
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
2236
- var import_v49 = require("zod/v4");
2237
- var bash_20250124InputSchema = (0, import_provider_utils12.lazySchema)(
2238
- () => (0, import_provider_utils12.zodSchema)(
2239
- import_v49.z.object({
2240
- command: import_v49.z.string(),
2241
- restart: import_v49.z.boolean().optional()
2552
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
2553
+ var import_v410 = require("zod/v4");
2554
+ var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
2555
+ () => (0, import_provider_utils13.zodSchema)(
2556
+ import_v410.z.object({
2557
+ command: import_v410.z.string(),
2558
+ restart: import_v410.z.boolean().optional()
2242
2559
  })
2243
2560
  )
2244
2561
  );
2245
- var bash_20250124 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
2562
+ var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
2246
2563
  id: "anthropic.bash_20250124",
2247
2564
  name: "bash",
2248
2565
  inputSchema: bash_20250124InputSchema
2249
2566
  });
2250
2567
 
2251
2568
  // src/tool/computer_20241022.ts
2252
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
2253
- var import_v410 = require("zod/v4");
2254
- var computer_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
2255
- () => (0, import_provider_utils13.zodSchema)(
2256
- import_v410.z.object({
2257
- action: import_v410.z.enum([
2569
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
2570
+ var import_v411 = require("zod/v4");
2571
+ var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
2572
+ () => (0, import_provider_utils14.zodSchema)(
2573
+ import_v411.z.object({
2574
+ action: import_v411.z.enum([
2258
2575
  "key",
2259
2576
  "type",
2260
2577
  "mouse_move",
@@ -2266,24 +2583,24 @@ var computer_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
2266
2583
  "screenshot",
2267
2584
  "cursor_position"
2268
2585
  ]),
2269
- coordinate: import_v410.z.array(import_v410.z.number().int()).optional(),
2270
- text: import_v410.z.string().optional()
2586
+ coordinate: import_v411.z.array(import_v411.z.number().int()).optional(),
2587
+ text: import_v411.z.string().optional()
2271
2588
  })
2272
2589
  )
2273
2590
  );
2274
- var computer_20241022 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
2591
+ var computer_20241022 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
2275
2592
  id: "anthropic.computer_20241022",
2276
2593
  name: "computer",
2277
2594
  inputSchema: computer_20241022InputSchema
2278
2595
  });
2279
2596
 
2280
2597
  // src/tool/computer_20250124.ts
2281
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
2282
- var import_v411 = require("zod/v4");
2283
- var computer_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
2284
- () => (0, import_provider_utils14.zodSchema)(
2285
- import_v411.z.object({
2286
- action: import_v411.z.enum([
2598
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
2599
+ var import_v412 = require("zod/v4");
2600
+ var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
2601
+ () => (0, import_provider_utils15.zodSchema)(
2602
+ import_v412.z.object({
2603
+ action: import_v412.z.enum([
2287
2604
  "key",
2288
2605
  "hold_key",
2289
2606
  "type",
@@ -2301,82 +2618,128 @@ var computer_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
2301
2618
  "wait",
2302
2619
  "screenshot"
2303
2620
  ]),
2304
- coordinate: import_v411.z.tuple([import_v411.z.number().int(), import_v411.z.number().int()]).optional(),
2305
- duration: import_v411.z.number().optional(),
2306
- scroll_amount: import_v411.z.number().optional(),
2307
- scroll_direction: import_v411.z.enum(["up", "down", "left", "right"]).optional(),
2308
- start_coordinate: import_v411.z.tuple([import_v411.z.number().int(), import_v411.z.number().int()]).optional(),
2309
- text: import_v411.z.string().optional()
2621
+ coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
2622
+ duration: import_v412.z.number().optional(),
2623
+ scroll_amount: import_v412.z.number().optional(),
2624
+ scroll_direction: import_v412.z.enum(["up", "down", "left", "right"]).optional(),
2625
+ start_coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
2626
+ text: import_v412.z.string().optional()
2310
2627
  })
2311
2628
  )
2312
2629
  );
2313
- var computer_20250124 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
2630
+ var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
2314
2631
  id: "anthropic.computer_20250124",
2315
2632
  name: "computer",
2316
2633
  inputSchema: computer_20250124InputSchema
2317
2634
  });
2318
2635
 
2636
+ // src/tool/memory_20250818.ts
2637
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
2638
+ var import_v413 = require("zod/v4");
2639
+ var memory_20250818InputSchema = (0, import_provider_utils16.lazySchema)(
2640
+ () => (0, import_provider_utils16.zodSchema)(
2641
+ import_v413.z.discriminatedUnion("command", [
2642
+ import_v413.z.object({
2643
+ command: import_v413.z.literal("view"),
2644
+ path: import_v413.z.string(),
2645
+ view_range: import_v413.z.tuple([import_v413.z.number(), import_v413.z.number()]).optional()
2646
+ }),
2647
+ import_v413.z.object({
2648
+ command: import_v413.z.literal("create"),
2649
+ path: import_v413.z.string(),
2650
+ file_text: import_v413.z.string()
2651
+ }),
2652
+ import_v413.z.object({
2653
+ command: import_v413.z.literal("str_replace"),
2654
+ path: import_v413.z.string(),
2655
+ old_str: import_v413.z.string(),
2656
+ new_str: import_v413.z.string()
2657
+ }),
2658
+ import_v413.z.object({
2659
+ command: import_v413.z.literal("insert"),
2660
+ path: import_v413.z.string(),
2661
+ insert_line: import_v413.z.number(),
2662
+ insert_text: import_v413.z.string()
2663
+ }),
2664
+ import_v413.z.object({
2665
+ command: import_v413.z.literal("delete"),
2666
+ path: import_v413.z.string()
2667
+ }),
2668
+ import_v413.z.object({
2669
+ command: import_v413.z.literal("rename"),
2670
+ old_path: import_v413.z.string(),
2671
+ new_path: import_v413.z.string()
2672
+ })
2673
+ ])
2674
+ )
2675
+ );
2676
+ var memory_20250818 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
2677
+ id: "anthropic.memory_20250818",
2678
+ name: "memory",
2679
+ inputSchema: memory_20250818InputSchema
2680
+ });
2681
+
2319
2682
  // src/tool/text-editor_20241022.ts
2320
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
2321
- var import_v412 = require("zod/v4");
2322
- var textEditor_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
2323
- () => (0, import_provider_utils15.zodSchema)(
2324
- import_v412.z.object({
2325
- command: import_v412.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2326
- path: import_v412.z.string(),
2327
- file_text: import_v412.z.string().optional(),
2328
- insert_line: import_v412.z.number().int().optional(),
2329
- new_str: import_v412.z.string().optional(),
2330
- old_str: import_v412.z.string().optional(),
2331
- view_range: import_v412.z.array(import_v412.z.number().int()).optional()
2683
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
2684
+ var import_v414 = require("zod/v4");
2685
+ var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
2686
+ () => (0, import_provider_utils17.zodSchema)(
2687
+ import_v414.z.object({
2688
+ command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2689
+ path: import_v414.z.string(),
2690
+ file_text: import_v414.z.string().optional(),
2691
+ insert_line: import_v414.z.number().int().optional(),
2692
+ new_str: import_v414.z.string().optional(),
2693
+ old_str: import_v414.z.string().optional(),
2694
+ view_range: import_v414.z.array(import_v414.z.number().int()).optional()
2332
2695
  })
2333
2696
  )
2334
2697
  );
2335
- var textEditor_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
2698
+ var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
2336
2699
  id: "anthropic.text_editor_20241022",
2337
2700
  name: "str_replace_editor",
2338
2701
  inputSchema: textEditor_20241022InputSchema
2339
2702
  });
2340
2703
 
2341
2704
  // src/tool/text-editor_20250124.ts
2342
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
2343
- var import_v413 = require("zod/v4");
2344
- var textEditor_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
2345
- () => (0, import_provider_utils16.zodSchema)(
2346
- import_v413.z.object({
2347
- command: import_v413.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2348
- path: import_v413.z.string(),
2349
- file_text: import_v413.z.string().optional(),
2350
- insert_line: import_v413.z.number().int().optional(),
2351
- new_str: import_v413.z.string().optional(),
2352
- old_str: import_v413.z.string().optional(),
2353
- view_range: import_v413.z.array(import_v413.z.number().int()).optional()
2705
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
2706
+ var import_v415 = require("zod/v4");
2707
+ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
2708
+ () => (0, import_provider_utils18.zodSchema)(
2709
+ import_v415.z.object({
2710
+ command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2711
+ path: import_v415.z.string(),
2712
+ file_text: import_v415.z.string().optional(),
2713
+ insert_line: import_v415.z.number().int().optional(),
2714
+ new_str: import_v415.z.string().optional(),
2715
+ old_str: import_v415.z.string().optional(),
2716
+ view_range: import_v415.z.array(import_v415.z.number().int()).optional()
2354
2717
  })
2355
2718
  )
2356
2719
  );
2357
- var textEditor_20250124 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
2720
+ var textEditor_20250124 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
2358
2721
  id: "anthropic.text_editor_20250124",
2359
2722
  name: "str_replace_editor",
2360
2723
  inputSchema: textEditor_20250124InputSchema
2361
2724
  });
2362
2725
 
2363
2726
  // src/tool/text-editor_20250429.ts
2364
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
2365
- var import_v414 = require("zod/v4");
2366
- var textEditor_20250429InputSchema = (0, import_provider_utils17.lazySchema)(
2367
- () => (0, import_provider_utils17.zodSchema)(
2368
- import_v414.z.object({
2369
- command: import_v414.z.enum(["view", "create", "str_replace", "insert"]),
2370
- path: import_v414.z.string(),
2371
- file_text: import_v414.z.string().optional(),
2372
- insert_line: import_v414.z.number().int().optional(),
2373
- new_str: import_v414.z.string().optional(),
2374
- old_str: import_v414.z.string().optional(),
2375
- view_range: import_v414.z.array(import_v414.z.number().int()).optional()
2727
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
2728
+ var import_v416 = require("zod/v4");
2729
+ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
2730
+ () => (0, import_provider_utils19.zodSchema)(
2731
+ import_v416.z.object({
2732
+ command: import_v416.z.enum(["view", "create", "str_replace", "insert"]),
2733
+ path: import_v416.z.string(),
2734
+ file_text: import_v416.z.string().optional(),
2735
+ insert_line: import_v416.z.number().int().optional(),
2736
+ new_str: import_v416.z.string().optional(),
2737
+ old_str: import_v416.z.string().optional(),
2738
+ view_range: import_v416.z.array(import_v416.z.number().int()).optional()
2376
2739
  })
2377
2740
  )
2378
2741
  );
2379
- var textEditor_20250429 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
2742
+ var textEditor_20250429 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
2380
2743
  id: "anthropic.text_editor_20250429",
2381
2744
  name: "str_replace_based_edit_tool",
2382
2745
  inputSchema: textEditor_20250429InputSchema
@@ -2413,6 +2776,19 @@ var anthropicTools = {
2413
2776
  * Tool name must be `code_execution`.
2414
2777
  */
2415
2778
  codeExecution_20250522,
2779
+ /**
2780
+ * Claude can analyze data, create visualizations, perform complex calculations,
2781
+ * run system commands, create and edit files, and process uploaded files directly within
2782
+ * the API conversation.
2783
+ *
2784
+ * The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
2785
+ * including writing code, in a secure, sandboxed environment.
2786
+ *
2787
+ * This is the latest version with enhanced Bash support and file operations.
2788
+ *
2789
+ * Tool name must be `code_execution`.
2790
+ */
2791
+ codeExecution_20250825,
2416
2792
  /**
2417
2793
  * Claude can interact with computer environments through the computer use tool, which
2418
2794
  * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
@@ -2439,6 +2815,17 @@ var anthropicTools = {
2439
2815
  * @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.
2440
2816
  */
2441
2817
  computer_20250124,
2818
+ /**
2819
+ * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
2820
+ * Claude can create, read, update, and delete files that persist between sessions,
2821
+ * allowing it to build knowledge over time without keeping everything in the context window.
2822
+ * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
2823
+ *
2824
+ * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
2825
+ *
2826
+ * Tool name must be `memory`.
2827
+ */
2828
+ memory_20250818,
2442
2829
  /**
2443
2830
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
2444
2831
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
@@ -2513,11 +2900,11 @@ var anthropicTools = {
2513
2900
  // src/anthropic-provider.ts
2514
2901
  function createAnthropic(options = {}) {
2515
2902
  var _a;
2516
- const baseURL = (_a = (0, import_provider_utils18.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.anthropic.com/v1";
2517
- const getHeaders = () => (0, import_provider_utils18.withUserAgentSuffix)(
2903
+ const baseURL = (_a = (0, import_provider_utils20.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.anthropic.com/v1";
2904
+ const getHeaders = () => (0, import_provider_utils20.withUserAgentSuffix)(
2518
2905
  {
2519
2906
  "anthropic-version": "2023-06-01",
2520
- "x-api-key": (0, import_provider_utils18.loadApiKey)({
2907
+ "x-api-key": (0, import_provider_utils20.loadApiKey)({
2521
2908
  apiKey: options.apiKey,
2522
2909
  environmentVariableName: "ANTHROPIC_API_KEY",
2523
2910
  description: "Anthropic"
@@ -2533,7 +2920,7 @@ function createAnthropic(options = {}) {
2533
2920
  baseURL,
2534
2921
  headers: getHeaders,
2535
2922
  fetch: options.fetch,
2536
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils18.generateId,
2923
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils20.generateId,
2537
2924
  supportedUrls: () => ({
2538
2925
  "image/*": [/^https?:\/\/.*$/]
2539
2926
  })