@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.
- package/CHANGELOG.md +7 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +17 -10
- package/dist/internal/index.js +11 -4
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +4 -2
- package/package.json +1 -1
- package/src/chat/openai-chat-language-model-options.ts +2 -1
- package/src/responses/openai-responses-api.ts +9 -2
- package/src/responses/openai-responses-language-model-options.ts +2 -1
- package/src/responses/openai-responses-prepare-tools.ts +1 -0
- package/src/tool/image-generation.ts +16 -6
package/dist/internal/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<
|
|
|
15
15
|
store?: boolean | undefined;
|
|
16
16
|
metadata?: Record<string, string> | undefined;
|
|
17
17
|
prediction?: Record<string, any> | undefined;
|
|
18
|
-
serviceTier?: "default" | "auto" | "flex" | "priority" | "fast" | undefined;
|
|
18
|
+
serviceTier?: "default" | "auto" | "flex" | "priority" | "fast" | "ultrafast" | undefined;
|
|
19
19
|
strictJsonSchema?: boolean | undefined;
|
|
20
20
|
textVerbosity?: "low" | "medium" | "high" | undefined;
|
|
21
21
|
promptCacheKey?: string | undefined;
|
|
@@ -763,6 +763,7 @@ type OpenAIResponsesTool = OpenAIResponsesFunctionTool | {
|
|
|
763
763
|
filters: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter | undefined;
|
|
764
764
|
} | {
|
|
765
765
|
type: 'image_generation';
|
|
766
|
+
action: 'generate' | 'edit' | 'auto' | undefined;
|
|
766
767
|
background: 'auto' | 'opaque' | 'transparent' | undefined;
|
|
767
768
|
input_fidelity: 'low' | 'high' | undefined;
|
|
768
769
|
input_image_mask: {
|
|
@@ -770,12 +771,12 @@ type OpenAIResponsesTool = OpenAIResponsesFunctionTool | {
|
|
|
770
771
|
image_url: string | undefined;
|
|
771
772
|
} | undefined;
|
|
772
773
|
model: string | undefined;
|
|
773
|
-
moderation: 'auto' | undefined;
|
|
774
|
+
moderation: 'auto' | 'low' | undefined;
|
|
774
775
|
output_compression: number | undefined;
|
|
775
776
|
output_format: 'png' | 'jpeg' | 'webp' | undefined;
|
|
776
777
|
partial_images: number | undefined;
|
|
777
778
|
quality: 'auto' | 'low' | 'medium' | 'high' | undefined;
|
|
778
|
-
size: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | undefined;
|
|
779
|
+
size: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | (string & {}) | undefined;
|
|
779
780
|
}
|
|
780
781
|
/**
|
|
781
782
|
* Official OpenAI API Specifications: https://platform.openai.com/docs/api-reference/responses/create#responses_create-tools-mcp_tool
|
|
@@ -1870,7 +1871,7 @@ declare class OpenAIResponsesLanguageModel implements LanguageModelV4 {
|
|
|
1870
1871
|
store: boolean | null | undefined;
|
|
1871
1872
|
user: string | null | undefined;
|
|
1872
1873
|
instructions: string | null | undefined;
|
|
1873
|
-
service_tier: "default" | "auto" | "flex" | "priority" | "fast" | null | undefined;
|
|
1874
|
+
service_tier: "default" | "auto" | "flex" | "priority" | "fast" | "ultrafast" | null | undefined;
|
|
1874
1875
|
include: OpenAIResponsesIncludeOptions;
|
|
1875
1876
|
prompt_cache_key: string | null | undefined;
|
|
1876
1877
|
prompt_cache_options: {
|
|
@@ -2261,6 +2262,7 @@ declare const fileSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{},
|
|
|
2261
2262
|
}, {}>;
|
|
2262
2263
|
|
|
2263
2264
|
declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
2265
|
+
action?: "auto" | "generate" | "edit" | undefined;
|
|
2264
2266
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
2265
2267
|
inputFidelity?: "low" | "high" | undefined;
|
|
2266
2268
|
inputImageMask?: {
|
|
@@ -2268,17 +2270,21 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
2268
2270
|
imageUrl?: string | undefined;
|
|
2269
2271
|
} | undefined;
|
|
2270
2272
|
model?: string | undefined;
|
|
2271
|
-
moderation?: "auto" | undefined;
|
|
2273
|
+
moderation?: "auto" | "low" | undefined;
|
|
2272
2274
|
outputCompression?: number | undefined;
|
|
2273
2275
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
2274
2276
|
partialImages?: number | undefined;
|
|
2275
2277
|
quality?: "auto" | "low" | "medium" | "high" | undefined;
|
|
2276
|
-
size?:
|
|
2278
|
+
size?: string | undefined;
|
|
2277
2279
|
}>;
|
|
2278
2280
|
declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
2279
2281
|
result: string;
|
|
2280
2282
|
}>;
|
|
2281
2283
|
type ImageGenerationArgs = {
|
|
2284
|
+
/**
|
|
2285
|
+
* Whether to generate a new image or edit an existing image. Default: auto.
|
|
2286
|
+
*/
|
|
2287
|
+
action?: 'generate' | 'edit' | 'auto';
|
|
2282
2288
|
/**
|
|
2283
2289
|
* Background type for the generated image. Default is 'auto'.
|
|
2284
2290
|
*/
|
|
@@ -2306,9 +2312,9 @@ type ImageGenerationArgs = {
|
|
|
2306
2312
|
*/
|
|
2307
2313
|
model?: string;
|
|
2308
2314
|
/**
|
|
2309
|
-
* Moderation level for the generated image. Default: auto.
|
|
2315
|
+
* Moderation level for the generated image. One of auto or low. Default: auto.
|
|
2310
2316
|
*/
|
|
2311
|
-
moderation?: 'auto';
|
|
2317
|
+
moderation?: 'auto' | 'low';
|
|
2312
2318
|
/**
|
|
2313
2319
|
* Compression level for the output image. Default: 100.
|
|
2314
2320
|
*/
|
|
@@ -2329,10 +2335,11 @@ type ImageGenerationArgs = {
|
|
|
2329
2335
|
quality?: 'auto' | 'low' | 'medium' | 'high';
|
|
2330
2336
|
/**
|
|
2331
2337
|
* The size of the generated image.
|
|
2332
|
-
* One of 1024x1024, 1024x1536, 1536x1024, or auto.
|
|
2338
|
+
* One of 1024x1024, 1024x1536, 1536x1024, or auto. gpt-image-2 also accepts
|
|
2339
|
+
* arbitrary WIDTHxHEIGHT sizes where both are divisible by 16, e.g. 1536x864.
|
|
2333
2340
|
* Default: auto.
|
|
2334
2341
|
*/
|
|
2335
|
-
size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
|
|
2342
|
+
size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | (string & {});
|
|
2336
2343
|
};
|
|
2337
2344
|
declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_utils.ProviderExecutedTool<{}, {
|
|
2338
2345
|
/**
|
package/dist/internal/index.js
CHANGED
|
@@ -828,11 +828,12 @@ var openaiLanguageModelChatOptions = lazySchema2(
|
|
|
828
828
|
* - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
|
|
829
829
|
* - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
|
|
830
830
|
* - 'fast': OpenAI's newer name for the 'priority' tier. Interchangeable with it.
|
|
831
|
+
* - 'ultrafast': Access-controlled Ultrafast processing. Only available for gpt-5.6-sol.
|
|
831
832
|
* - 'default': The request will be processed with the standard pricing and performance for the selected model.
|
|
832
833
|
*
|
|
833
834
|
* @default 'auto'
|
|
834
835
|
*/
|
|
835
|
-
serviceTier: z3.enum(["auto", "flex", "priority", "fast", "default"]).optional(),
|
|
836
|
+
serviceTier: z3.enum(["auto", "flex", "priority", "fast", "ultrafast", "default"]).optional(),
|
|
836
837
|
/**
|
|
837
838
|
* Whether to use strict JSON schema validation.
|
|
838
839
|
*
|
|
@@ -5968,10 +5969,11 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
5968
5969
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
5969
5970
|
* 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).
|
|
5970
5971
|
* Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
|
|
5972
|
+
* Set to 'ultrafast' for access-controlled Ultrafast processing (available only for gpt-5.6-sol).
|
|
5971
5973
|
*
|
|
5972
5974
|
* Defaults to 'auto'.
|
|
5973
5975
|
*/
|
|
5974
|
-
serviceTier: z21.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
|
|
5976
|
+
serviceTier: z21.enum(["auto", "flex", "priority", "fast", "ultrafast", "default"]).nullish(),
|
|
5975
5977
|
/**
|
|
5976
5978
|
* Whether to store the generation. Defaults to `true`.
|
|
5977
5979
|
*/
|
|
@@ -6178,6 +6180,7 @@ import { z as z24 } from "zod/v4";
|
|
|
6178
6180
|
var imageGenerationArgsSchema = lazySchema22(
|
|
6179
6181
|
() => zodSchema22(
|
|
6180
6182
|
z24.object({
|
|
6183
|
+
action: z24.enum(["generate", "edit", "auto"]).optional(),
|
|
6181
6184
|
background: z24.enum(["auto", "opaque", "transparent"]).optional(),
|
|
6182
6185
|
inputFidelity: z24.enum(["low", "high"]).optional(),
|
|
6183
6186
|
inputImageMask: z24.object({
|
|
@@ -6185,12 +6188,15 @@ var imageGenerationArgsSchema = lazySchema22(
|
|
|
6185
6188
|
imageUrl: z24.string().optional()
|
|
6186
6189
|
}).optional(),
|
|
6187
6190
|
model: z24.string().optional(),
|
|
6188
|
-
moderation: z24.enum(["auto"]).optional(),
|
|
6191
|
+
moderation: z24.enum(["auto", "low"]).optional(),
|
|
6189
6192
|
outputCompression: z24.number().int().min(0).max(100).optional(),
|
|
6190
6193
|
outputFormat: z24.enum(["png", "jpeg", "webp"]).optional(),
|
|
6191
6194
|
partialImages: z24.number().int().min(0).max(3).optional(),
|
|
6192
6195
|
quality: z24.enum(["auto", "low", "medium", "high"]).optional(),
|
|
6193
|
-
size: z24.
|
|
6196
|
+
size: z24.union([
|
|
6197
|
+
z24.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]),
|
|
6198
|
+
z24.string().regex(/^\d+x\d+$/)
|
|
6199
|
+
]).optional()
|
|
6194
6200
|
}).strict()
|
|
6195
6201
|
)
|
|
6196
6202
|
);
|
|
@@ -6594,6 +6600,7 @@ async function prepareResponsesTools({
|
|
|
6594
6600
|
});
|
|
6595
6601
|
openaiTools.push({
|
|
6596
6602
|
type: "image_generation",
|
|
6603
|
+
action: args.action,
|
|
6597
6604
|
background: args.background,
|
|
6598
6605
|
input_fidelity: args.inputFidelity,
|
|
6599
6606
|
input_image_mask: args.inputImageMask ? {
|