@ai-sdk/openai 4.0.0 → 4.0.1

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.
@@ -2503,7 +2503,7 @@ const model = openai.image('dall-e-3');
2503
2503
 
2504
2504
  ### Image Editing
2505
2505
 
2506
- OpenAI's `gpt-image-1` model supports powerful image editing capabilities. Pass input images via `prompt.images` to transform, combine, or edit existing images.
2506
+ OpenAI's `gpt-image-*` models support powerful image editing capabilities. Pass input images via `prompt.images` to transform, combine, or edit existing images.
2507
2507
 
2508
2508
  #### Basic Image Editing
2509
2509
 
@@ -2513,7 +2513,7 @@ Transform an existing image using text prompts:
2513
2513
  const imageBuffer = readFileSync('./input-image.png');
2514
2514
 
2515
2515
  const { images } = await generateImage({
2516
- model: openai.image('gpt-image-1'),
2516
+ model: openai.image('gpt-image-2'),
2517
2517
  prompt: {
2518
2518
  text: 'Turn the cat into a dog but retain the style of the original image',
2519
2519
  images: [imageBuffer],
@@ -2530,7 +2530,7 @@ const image = readFileSync('./input-image.png');
2530
2530
  const mask = readFileSync('./mask.png'); // Transparent areas = edit regions
2531
2531
 
2532
2532
  const { images } = await generateImage({
2533
- model: openai.image('gpt-image-1'),
2533
+ model: openai.image('gpt-image-2'),
2534
2534
  prompt: {
2535
2535
  text: 'A sunlit indoor lounge area with a pool containing a flamingo',
2536
2536
  images: [image],
@@ -2541,7 +2541,7 @@ const { images } = await generateImage({
2541
2541
 
2542
2542
  #### Background Removal
2543
2543
 
2544
- Remove the background from an image by setting `background` to `transparent`:
2544
+ Remove the background from an image by setting `background` to `transparent` on a model that supports transparent backgrounds:
2545
2545
 
2546
2546
  ```ts
2547
2547
  import { openai, type OpenAIImageModelEditOptions } from '@ai-sdk/openai';
@@ -2550,7 +2550,7 @@ import { generateImage } from 'ai';
2550
2550
  const imageBuffer = readFileSync('./input-image.png');
2551
2551
 
2552
2552
  const { images } = await generateImage({
2553
- model: openai.image('gpt-image-1'),
2553
+ model: openai.image('gpt-image-1.5'),
2554
2554
  prompt: {
2555
2555
  text: 'do not change anything',
2556
2556
  images: [imageBuffer],
@@ -2566,7 +2566,7 @@ const { images } = await generateImage({
2566
2566
 
2567
2567
  #### Multi-Image Combining
2568
2568
 
2569
- Combine multiple reference images into a single output. `gpt-image-1` supports up to 16 input images:
2569
+ Combine multiple reference images into a single output. `gpt-image-*` models support up to 16 input images:
2570
2570
 
2571
2571
  ```ts
2572
2572
  const cat = readFileSync('./cat.png');
@@ -2575,7 +2575,7 @@ const owl = readFileSync('./owl.png');
2575
2575
  const bear = readFileSync('./bear.png');
2576
2576
 
2577
2577
  const { images } = await generateImage({
2578
- model: openai.image('gpt-image-1'),
2578
+ model: openai.image('gpt-image-2'),
2579
2579
  prompt: {
2580
2580
  text: 'Combine these animals into a group photo, retaining the original style',
2581
2581
  images: [cat, dog, owl, bear],
@@ -2585,28 +2585,29 @@ const { images } = await generateImage({
2585
2585
 
2586
2586
  <Note>
2587
2587
  Input images can be provided as `Buffer`, `ArrayBuffer`, `Uint8Array`, or
2588
- base64-encoded strings. For `gpt-image-1`, each image should be a `png`,
2589
- `webp`, or `jpg` file less than 50MB.
2588
+ base64-encoded strings. For `gpt-image-*` models, each image should be a
2589
+ `png`, `webp`, or `jpg` file less than 50MB.
2590
2590
  </Note>
2591
2591
 
2592
2592
  ### Model Capabilities
2593
2593
 
2594
2594
  | Model | Sizes |
2595
2595
  | ------------------ | ------------------------------- |
2596
+ | `gpt-image-2` | 1024x1024, 1536x1024, 1024x1536 |
2596
2597
  | `gpt-image-1.5` | 1024x1024, 1536x1024, 1024x1536 |
2597
2598
  | `gpt-image-1-mini` | 1024x1024, 1536x1024, 1024x1536 |
2598
2599
  | `gpt-image-1` | 1024x1024, 1536x1024, 1024x1536 |
2599
2600
  | `dall-e-3` | 1024x1024, 1792x1024, 1024x1792 |
2600
2601
  | `dall-e-2` | 256x256, 512x512, 1024x1024 |
2601
2602
 
2602
- You can pass optional `providerOptions` to the image model. These are prone to change by OpenAI and are model dependent. For example, the `gpt-image-1` model supports the `quality` option:
2603
+ You can pass optional `providerOptions` to the image model. These are prone to change by OpenAI and are model dependent. For example, the `gpt-image-*` models support the `quality` option:
2603
2604
 
2604
2605
  ```ts
2605
2606
  import { openai, type OpenAIImageModelGenerationOptions } from '@ai-sdk/openai';
2606
2607
  import { generateImage } from 'ai';
2607
2608
 
2608
2609
  const { image, providerMetadata } = await generateImage({
2609
- model: openai.image('gpt-image-1.5'),
2610
+ model: openai.image('gpt-image-2'),
2610
2611
  prompt: 'A salamander at sunrise in a forest pond in the Seychelles.',
2611
2612
  providerOptions: {
2612
2613
  openai: { quality: 'high' } satisfies OpenAIImageModelGenerationOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/openai",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider-utils": "5.0.0",
39
- "@ai-sdk/provider": "4.0.0"
38
+ "@ai-sdk/provider": "4.0.0",
39
+ "@ai-sdk/provider-utils": "5.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "22.19.19",
@@ -43,6 +43,7 @@ export type OpenAIResponsesInputItem =
43
43
 
44
44
  export type OpenAIResponsesIncludeValue =
45
45
  | 'web_search_call.action.sources'
46
+ | 'web_search_call.results'
46
47
  | 'code_interpreter_call.outputs'
47
48
  | 'computer_call_output.output.image_url'
48
49
  | 'file_search_call.results'
@@ -156,13 +156,14 @@ export const openaiLanguageModelResponsesOptionsSchema = lazySchema(() =>
156
156
 
157
157
  /**
158
158
  * The set of extra fields to include in the response (advanced, usually not needed).
159
- * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
159
+ * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
160
160
  */
161
161
  include: z
162
162
  .array(
163
163
  z.enum([
164
164
  'reasoning.encrypted_content', // handled internally by default, only needed for unknown reasoning models
165
165
  'file_search_call.results',
166
+ 'web_search_call.results',
166
167
  'message.output_text.logprobs',
167
168
  ]),
168
169
  )