@ai-sdk/openai 3.0.0-beta.64 → 3.0.0-beta.66

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.mjs CHANGED
@@ -1948,6 +1948,7 @@ import { z as z13 } from "zod/v4";
1948
1948
  var webSearchArgsSchema = lazySchema12(
1949
1949
  () => zodSchema12(
1950
1950
  z13.object({
1951
+ externalWebAccess: z13.boolean().optional(),
1951
1952
  filters: z13.object({ allowedDomains: z13.array(z13.string()).optional() }).optional(),
1952
1953
  searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
1953
1954
  userLocation: z13.object({
@@ -3346,6 +3347,7 @@ async function prepareResponsesTools({
3346
3347
  openaiTools2.push({
3347
3348
  type: "web_search",
3348
3349
  filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
3350
+ external_web_access: args.externalWebAccess,
3349
3351
  search_context_size: args.searchContextSize,
3350
3352
  user_location: args.userLocation
3351
3353
  });
@@ -3681,6 +3683,7 @@ var OpenAIResponsesLanguageModel = class {
3681
3683
  path: "/responses",
3682
3684
  modelId: this.modelId
3683
3685
  });
3686
+ const providerKey = this.config.provider.replace(".responses", "");
3684
3687
  const {
3685
3688
  responseHeaders,
3686
3689
  value: response,
@@ -3721,7 +3724,7 @@ var OpenAIResponsesLanguageModel = class {
3721
3724
  type: "reasoning",
3722
3725
  text: summary.text,
3723
3726
  providerMetadata: {
3724
- openai: {
3727
+ [providerKey]: {
3725
3728
  itemId: part.id,
3726
3729
  reasoningEncryptedContent: (_a = part.encrypted_content) != null ? _a : null
3727
3730
  }
@@ -3757,7 +3760,7 @@ var OpenAIResponsesLanguageModel = class {
3757
3760
  action: part.action
3758
3761
  }),
3759
3762
  providerMetadata: {
3760
- openai: {
3763
+ [providerKey]: {
3761
3764
  itemId: part.id
3762
3765
  }
3763
3766
  }
@@ -3779,7 +3782,7 @@ var OpenAIResponsesLanguageModel = class {
3779
3782
  type: "text",
3780
3783
  text: contentPart.text,
3781
3784
  providerMetadata: {
3782
- openai: providerMetadata2
3785
+ [providerKey]: providerMetadata2
3783
3786
  }
3784
3787
  });
3785
3788
  for (const annotation of contentPart.annotations) {
@@ -3801,7 +3804,7 @@ var OpenAIResponsesLanguageModel = class {
3801
3804
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
3802
3805
  ...annotation.file_id ? {
3803
3806
  providerMetadata: {
3804
- openai: {
3807
+ [providerKey]: {
3805
3808
  fileId: annotation.file_id
3806
3809
  }
3807
3810
  }
@@ -3816,7 +3819,7 @@ var OpenAIResponsesLanguageModel = class {
3816
3819
  title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
3817
3820
  filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
3818
3821
  providerMetadata: {
3819
- openai: {
3822
+ [providerKey]: {
3820
3823
  fileId: annotation.file_id,
3821
3824
  containerId: annotation.container_id,
3822
3825
  ...annotation.index != null ? { index: annotation.index } : {}
@@ -3832,7 +3835,7 @@ var OpenAIResponsesLanguageModel = class {
3832
3835
  title: annotation.file_id,
3833
3836
  filename: annotation.file_id,
3834
3837
  providerMetadata: {
3835
- openai: {
3838
+ [providerKey]: {
3836
3839
  fileId: annotation.file_id,
3837
3840
  ...annotation.index != null ? { index: annotation.index } : {}
3838
3841
  }
@@ -3851,7 +3854,7 @@ var OpenAIResponsesLanguageModel = class {
3851
3854
  toolName: part.name,
3852
3855
  input: part.arguments,
3853
3856
  providerMetadata: {
3854
- openai: {
3857
+ [providerKey]: {
3855
3858
  itemId: part.id
3856
3859
  }
3857
3860
  }
@@ -4016,13 +4019,13 @@ var OpenAIResponsesLanguageModel = class {
4016
4019
  }
4017
4020
  }
4018
4021
  const providerMetadata = {
4019
- openai: { responseId: response.id }
4022
+ [providerKey]: { responseId: response.id }
4020
4023
  };
4021
4024
  if (logprobs.length > 0) {
4022
- providerMetadata.openai.logprobs = logprobs;
4025
+ providerMetadata[providerKey].logprobs = logprobs;
4023
4026
  }
4024
4027
  if (typeof response.service_tier === "string") {
4025
- providerMetadata.openai.serviceTier = response.service_tier;
4028
+ providerMetadata[providerKey].serviceTier = response.service_tier;
4026
4029
  }
4027
4030
  const usage = response.usage;
4028
4031
  return {
@@ -4075,6 +4078,7 @@ var OpenAIResponsesLanguageModel = class {
4075
4078
  fetch: this.config.fetch
4076
4079
  });
4077
4080
  const self = this;
4081
+ const providerKey = this.config.provider.replace(".responses", "");
4078
4082
  let finishReason = "unknown";
4079
4083
  const usage = {
4080
4084
  inputTokens: void 0,
@@ -4198,7 +4202,7 @@ var OpenAIResponsesLanguageModel = class {
4198
4202
  type: "text-start",
4199
4203
  id: value.item.id,
4200
4204
  providerMetadata: {
4201
- openai: {
4205
+ [providerKey]: {
4202
4206
  itemId: value.item.id
4203
4207
  }
4204
4208
  }
@@ -4212,7 +4216,7 @@ var OpenAIResponsesLanguageModel = class {
4212
4216
  type: "reasoning-start",
4213
4217
  id: `${value.item.id}:0`,
4214
4218
  providerMetadata: {
4215
- openai: {
4219
+ [providerKey]: {
4216
4220
  itemId: value.item.id,
4217
4221
  reasoningEncryptedContent: (_a = value.item.encrypted_content) != null ? _a : null
4218
4222
  }
@@ -4233,7 +4237,7 @@ var OpenAIResponsesLanguageModel = class {
4233
4237
  toolName: value.item.name,
4234
4238
  input: value.item.arguments,
4235
4239
  providerMetadata: {
4236
- openai: {
4240
+ [providerKey]: {
4237
4241
  itemId: value.item.id
4238
4242
  }
4239
4243
  }
@@ -4371,7 +4375,7 @@ var OpenAIResponsesLanguageModel = class {
4371
4375
  }
4372
4376
  }),
4373
4377
  providerMetadata: {
4374
- openai: { itemId: value.item.id }
4378
+ [providerKey]: { itemId: value.item.id }
4375
4379
  }
4376
4380
  });
4377
4381
  } else if (value.item.type === "reasoning") {
@@ -4386,7 +4390,7 @@ var OpenAIResponsesLanguageModel = class {
4386
4390
  type: "reasoning-end",
4387
4391
  id: `${value.item.id}:${summaryIndex}`,
4388
4392
  providerMetadata: {
4389
- openai: {
4393
+ [providerKey]: {
4390
4394
  itemId: value.item.id,
4391
4395
  reasoningEncryptedContent: (_d = value.item.encrypted_content) != null ? _d : null
4392
4396
  }
@@ -4476,7 +4480,9 @@ var OpenAIResponsesLanguageModel = class {
4476
4480
  controller.enqueue({
4477
4481
  type: "reasoning-end",
4478
4482
  id: `${value.item_id}:${summaryIndex}`,
4479
- providerMetadata: { openai: { itemId: value.item_id } }
4483
+ providerMetadata: {
4484
+ [providerKey]: { itemId: value.item_id }
4485
+ }
4480
4486
  });
4481
4487
  activeReasoningPart.summaryParts[summaryIndex] = "concluded";
4482
4488
  }
@@ -4485,7 +4491,7 @@ var OpenAIResponsesLanguageModel = class {
4485
4491
  type: "reasoning-start",
4486
4492
  id: `${value.item_id}:${value.summary_index}`,
4487
4493
  providerMetadata: {
4488
- openai: {
4494
+ [providerKey]: {
4489
4495
  itemId: value.item_id,
4490
4496
  reasoningEncryptedContent: (_h = (_g = activeReasoning[value.item_id]) == null ? void 0 : _g.encryptedContent) != null ? _h : null
4491
4497
  }
@@ -4498,7 +4504,7 @@ var OpenAIResponsesLanguageModel = class {
4498
4504
  id: `${value.item_id}:${value.summary_index}`,
4499
4505
  delta: value.delta,
4500
4506
  providerMetadata: {
4501
- openai: {
4507
+ [providerKey]: {
4502
4508
  itemId: value.item_id
4503
4509
  }
4504
4510
  }
@@ -4509,7 +4515,7 @@ var OpenAIResponsesLanguageModel = class {
4509
4515
  type: "reasoning-end",
4510
4516
  id: `${value.item_id}:${value.summary_index}`,
4511
4517
  providerMetadata: {
4512
- openai: { itemId: value.item_id }
4518
+ [providerKey]: { itemId: value.item_id }
4513
4519
  }
4514
4520
  });
4515
4521
  activeReasoning[value.item_id].summaryParts[value.summary_index] = "concluded";
@@ -4549,7 +4555,7 @@ var OpenAIResponsesLanguageModel = class {
4549
4555
  filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
4550
4556
  ...value.annotation.file_id ? {
4551
4557
  providerMetadata: {
4552
- openai: {
4558
+ [providerKey]: {
4553
4559
  fileId: value.annotation.file_id
4554
4560
  }
4555
4561
  }
@@ -4564,7 +4570,7 @@ var OpenAIResponsesLanguageModel = class {
4564
4570
  title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
4565
4571
  filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
4566
4572
  providerMetadata: {
4567
- openai: {
4573
+ [providerKey]: {
4568
4574
  fileId: value.annotation.file_id,
4569
4575
  containerId: value.annotation.container_id,
4570
4576
  ...value.annotation.index != null ? { index: value.annotation.index } : {}
@@ -4580,7 +4586,7 @@ var OpenAIResponsesLanguageModel = class {
4580
4586
  title: value.annotation.file_id,
4581
4587
  filename: value.annotation.file_id,
4582
4588
  providerMetadata: {
4583
- openai: {
4589
+ [providerKey]: {
4584
4590
  fileId: value.annotation.file_id,
4585
4591
  ...value.annotation.index != null ? { index: value.annotation.index } : {}
4586
4592
  }
@@ -4592,7 +4598,7 @@ var OpenAIResponsesLanguageModel = class {
4592
4598
  type: "text-end",
4593
4599
  id: value.item.id,
4594
4600
  providerMetadata: {
4595
- openai: {
4601
+ [providerKey]: {
4596
4602
  itemId: value.item.id,
4597
4603
  ...ongoingAnnotations.length > 0 && {
4598
4604
  annotations: ongoingAnnotations
@@ -4606,15 +4612,15 @@ var OpenAIResponsesLanguageModel = class {
4606
4612
  },
4607
4613
  flush(controller) {
4608
4614
  const providerMetadata = {
4609
- openai: {
4615
+ [providerKey]: {
4610
4616
  responseId
4611
4617
  }
4612
4618
  };
4613
4619
  if (logprobs.length > 0) {
4614
- providerMetadata.openai.logprobs = logprobs;
4620
+ providerMetadata[providerKey].logprobs = logprobs;
4615
4621
  }
4616
4622
  if (serviceTier !== void 0) {
4617
- providerMetadata.openai.serviceTier = serviceTier;
4623
+ providerMetadata[providerKey].serviceTier = serviceTier;
4618
4624
  }
4619
4625
  controller.enqueue({
4620
4626
  type: "finish",
@@ -5058,7 +5064,7 @@ var OpenAITranscriptionModel = class {
5058
5064
  };
5059
5065
 
5060
5066
  // src/version.ts
5061
- var VERSION = true ? "3.0.0-beta.64" : "0.0.0-test";
5067
+ var VERSION = true ? "3.0.0-beta.66" : "0.0.0-test";
5062
5068
 
5063
5069
  // src/openai-provider.ts
5064
5070
  function createOpenAI(options = {}) {