@ai-sdk/openai 4.0.57 → 4.0.58

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.
@@ -217,12 +217,13 @@ The following provider options are available:
217
217
  `.nullable()`.
218
218
  </Note>
219
219
 
220
- - **serviceTier** _'auto' | 'flex' | 'priority' | 'fast' | 'default'_
220
+ - **serviceTier** _'auto' | 'flex' | 'priority' | 'fast' | 'ultrafast' | 'default'_
221
221
  Service tier for the request. Set to 'flex' for 50% cheaper processing
222
222
  at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
223
223
  Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
224
224
  'fast' is OpenAI's newer name for the 'priority' tier; the two are interchangeable, and responses from
225
225
  gpt-5.6 and earlier report `serviceTier: 'priority'` for either.
226
+ Set to 'ultrafast' for access-controlled Ultrafast processing (available only for gpt-5.6-sol).
226
227
 
227
228
  Defaults to 'auto'.
228
229
 
@@ -2106,13 +2107,14 @@ The following optional provider options are available for OpenAI chat models:
2106
2107
 
2107
2108
  Parameters for prediction mode.
2108
2109
 
2109
- - **serviceTier** _'auto' | 'flex' | 'priority' | 'fast' | 'default'_
2110
+ - **serviceTier** _'auto' | 'flex' | 'priority' | 'fast' | 'ultrafast' | 'default'_
2110
2111
 
2111
2112
  Service tier for the request. Set to 'flex' for 50% cheaper processing
2112
2113
  at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
2113
2114
  Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
2114
2115
  'fast' is OpenAI's newer name for the 'priority' tier; the two are interchangeable, and responses from
2115
2116
  gpt-5.6 and earlier report `serviceTier: 'priority'` for either.
2117
+ Set to 'ultrafast' for access-controlled Ultrafast processing (available only for gpt-5.6-sol).
2116
2118
 
2117
2119
  Defaults to 'auto'.
2118
2120
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/openai",
3
- "version": "4.0.57",
3
+ "version": "4.0.58",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -139,12 +139,13 @@ export const openaiLanguageModelChatOptions = lazySchema(() =>
139
139
  * - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
140
140
  * - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
141
141
  * - 'fast': OpenAI's newer name for the 'priority' tier. Interchangeable with it.
142
+ * - 'ultrafast': Access-controlled Ultrafast processing. Only available for gpt-5.6-sol.
142
143
  * - 'default': The request will be processed with the standard pricing and performance for the selected model.
143
144
  *
144
145
  * @default 'auto'
145
146
  */
146
147
  serviceTier: z
147
- .enum(['auto', 'flex', 'priority', 'fast', 'default'])
148
+ .enum(['auto', 'flex', 'priority', 'fast', 'ultrafast', 'default'])
148
149
  .optional(),
149
150
 
150
151
  /**
@@ -601,6 +601,7 @@ export type OpenAIResponsesTool =
601
601
  }
602
602
  | {
603
603
  type: 'image_generation';
604
+ action: 'generate' | 'edit' | 'auto' | undefined;
604
605
  background: 'auto' | 'opaque' | 'transparent' | undefined;
605
606
  input_fidelity: 'low' | 'high' | undefined;
606
607
  input_image_mask:
@@ -610,12 +611,18 @@ export type OpenAIResponsesTool =
610
611
  }
611
612
  | undefined;
612
613
  model: string | undefined;
613
- moderation: 'auto' | undefined;
614
+ moderation: 'auto' | 'low' | undefined;
614
615
  output_compression: number | undefined;
615
616
  output_format: 'png' | 'jpeg' | 'webp' | undefined;
616
617
  partial_images: number | undefined;
617
618
  quality: 'auto' | 'low' | 'medium' | 'high' | undefined;
618
- size: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | undefined;
619
+ size:
620
+ | 'auto'
621
+ | '1024x1024'
622
+ | '1024x1536'
623
+ | '1536x1024'
624
+ | (string & {})
625
+ | undefined;
619
626
  }
620
627
 
621
628
  /**
@@ -294,11 +294,12 @@ export const openaiLanguageModelResponsesOptionsSchema = lazySchema(() =>
294
294
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
295
295
  * Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
296
296
  * Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
297
+ * Set to 'ultrafast' for access-controlled Ultrafast processing (available only for gpt-5.6-sol).
297
298
  *
298
299
  * Defaults to 'auto'.
299
300
  */
300
301
  serviceTier: z
301
- .enum(['auto', 'flex', 'priority', 'fast', 'default'])
302
+ .enum(['auto', 'flex', 'priority', 'fast', 'ultrafast', 'default'])
302
303
  .nullish(),
303
304
 
304
305
  /**
@@ -302,6 +302,7 @@ export async function prepareResponsesTools({
302
302
 
303
303
  openaiTools.push({
304
304
  type: 'image_generation',
305
+ action: args.action,
305
306
  background: args.background,
306
307
  input_fidelity: args.inputFidelity,
307
308
  input_image_mask: args.inputImageMask
@@ -9,6 +9,7 @@ export const imageGenerationArgsSchema = lazySchema(() =>
9
9
  zodSchema(
10
10
  z
11
11
  .object({
12
+ action: z.enum(['generate', 'edit', 'auto']).optional(),
12
13
  background: z.enum(['auto', 'opaque', 'transparent']).optional(),
13
14
  inputFidelity: z.enum(['low', 'high']).optional(),
14
15
  inputImageMask: z
@@ -18,13 +19,16 @@ export const imageGenerationArgsSchema = lazySchema(() =>
18
19
  })
19
20
  .optional(),
20
21
  model: z.string().optional(),
21
- moderation: z.enum(['auto']).optional(),
22
+ moderation: z.enum(['auto', 'low']).optional(),
22
23
  outputCompression: z.number().int().min(0).max(100).optional(),
23
24
  outputFormat: z.enum(['png', 'jpeg', 'webp']).optional(),
24
25
  partialImages: z.number().int().min(0).max(3).optional(),
25
26
  quality: z.enum(['auto', 'low', 'medium', 'high']).optional(),
26
27
  size: z
27
- .enum(['1024x1024', '1024x1536', '1536x1024', 'auto'])
28
+ .union([
29
+ z.enum(['1024x1024', '1024x1536', '1536x1024', 'auto']),
30
+ z.string().regex(/^\d+x\d+$/),
31
+ ])
28
32
  .optional(),
29
33
  })
30
34
  .strict(),
@@ -38,6 +42,11 @@ export const imageGenerationOutputSchema = lazySchema(() =>
38
42
  );
39
43
 
40
44
  type ImageGenerationArgs = {
45
+ /**
46
+ * Whether to generate a new image or edit an existing image. Default: auto.
47
+ */
48
+ action?: 'generate' | 'edit' | 'auto';
49
+
41
50
  /**
42
51
  * Background type for the generated image. Default is 'auto'.
43
52
  */
@@ -70,9 +79,9 @@ type ImageGenerationArgs = {
70
79
  model?: string;
71
80
 
72
81
  /**
73
- * Moderation level for the generated image. Default: auto.
82
+ * Moderation level for the generated image. One of auto or low. Default: auto.
74
83
  */
75
- moderation?: 'auto';
84
+ moderation?: 'auto' | 'low';
76
85
 
77
86
  /**
78
87
  * Compression level for the output image. Default: 100.
@@ -98,10 +107,11 @@ type ImageGenerationArgs = {
98
107
 
99
108
  /**
100
109
  * The size of the generated image.
101
- * One of 1024x1024, 1024x1536, 1536x1024, or auto.
110
+ * One of 1024x1024, 1024x1536, 1536x1024, or auto. gpt-image-2 also accepts
111
+ * arbitrary WIDTHxHEIGHT sizes where both are divisible by 16, e.g. 1536x864.
102
112
  * Default: auto.
103
113
  */
104
- size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
114
+ size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | (string & {});
105
115
  };
106
116
 
107
117
  const imageGenerationToolFactory = createProviderExecutedToolFactory<