@ai-sdk/openai 2.0.0-beta.13 → 2.0.0-beta.14

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.
@@ -21,6 +21,7 @@ declare const openaiProviderOptions: z.ZodObject<{
21
21
  serviceTier: z.ZodOptional<z.ZodEnum<{
22
22
  auto: "auto";
23
23
  flex: "flex";
24
+ priority: "priority";
24
25
  }>>;
25
26
  strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
26
27
  }, z.core.$strip>;
@@ -211,6 +212,7 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
211
212
  serviceTier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
212
213
  auto: "auto";
213
214
  flex: "flex";
215
+ priority: "priority";
214
216
  }>>>;
215
217
  include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
216
218
  "reasoning.encrypted_content": "reasoning.encrypted_content";
@@ -21,6 +21,7 @@ declare const openaiProviderOptions: z.ZodObject<{
21
21
  serviceTier: z.ZodOptional<z.ZodEnum<{
22
22
  auto: "auto";
23
23
  flex: "flex";
24
+ priority: "priority";
24
25
  }>>;
25
26
  strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
26
27
  }, z.core.$strip>;
@@ -211,6 +212,7 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
211
212
  serviceTier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
212
213
  auto: "auto";
213
214
  flex: "flex";
215
+ priority: "priority";
214
216
  }>>>;
215
217
  include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
216
218
  "reasoning.encrypted_content": "reasoning.encrypted_content";
@@ -305,12 +305,14 @@ var openaiProviderOptions = import_v4.z.object({
305
305
  */
306
306
  structuredOutputs: import_v4.z.boolean().optional(),
307
307
  /**
308
- * Service tier for the request. Set to 'flex' for 50% cheaper processing
309
- * at the cost of increased latency. Only available for o3 and o4-mini models.
308
+ * Service tier for the request.
309
+ * - 'auto': Default service tier
310
+ * - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
311
+ * - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
310
312
  *
311
313
  * @default 'auto'
312
314
  */
313
- serviceTier: import_v4.z.enum(["auto", "flex"]).optional(),
315
+ serviceTier: import_v4.z.enum(["auto", "flex", "priority"]).optional(),
314
316
  /**
315
317
  * Whether to use strict JSON schema validation.
316
318
  *
@@ -686,6 +688,14 @@ var OpenAIChatLanguageModel = class {
686
688
  });
687
689
  baseArgs.service_tier = void 0;
688
690
  }
691
+ if (openaiOptions.serviceTier === "priority" && !supportsPriorityProcessing(this.modelId)) {
692
+ warnings.push({
693
+ type: "unsupported-setting",
694
+ setting: "serviceTier",
695
+ details: "priority processing is only available for supported models (GPT-4, o3, o4-mini) and requires Enterprise access"
696
+ });
697
+ baseArgs.service_tier = void 0;
698
+ }
689
699
  const {
690
700
  tools: openaiTools,
691
701
  toolChoice: openaiToolChoice,
@@ -1079,6 +1089,9 @@ function isReasoningModel(modelId) {
1079
1089
  function supportsFlexProcessing(modelId) {
1080
1090
  return modelId.startsWith("o3") || modelId.startsWith("o4-mini");
1081
1091
  }
1092
+ function supportsPriorityProcessing(modelId) {
1093
+ return modelId.startsWith("gpt-4") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
1094
+ }
1082
1095
  function getSystemMessageMode(modelId) {
1083
1096
  var _a, _b;
1084
1097
  if (!isReasoningModel(modelId)) {
@@ -2428,6 +2441,14 @@ var OpenAIResponsesLanguageModel = class {
2428
2441
  });
2429
2442
  delete baseArgs.service_tier;
2430
2443
  }
2444
+ if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "priority" && !supportsPriorityProcessing2(this.modelId)) {
2445
+ warnings.push({
2446
+ type: "unsupported-setting",
2447
+ setting: "serviceTier",
2448
+ details: "priority processing is only available for supported models (GPT-4, o3, o4-mini) and requires Enterprise access"
2449
+ });
2450
+ delete baseArgs.service_tier;
2451
+ }
2431
2452
  const {
2432
2453
  tools: openaiTools,
2433
2454
  toolChoice: openaiToolChoice,
@@ -3147,6 +3168,9 @@ function getResponsesModelConfig(modelId) {
3147
3168
  function supportsFlexProcessing2(modelId) {
3148
3169
  return modelId.startsWith("o3") || modelId.startsWith("o4-mini");
3149
3170
  }
3171
+ function supportsPriorityProcessing2(modelId) {
3172
+ return modelId.startsWith("gpt-4") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
3173
+ }
3150
3174
  var openaiResponsesProviderOptionsSchema = import_v415.z.object({
3151
3175
  metadata: import_v415.z.any().nullish(),
3152
3176
  parallelToolCalls: import_v415.z.boolean().nullish(),
@@ -3157,7 +3181,7 @@ var openaiResponsesProviderOptionsSchema = import_v415.z.object({
3157
3181
  strictJsonSchema: import_v415.z.boolean().nullish(),
3158
3182
  instructions: import_v415.z.string().nullish(),
3159
3183
  reasoningSummary: import_v415.z.string().nullish(),
3160
- serviceTier: import_v415.z.enum(["auto", "flex"]).nullish(),
3184
+ serviceTier: import_v415.z.enum(["auto", "flex", "priority"]).nullish(),
3161
3185
  include: import_v415.z.array(import_v415.z.enum(["reasoning.encrypted_content"])).nullish()
3162
3186
  });
3163
3187
  // Annotate the CommonJS export names for ESM import in node: