@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.
@@ -3311,6 +3311,7 @@ import { z as z18 } from "zod/v4";
3311
3311
  var webSearchArgsSchema = lazySchema16(
3312
3312
  () => zodSchema16(
3313
3313
  z18.object({
3314
+ externalWebAccess: z18.boolean().optional(),
3314
3315
  filters: z18.object({ allowedDomains: z18.array(z18.string()).optional() }).optional(),
3315
3316
  searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
3316
3317
  userLocation: z18.object({
@@ -3610,6 +3611,7 @@ async function prepareResponsesTools({
3610
3611
  openaiTools.push({
3611
3612
  type: "web_search",
3612
3613
  filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
3614
+ external_web_access: args.externalWebAccess,
3613
3615
  search_context_size: args.searchContextSize,
3614
3616
  user_location: args.userLocation
3615
3617
  });
@@ -3945,6 +3947,7 @@ var OpenAIResponsesLanguageModel = class {
3945
3947
  path: "/responses",
3946
3948
  modelId: this.modelId
3947
3949
  });
3950
+ const providerKey = this.config.provider.replace(".responses", "");
3948
3951
  const {
3949
3952
  responseHeaders,
3950
3953
  value: response,
@@ -3985,7 +3988,7 @@ var OpenAIResponsesLanguageModel = class {
3985
3988
  type: "reasoning",
3986
3989
  text: summary.text,
3987
3990
  providerMetadata: {
3988
- openai: {
3991
+ [providerKey]: {
3989
3992
  itemId: part.id,
3990
3993
  reasoningEncryptedContent: (_a = part.encrypted_content) != null ? _a : null
3991
3994
  }
@@ -4021,7 +4024,7 @@ var OpenAIResponsesLanguageModel = class {
4021
4024
  action: part.action
4022
4025
  }),
4023
4026
  providerMetadata: {
4024
- openai: {
4027
+ [providerKey]: {
4025
4028
  itemId: part.id
4026
4029
  }
4027
4030
  }
@@ -4043,7 +4046,7 @@ var OpenAIResponsesLanguageModel = class {
4043
4046
  type: "text",
4044
4047
  text: contentPart.text,
4045
4048
  providerMetadata: {
4046
- openai: providerMetadata2
4049
+ [providerKey]: providerMetadata2
4047
4050
  }
4048
4051
  });
4049
4052
  for (const annotation of contentPart.annotations) {
@@ -4065,7 +4068,7 @@ var OpenAIResponsesLanguageModel = class {
4065
4068
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
4066
4069
  ...annotation.file_id ? {
4067
4070
  providerMetadata: {
4068
- openai: {
4071
+ [providerKey]: {
4069
4072
  fileId: annotation.file_id
4070
4073
  }
4071
4074
  }
@@ -4080,7 +4083,7 @@ var OpenAIResponsesLanguageModel = class {
4080
4083
  title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
4081
4084
  filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
4082
4085
  providerMetadata: {
4083
- openai: {
4086
+ [providerKey]: {
4084
4087
  fileId: annotation.file_id,
4085
4088
  containerId: annotation.container_id,
4086
4089
  ...annotation.index != null ? { index: annotation.index } : {}
@@ -4096,7 +4099,7 @@ var OpenAIResponsesLanguageModel = class {
4096
4099
  title: annotation.file_id,
4097
4100
  filename: annotation.file_id,
4098
4101
  providerMetadata: {
4099
- openai: {
4102
+ [providerKey]: {
4100
4103
  fileId: annotation.file_id,
4101
4104
  ...annotation.index != null ? { index: annotation.index } : {}
4102
4105
  }
@@ -4115,7 +4118,7 @@ var OpenAIResponsesLanguageModel = class {
4115
4118
  toolName: part.name,
4116
4119
  input: part.arguments,
4117
4120
  providerMetadata: {
4118
- openai: {
4121
+ [providerKey]: {
4119
4122
  itemId: part.id
4120
4123
  }
4121
4124
  }
@@ -4280,13 +4283,13 @@ var OpenAIResponsesLanguageModel = class {
4280
4283
  }
4281
4284
  }
4282
4285
  const providerMetadata = {
4283
- openai: { responseId: response.id }
4286
+ [providerKey]: { responseId: response.id }
4284
4287
  };
4285
4288
  if (logprobs.length > 0) {
4286
- providerMetadata.openai.logprobs = logprobs;
4289
+ providerMetadata[providerKey].logprobs = logprobs;
4287
4290
  }
4288
4291
  if (typeof response.service_tier === "string") {
4289
- providerMetadata.openai.serviceTier = response.service_tier;
4292
+ providerMetadata[providerKey].serviceTier = response.service_tier;
4290
4293
  }
4291
4294
  const usage = response.usage;
4292
4295
  return {
@@ -4339,6 +4342,7 @@ var OpenAIResponsesLanguageModel = class {
4339
4342
  fetch: this.config.fetch
4340
4343
  });
4341
4344
  const self = this;
4345
+ const providerKey = this.config.provider.replace(".responses", "");
4342
4346
  let finishReason = "unknown";
4343
4347
  const usage = {
4344
4348
  inputTokens: void 0,
@@ -4462,7 +4466,7 @@ var OpenAIResponsesLanguageModel = class {
4462
4466
  type: "text-start",
4463
4467
  id: value.item.id,
4464
4468
  providerMetadata: {
4465
- openai: {
4469
+ [providerKey]: {
4466
4470
  itemId: value.item.id
4467
4471
  }
4468
4472
  }
@@ -4476,7 +4480,7 @@ var OpenAIResponsesLanguageModel = class {
4476
4480
  type: "reasoning-start",
4477
4481
  id: `${value.item.id}:0`,
4478
4482
  providerMetadata: {
4479
- openai: {
4483
+ [providerKey]: {
4480
4484
  itemId: value.item.id,
4481
4485
  reasoningEncryptedContent: (_a = value.item.encrypted_content) != null ? _a : null
4482
4486
  }
@@ -4497,7 +4501,7 @@ var OpenAIResponsesLanguageModel = class {
4497
4501
  toolName: value.item.name,
4498
4502
  input: value.item.arguments,
4499
4503
  providerMetadata: {
4500
- openai: {
4504
+ [providerKey]: {
4501
4505
  itemId: value.item.id
4502
4506
  }
4503
4507
  }
@@ -4635,7 +4639,7 @@ var OpenAIResponsesLanguageModel = class {
4635
4639
  }
4636
4640
  }),
4637
4641
  providerMetadata: {
4638
- openai: { itemId: value.item.id }
4642
+ [providerKey]: { itemId: value.item.id }
4639
4643
  }
4640
4644
  });
4641
4645
  } else if (value.item.type === "reasoning") {
@@ -4650,7 +4654,7 @@ var OpenAIResponsesLanguageModel = class {
4650
4654
  type: "reasoning-end",
4651
4655
  id: `${value.item.id}:${summaryIndex}`,
4652
4656
  providerMetadata: {
4653
- openai: {
4657
+ [providerKey]: {
4654
4658
  itemId: value.item.id,
4655
4659
  reasoningEncryptedContent: (_d = value.item.encrypted_content) != null ? _d : null
4656
4660
  }
@@ -4740,7 +4744,9 @@ var OpenAIResponsesLanguageModel = class {
4740
4744
  controller.enqueue({
4741
4745
  type: "reasoning-end",
4742
4746
  id: `${value.item_id}:${summaryIndex}`,
4743
- providerMetadata: { openai: { itemId: value.item_id } }
4747
+ providerMetadata: {
4748
+ [providerKey]: { itemId: value.item_id }
4749
+ }
4744
4750
  });
4745
4751
  activeReasoningPart.summaryParts[summaryIndex] = "concluded";
4746
4752
  }
@@ -4749,7 +4755,7 @@ var OpenAIResponsesLanguageModel = class {
4749
4755
  type: "reasoning-start",
4750
4756
  id: `${value.item_id}:${value.summary_index}`,
4751
4757
  providerMetadata: {
4752
- openai: {
4758
+ [providerKey]: {
4753
4759
  itemId: value.item_id,
4754
4760
  reasoningEncryptedContent: (_h = (_g = activeReasoning[value.item_id]) == null ? void 0 : _g.encryptedContent) != null ? _h : null
4755
4761
  }
@@ -4762,7 +4768,7 @@ var OpenAIResponsesLanguageModel = class {
4762
4768
  id: `${value.item_id}:${value.summary_index}`,
4763
4769
  delta: value.delta,
4764
4770
  providerMetadata: {
4765
- openai: {
4771
+ [providerKey]: {
4766
4772
  itemId: value.item_id
4767
4773
  }
4768
4774
  }
@@ -4773,7 +4779,7 @@ var OpenAIResponsesLanguageModel = class {
4773
4779
  type: "reasoning-end",
4774
4780
  id: `${value.item_id}:${value.summary_index}`,
4775
4781
  providerMetadata: {
4776
- openai: { itemId: value.item_id }
4782
+ [providerKey]: { itemId: value.item_id }
4777
4783
  }
4778
4784
  });
4779
4785
  activeReasoning[value.item_id].summaryParts[value.summary_index] = "concluded";
@@ -4813,7 +4819,7 @@ var OpenAIResponsesLanguageModel = class {
4813
4819
  filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
4814
4820
  ...value.annotation.file_id ? {
4815
4821
  providerMetadata: {
4816
- openai: {
4822
+ [providerKey]: {
4817
4823
  fileId: value.annotation.file_id
4818
4824
  }
4819
4825
  }
@@ -4828,7 +4834,7 @@ var OpenAIResponsesLanguageModel = class {
4828
4834
  title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
4829
4835
  filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
4830
4836
  providerMetadata: {
4831
- openai: {
4837
+ [providerKey]: {
4832
4838
  fileId: value.annotation.file_id,
4833
4839
  containerId: value.annotation.container_id,
4834
4840
  ...value.annotation.index != null ? { index: value.annotation.index } : {}
@@ -4844,7 +4850,7 @@ var OpenAIResponsesLanguageModel = class {
4844
4850
  title: value.annotation.file_id,
4845
4851
  filename: value.annotation.file_id,
4846
4852
  providerMetadata: {
4847
- openai: {
4853
+ [providerKey]: {
4848
4854
  fileId: value.annotation.file_id,
4849
4855
  ...value.annotation.index != null ? { index: value.annotation.index } : {}
4850
4856
  }
@@ -4856,7 +4862,7 @@ var OpenAIResponsesLanguageModel = class {
4856
4862
  type: "text-end",
4857
4863
  id: value.item.id,
4858
4864
  providerMetadata: {
4859
- openai: {
4865
+ [providerKey]: {
4860
4866
  itemId: value.item.id,
4861
4867
  ...ongoingAnnotations.length > 0 && {
4862
4868
  annotations: ongoingAnnotations
@@ -4870,15 +4876,15 @@ var OpenAIResponsesLanguageModel = class {
4870
4876
  },
4871
4877
  flush(controller) {
4872
4878
  const providerMetadata = {
4873
- openai: {
4879
+ [providerKey]: {
4874
4880
  responseId
4875
4881
  }
4876
4882
  };
4877
4883
  if (logprobs.length > 0) {
4878
- providerMetadata.openai.logprobs = logprobs;
4884
+ providerMetadata[providerKey].logprobs = logprobs;
4879
4885
  }
4880
4886
  if (serviceTier !== void 0) {
4881
- providerMetadata.openai.serviceTier = serviceTier;
4887
+ providerMetadata[providerKey].serviceTier = serviceTier;
4882
4888
  }
4883
4889
  controller.enqueue({
4884
4890
  type: "finish",