@ai-sdk/openai 4.0.61 → 4.0.62
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +8 -7
- package/dist/internal/index.js +4 -3
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +24 -1
- package/package.json +1 -1
- package/src/image/openai-image-model-options.ts +3 -2
- package/src/openai-tools.ts +1 -1
- package/src/responses/openai-responses-api.ts +1 -1
- package/src/tool/image-generation.ts +6 -3
package/docs/03-openai.mdx
CHANGED
|
@@ -827,6 +827,16 @@ for await (const part of result.stream) {
|
|
|
827
827
|
setting `store: false`.
|
|
828
828
|
</Note>
|
|
829
829
|
|
|
830
|
+
To use `xhigh` or `max` quality, select `gpt-image-2.5-flare` or
|
|
831
|
+
`gpt-image-2.5-sunburst` as the image generation tool's model:
|
|
832
|
+
|
|
833
|
+
```ts
|
|
834
|
+
openai.tools.imageGeneration({
|
|
835
|
+
model: 'gpt-image-2.5-flare',
|
|
836
|
+
quality: 'xhigh',
|
|
837
|
+
});
|
|
838
|
+
```
|
|
839
|
+
|
|
830
840
|
For complete details on model availability, image quality controls, supported sizes, and tool-specific parameters,
|
|
831
841
|
refer to the OpenAI documentation:
|
|
832
842
|
|
|
@@ -3086,6 +3096,19 @@ const { image, providerMetadata } = await generateImage({
|
|
|
3086
3096
|
});
|
|
3087
3097
|
```
|
|
3088
3098
|
|
|
3099
|
+
The `gpt-image-2.5-flare` and `gpt-image-2.5-sunburst` models also support
|
|
3100
|
+
`quality: 'xhigh'` and `quality: 'max'` for both image generation and editing:
|
|
3101
|
+
|
|
3102
|
+
```ts
|
|
3103
|
+
const { image } = await generateImage({
|
|
3104
|
+
model: openai.image('gpt-image-2.5-sunburst'),
|
|
3105
|
+
prompt: 'A salamander at sunrise in a forest pond in the Seychelles.',
|
|
3106
|
+
providerOptions: {
|
|
3107
|
+
openai: { quality: 'max' } satisfies OpenAIImageModelGenerationOptions,
|
|
3108
|
+
},
|
|
3109
|
+
});
|
|
3110
|
+
```
|
|
3111
|
+
|
|
3089
3112
|
For more on `generateImage()` see [Image Generation](/docs/ai-sdk-core/image-generation).
|
|
3090
3113
|
|
|
3091
3114
|
OpenAI's image models return additional metadata in the response that can be
|
|
@@ -3098,7 +3121,7 @@ is available:
|
|
|
3098
3121
|
- `revisedPrompt` _string_ - The revised prompt that was actually used to generate the image (OpenAI may modify your prompt for safety or clarity)
|
|
3099
3122
|
- `created` _number_ - The Unix timestamp (in seconds) of when the image was created
|
|
3100
3123
|
- `size` _string_ - The size of the generated image. One of `1024x1024`, `1024x1536`, or `1536x1024`
|
|
3101
|
-
- `quality` _string_ - The quality of the generated image. One of `low`, `medium`, or `
|
|
3124
|
+
- `quality` _string_ - The quality of the generated image. One of `low`, `medium`, `high`, `xhigh`, or `max`
|
|
3102
3125
|
- `background` _string_ - The background parameter used for the image generation. Either `transparent` or `opaque`
|
|
3103
3126
|
- `outputFormat` _string_ - The output format of the generated image. One of `png`, `webp`, or `jpeg`
|
|
3104
3127
|
|
package/package.json
CHANGED
|
@@ -45,10 +45,11 @@ const baseImageModelOptionsObject = z.object({
|
|
|
45
45
|
/**
|
|
46
46
|
* Quality of the generated image(s).
|
|
47
47
|
*
|
|
48
|
-
* Valid values: `standard`, `hd`, `low`, `medium`, `high`, `auto`.
|
|
48
|
+
* Valid values: `standard`, `hd`, `low`, `medium`, `high`, `xhigh`, `max`, `auto`.
|
|
49
|
+
* `xhigh` and `max` are supported by GPT Image 2.5 models.
|
|
49
50
|
*/
|
|
50
51
|
quality: z
|
|
51
|
-
.enum(['standard', 'hd', 'low', 'medium', 'high', 'auto'])
|
|
52
|
+
.enum(['standard', 'hd', 'low', 'medium', 'high', 'xhigh', 'max', 'auto'])
|
|
52
53
|
.optional(),
|
|
53
54
|
|
|
54
55
|
/**
|
package/src/openai-tools.ts
CHANGED
|
@@ -77,7 +77,7 @@ export const openaiTools = {
|
|
|
77
77
|
* @param outputCompression - Compression level for the output image (0-100).
|
|
78
78
|
* @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
|
|
79
79
|
* @param partialImages - Number of partial images to generate in streaming mode (0-3).
|
|
80
|
-
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or '
|
|
80
|
+
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', 'high', 'xhigh', or 'max'. 'xhigh' and 'max' require a GPT Image 2.5 model.
|
|
81
81
|
* @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
|
|
82
82
|
*/
|
|
83
83
|
imageGeneration,
|
|
@@ -626,7 +626,7 @@ export type OpenAIResponsesTool =
|
|
|
626
626
|
output_compression: number | undefined;
|
|
627
627
|
output_format: 'png' | 'jpeg' | 'webp' | undefined;
|
|
628
628
|
partial_images: number | undefined;
|
|
629
|
-
quality: 'auto' | 'low' | 'medium' | 'high' | undefined;
|
|
629
|
+
quality: 'auto' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | undefined;
|
|
630
630
|
size:
|
|
631
631
|
| 'auto'
|
|
632
632
|
| '1024x1024'
|
|
@@ -23,7 +23,9 @@ export const imageGenerationArgsSchema = lazySchema(() =>
|
|
|
23
23
|
outputCompression: z.number().int().min(0).max(100).optional(),
|
|
24
24
|
outputFormat: z.enum(['png', 'jpeg', 'webp']).optional(),
|
|
25
25
|
partialImages: z.number().int().min(0).max(3).optional(),
|
|
26
|
-
quality: z
|
|
26
|
+
quality: z
|
|
27
|
+
.enum(['auto', 'low', 'medium', 'high', 'xhigh', 'max'])
|
|
28
|
+
.optional(),
|
|
27
29
|
size: z
|
|
28
30
|
.union([
|
|
29
31
|
z.enum(['1024x1024', '1024x1536', '1536x1024', 'auto']),
|
|
@@ -101,9 +103,10 @@ type ImageGenerationArgs = {
|
|
|
101
103
|
|
|
102
104
|
/**
|
|
103
105
|
* The quality of the generated image.
|
|
104
|
-
* One of low, medium, high, or auto. Default: auto.
|
|
106
|
+
* One of low, medium, high, xhigh, max, or auto. Default: auto.
|
|
107
|
+
* xhigh and max are supported by GPT Image 2.5 models.
|
|
105
108
|
*/
|
|
106
|
-
quality?: 'auto' | 'low' | 'medium' | 'high';
|
|
109
|
+
quality?: 'auto' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
107
110
|
|
|
108
111
|
/**
|
|
109
112
|
* The size of the generated image.
|