@ai-sdk/openai 2.0.114 → 2.0.116

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.
@@ -122,7 +122,8 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
122
122
 
123
123
  type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | (string & {});
124
124
  declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
125
- declare const hasDefaultResponseFormat: Set<string>;
125
+ declare function hasDefaultResponseFormat(modelId: string): boolean;
126
+ declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
126
127
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
127
128
  quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
128
129
  background?: "auto" | "transparent" | "opaque" | undefined;
@@ -499,6 +500,195 @@ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_
499
500
  result: string;
500
501
  }>;
501
502
 
503
+ declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
504
+ externalWebAccess?: boolean | undefined;
505
+ filters?: {
506
+ allowedDomains?: string[] | undefined;
507
+ blockedDomains?: string[] | undefined;
508
+ } | undefined;
509
+ searchContextSize?: "low" | "medium" | "high" | undefined;
510
+ userLocation?: {
511
+ type: "approximate";
512
+ country?: string | undefined;
513
+ city?: string | undefined;
514
+ region?: string | undefined;
515
+ timezone?: string | undefined;
516
+ } | undefined;
517
+ }>;
518
+ declare const webSearchOutputSchema: _ai_sdk_provider_utils.LazySchema<{
519
+ action?: {
520
+ type: "search";
521
+ query?: string | undefined;
522
+ } | {
523
+ type: "openPage";
524
+ url?: string | null | undefined;
525
+ } | {
526
+ type: "findInPage";
527
+ url?: string | null | undefined;
528
+ pattern?: string | null | undefined;
529
+ } | undefined;
530
+ sources?: ({
531
+ type: "url";
532
+ url: string;
533
+ } | {
534
+ type: "api";
535
+ name: string;
536
+ })[] | undefined;
537
+ }>;
538
+ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
539
+ /**
540
+ * An object describing the specific action taken in this web search call.
541
+ * Includes details on how the model used the web (search, open_page, findInPage).
542
+ */
543
+ action?: {
544
+ /**
545
+ * Action type "search" - Performs a web search query.
546
+ */
547
+ type: "search";
548
+ /**
549
+ * The search query.
550
+ */
551
+ query?: string;
552
+ } | {
553
+ /**
554
+ * Action type "openPage" - Opens a specific URL from search results.
555
+ */
556
+ type: "openPage";
557
+ /**
558
+ * The URL opened by the model.
559
+ */
560
+ url?: string | null;
561
+ } | {
562
+ /**
563
+ * Action type "findInPage": Searches for a pattern within a loaded page.
564
+ */
565
+ type: "findInPage";
566
+ /**
567
+ * The URL of the page searched for the pattern.
568
+ */
569
+ url?: string | null;
570
+ /**
571
+ * The pattern or text to search for within the page.
572
+ */
573
+ pattern?: string | null;
574
+ };
575
+ /**
576
+ * Optional sources cited by the model for the web search call.
577
+ */
578
+ sources?: Array<{
579
+ type: "url";
580
+ url: string;
581
+ } | {
582
+ type: "api";
583
+ name: string;
584
+ }>;
585
+ }, {
586
+ /**
587
+ * Whether to use external web access for fetching live content.
588
+ * - true: Fetch live web content (default)
589
+ * - false: Use cached/indexed results
590
+ */
591
+ externalWebAccess?: boolean;
592
+ /**
593
+ * Filters for the search.
594
+ */
595
+ filters?: {
596
+ /**
597
+ * Allowed domains for the search.
598
+ * If not provided, all domains are allowed.
599
+ * Subdomains of the provided domains are allowed as well.
600
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
601
+ */
602
+ allowedDomains?: string[];
603
+ /**
604
+ * Blocked domains for the search.
605
+ * Subdomains of the provided domains are blocked as well.
606
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
607
+ */
608
+ blockedDomains?: string[];
609
+ };
610
+ /**
611
+ * Search context size to use for the web search.
612
+ * - high: Most comprehensive context, highest cost, slower response
613
+ * - medium: Balanced context, cost, and latency (default)
614
+ * - low: Least context, lowest cost, fastest response
615
+ */
616
+ searchContextSize?: "low" | "medium" | "high";
617
+ /**
618
+ * User location information to provide geographically relevant search results.
619
+ */
620
+ userLocation?: {
621
+ /**
622
+ * Type of location (always 'approximate')
623
+ */
624
+ type: "approximate";
625
+ /**
626
+ * Two-letter ISO country code (e.g., 'US', 'GB')
627
+ */
628
+ country?: string;
629
+ /**
630
+ * City name (free text, e.g., 'Minneapolis')
631
+ */
632
+ city?: string;
633
+ /**
634
+ * Region name (free text, e.g., 'Minnesota')
635
+ */
636
+ region?: string;
637
+ /**
638
+ * IANA timezone (e.g., 'America/Chicago')
639
+ */
640
+ timezone?: string;
641
+ };
642
+ }>;
643
+ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
644
+ /**
645
+ * An object describing the specific action taken in this web search call.
646
+ * Includes details on how the model used the web (search, open_page, findInPage).
647
+ */
648
+ action?: {
649
+ /**
650
+ * Action type "search" - Performs a web search query.
651
+ */
652
+ type: "search";
653
+ /**
654
+ * The search query.
655
+ */
656
+ query?: string;
657
+ } | {
658
+ /**
659
+ * Action type "openPage" - Opens a specific URL from search results.
660
+ */
661
+ type: "openPage";
662
+ /**
663
+ * The URL opened by the model.
664
+ */
665
+ url?: string | null;
666
+ } | {
667
+ /**
668
+ * Action type "findInPage": Searches for a pattern within a loaded page.
669
+ */
670
+ type: "findInPage";
671
+ /**
672
+ * The URL of the page searched for the pattern.
673
+ */
674
+ url?: string | null;
675
+ /**
676
+ * The pattern or text to search for within the page.
677
+ */
678
+ pattern?: string | null;
679
+ };
680
+ /**
681
+ * Optional sources cited by the model for the web search call.
682
+ */
683
+ sources?: Array<{
684
+ type: "url";
685
+ url: string;
686
+ } | {
687
+ type: "api";
688
+ name: string;
689
+ }>;
690
+ }>;
691
+
502
692
  declare const webSearchPreviewArgsSchema: _ai_sdk_provider_utils.LazySchema<{
503
693
  searchContextSize?: "low" | "medium" | "high" | undefined;
504
694
  userLocation?: {
@@ -582,4 +772,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactor
582
772
  };
583
773
  }>;
584
774
 
585
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiSpeechProviderOptionsSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema };
775
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiSpeechProviderOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -122,7 +122,8 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
122
122
 
123
123
  type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | (string & {});
124
124
  declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
125
- declare const hasDefaultResponseFormat: Set<string>;
125
+ declare function hasDefaultResponseFormat(modelId: string): boolean;
126
+ declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
126
127
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
127
128
  quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
128
129
  background?: "auto" | "transparent" | "opaque" | undefined;
@@ -499,6 +500,195 @@ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_
499
500
  result: string;
500
501
  }>;
501
502
 
503
+ declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
504
+ externalWebAccess?: boolean | undefined;
505
+ filters?: {
506
+ allowedDomains?: string[] | undefined;
507
+ blockedDomains?: string[] | undefined;
508
+ } | undefined;
509
+ searchContextSize?: "low" | "medium" | "high" | undefined;
510
+ userLocation?: {
511
+ type: "approximate";
512
+ country?: string | undefined;
513
+ city?: string | undefined;
514
+ region?: string | undefined;
515
+ timezone?: string | undefined;
516
+ } | undefined;
517
+ }>;
518
+ declare const webSearchOutputSchema: _ai_sdk_provider_utils.LazySchema<{
519
+ action?: {
520
+ type: "search";
521
+ query?: string | undefined;
522
+ } | {
523
+ type: "openPage";
524
+ url?: string | null | undefined;
525
+ } | {
526
+ type: "findInPage";
527
+ url?: string | null | undefined;
528
+ pattern?: string | null | undefined;
529
+ } | undefined;
530
+ sources?: ({
531
+ type: "url";
532
+ url: string;
533
+ } | {
534
+ type: "api";
535
+ name: string;
536
+ })[] | undefined;
537
+ }>;
538
+ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
539
+ /**
540
+ * An object describing the specific action taken in this web search call.
541
+ * Includes details on how the model used the web (search, open_page, findInPage).
542
+ */
543
+ action?: {
544
+ /**
545
+ * Action type "search" - Performs a web search query.
546
+ */
547
+ type: "search";
548
+ /**
549
+ * The search query.
550
+ */
551
+ query?: string;
552
+ } | {
553
+ /**
554
+ * Action type "openPage" - Opens a specific URL from search results.
555
+ */
556
+ type: "openPage";
557
+ /**
558
+ * The URL opened by the model.
559
+ */
560
+ url?: string | null;
561
+ } | {
562
+ /**
563
+ * Action type "findInPage": Searches for a pattern within a loaded page.
564
+ */
565
+ type: "findInPage";
566
+ /**
567
+ * The URL of the page searched for the pattern.
568
+ */
569
+ url?: string | null;
570
+ /**
571
+ * The pattern or text to search for within the page.
572
+ */
573
+ pattern?: string | null;
574
+ };
575
+ /**
576
+ * Optional sources cited by the model for the web search call.
577
+ */
578
+ sources?: Array<{
579
+ type: "url";
580
+ url: string;
581
+ } | {
582
+ type: "api";
583
+ name: string;
584
+ }>;
585
+ }, {
586
+ /**
587
+ * Whether to use external web access for fetching live content.
588
+ * - true: Fetch live web content (default)
589
+ * - false: Use cached/indexed results
590
+ */
591
+ externalWebAccess?: boolean;
592
+ /**
593
+ * Filters for the search.
594
+ */
595
+ filters?: {
596
+ /**
597
+ * Allowed domains for the search.
598
+ * If not provided, all domains are allowed.
599
+ * Subdomains of the provided domains are allowed as well.
600
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
601
+ */
602
+ allowedDomains?: string[];
603
+ /**
604
+ * Blocked domains for the search.
605
+ * Subdomains of the provided domains are blocked as well.
606
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
607
+ */
608
+ blockedDomains?: string[];
609
+ };
610
+ /**
611
+ * Search context size to use for the web search.
612
+ * - high: Most comprehensive context, highest cost, slower response
613
+ * - medium: Balanced context, cost, and latency (default)
614
+ * - low: Least context, lowest cost, fastest response
615
+ */
616
+ searchContextSize?: "low" | "medium" | "high";
617
+ /**
618
+ * User location information to provide geographically relevant search results.
619
+ */
620
+ userLocation?: {
621
+ /**
622
+ * Type of location (always 'approximate')
623
+ */
624
+ type: "approximate";
625
+ /**
626
+ * Two-letter ISO country code (e.g., 'US', 'GB')
627
+ */
628
+ country?: string;
629
+ /**
630
+ * City name (free text, e.g., 'Minneapolis')
631
+ */
632
+ city?: string;
633
+ /**
634
+ * Region name (free text, e.g., 'Minnesota')
635
+ */
636
+ region?: string;
637
+ /**
638
+ * IANA timezone (e.g., 'America/Chicago')
639
+ */
640
+ timezone?: string;
641
+ };
642
+ }>;
643
+ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
644
+ /**
645
+ * An object describing the specific action taken in this web search call.
646
+ * Includes details on how the model used the web (search, open_page, findInPage).
647
+ */
648
+ action?: {
649
+ /**
650
+ * Action type "search" - Performs a web search query.
651
+ */
652
+ type: "search";
653
+ /**
654
+ * The search query.
655
+ */
656
+ query?: string;
657
+ } | {
658
+ /**
659
+ * Action type "openPage" - Opens a specific URL from search results.
660
+ */
661
+ type: "openPage";
662
+ /**
663
+ * The URL opened by the model.
664
+ */
665
+ url?: string | null;
666
+ } | {
667
+ /**
668
+ * Action type "findInPage": Searches for a pattern within a loaded page.
669
+ */
670
+ type: "findInPage";
671
+ /**
672
+ * The URL of the page searched for the pattern.
673
+ */
674
+ url?: string | null;
675
+ /**
676
+ * The pattern or text to search for within the page.
677
+ */
678
+ pattern?: string | null;
679
+ };
680
+ /**
681
+ * Optional sources cited by the model for the web search call.
682
+ */
683
+ sources?: Array<{
684
+ type: "url";
685
+ url: string;
686
+ } | {
687
+ type: "api";
688
+ name: string;
689
+ }>;
690
+ }>;
691
+
502
692
  declare const webSearchPreviewArgsSchema: _ai_sdk_provider_utils.LazySchema<{
503
693
  searchContextSize?: "low" | "medium" | "high" | undefined;
504
694
  userLocation?: {
@@ -582,4 +772,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactor
582
772
  };
583
773
  }>;
584
774
 
585
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiSpeechProviderOptionsSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema };
775
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiSpeechProviderOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -35,6 +35,7 @@ __export(index_exports, {
35
35
  fileSearch: () => fileSearch,
36
36
  fileSearchArgsSchema: () => fileSearchArgsSchema,
37
37
  fileSearchOutputSchema: () => fileSearchOutputSchema,
38
+ getMaxImagesPerCall: () => getMaxImagesPerCall,
38
39
  hasDefaultResponseFormat: () => hasDefaultResponseFormat,
39
40
  imageGeneration: () => imageGeneration,
40
41
  imageGenerationArgsSchema: () => imageGenerationArgsSchema,
@@ -47,9 +48,13 @@ __export(index_exports, {
47
48
  openaiImageModelGenerationOptions: () => openaiImageModelGenerationOptions,
48
49
  openaiImageModelOptions: () => openaiImageModelOptions,
49
50
  openaiSpeechProviderOptionsSchema: () => openaiSpeechProviderOptionsSchema,
51
+ webSearch: () => webSearch,
52
+ webSearchArgsSchema: () => webSearchArgsSchema,
53
+ webSearchOutputSchema: () => webSearchOutputSchema,
50
54
  webSearchPreview: () => webSearchPreview,
51
55
  webSearchPreviewArgsSchema: () => webSearchPreviewArgsSchema,
52
- webSearchPreviewInputSchema: () => webSearchPreviewInputSchema
56
+ webSearchPreviewInputSchema: () => webSearchPreviewInputSchema,
57
+ webSearchToolFactory: () => webSearchToolFactory
53
58
  });
54
59
  module.exports = __toCommonJS(index_exports);
55
60
 
@@ -78,10 +83,15 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
78
83
 
79
84
  // src/openai-language-model-capabilities.ts
80
85
  function getOpenAILanguageModelCapabilities(modelId) {
81
- const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
82
- const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
83
- const isReasoningModel = !(modelId.startsWith("gpt-3") || modelId.startsWith("gpt-4") || modelId.startsWith("chatgpt-4o") || modelId.startsWith("gpt-5-chat"));
84
- const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4") || modelId.startsWith("gpt-5.6");
86
+ var _a, _b, _c, _d, _e;
87
+ const oSeriesVersion = getOSeriesVersion(modelId);
88
+ const gptVersion = getGptVersion(modelId);
89
+ const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a.startsWith("chat")) != null ? _b : false);
90
+ const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
91
+ const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
92
+ const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
93
+ const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel || modelId === "codex-mini-latest" || modelId === "computer-use-preview";
94
+ const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
85
95
  const systemMessageMode = isReasoningModel ? "developer" : "system";
86
96
  return {
87
97
  supportsFlexProcessing,
@@ -91,6 +101,21 @@ function getOpenAILanguageModelCapabilities(modelId) {
91
101
  supportsNonReasoningParameters
92
102
  };
93
103
  }
104
+ function getOSeriesVersion(modelId) {
105
+ const match = /^o(\d+)(?:-|$)/.exec(modelId);
106
+ return match == null ? void 0 : Number(match[1]);
107
+ }
108
+ function getGptVersion(modelId) {
109
+ const match = /^gpt-(\d+)(?:\.(\d+))?(?:-(.+))?$/.exec(modelId);
110
+ if (match == null) {
111
+ return void 0;
112
+ }
113
+ return {
114
+ major: Number(match[1]),
115
+ minor: match[2] == null ? void 0 : Number(match[2]),
116
+ variant: match[3]
117
+ };
118
+ }
94
119
 
95
120
  // src/chat/convert-to-openai-chat-messages.ts
96
121
  var import_provider = require("@ai-sdk/provider");
@@ -1792,12 +1817,16 @@ var modelMaxImagesPerCall = {
1792
1817
  "gpt-image-1.5": 10,
1793
1818
  "gpt-image-2": 10
1794
1819
  };
1795
- var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
1796
- "gpt-image-1",
1797
- "gpt-image-1-mini",
1798
- "gpt-image-1.5",
1799
- "gpt-image-2"
1800
- ]);
1820
+ var defaultResponseFormatPrefixes = ["gpt-image-"];
1821
+ function hasDefaultResponseFormat(modelId) {
1822
+ return defaultResponseFormatPrefixes.some(
1823
+ (prefix) => modelId.startsWith(prefix)
1824
+ );
1825
+ }
1826
+ function getMaxImagesPerCall(modelId) {
1827
+ var _a;
1828
+ return (_a = modelMaxImagesPerCall[modelId]) != null ? _a : modelId.startsWith("gpt-image-") ? 10 : 1;
1829
+ }
1801
1830
  var baseImageModelOptionsObject = import_v49.z.object({
1802
1831
  /**
1803
1832
  * Quality of the generated image(s).
@@ -1856,8 +1885,7 @@ var OpenAIImageModel = class {
1856
1885
  this.specificationVersion = "v2";
1857
1886
  }
1858
1887
  get maxImagesPerCall() {
1859
- var _a;
1860
- return (_a = modelMaxImagesPerCall[this.modelId]) != null ? _a : 1;
1888
+ return getMaxImagesPerCall(this.modelId);
1861
1889
  }
1862
1890
  get provider() {
1863
1891
  return this.config.provider;
@@ -1908,7 +1936,7 @@ var OpenAIImageModel = class {
1908
1936
  output_format: openaiOptions.outputFormat,
1909
1937
  output_compression: openaiOptions.outputCompression,
1910
1938
  user: openaiOptions.user,
1911
- ...!hasDefaultResponseFormat.has(this.modelId) ? { response_format: "b64_json" } : {}
1939
+ ...!hasDefaultResponseFormat(this.modelId) ? { response_format: "b64_json" } : {}
1912
1940
  },
1913
1941
  failedResponseHandler: openaiFailedResponseHandler,
1914
1942
  successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
@@ -3509,7 +3537,10 @@ var webSearchArgsSchema = (0, import_provider_utils26.lazySchema)(
3509
3537
  () => (0, import_provider_utils26.zodSchema)(
3510
3538
  import_v419.z.object({
3511
3539
  externalWebAccess: import_v419.z.boolean().optional(),
3512
- filters: import_v419.z.object({ allowedDomains: import_v419.z.array(import_v419.z.string()).optional() }).optional(),
3540
+ filters: import_v419.z.object({
3541
+ allowedDomains: import_v419.z.array(import_v419.z.string()).optional(),
3542
+ blockedDomains: import_v419.z.array(import_v419.z.string()).optional()
3543
+ }).optional(),
3513
3544
  searchContextSize: import_v419.z.enum(["low", "medium", "high"]).optional(),
3514
3545
  userLocation: import_v419.z.object({
3515
3546
  type: import_v419.z.literal("approximate"),
@@ -3555,6 +3586,7 @@ var webSearchToolFactory = (0, import_provider_utils26.createProviderDefinedTool
3555
3586
  inputSchema: webSearchInputSchema,
3556
3587
  outputSchema: webSearchOutputSchema
3557
3588
  });
3589
+ var webSearch = (args = {}) => webSearchToolFactory(args);
3558
3590
 
3559
3591
  // src/tool/web-search-preview.ts
3560
3592
  var import_provider_utils27 = require("@ai-sdk/provider-utils");
@@ -3708,7 +3740,10 @@ async function prepareResponsesTools({
3708
3740
  });
3709
3741
  openaiTools.push({
3710
3742
  type: "web_search",
3711
- filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
3743
+ filters: args.filters != null ? {
3744
+ allowed_domains: args.filters.allowedDomains,
3745
+ blocked_domains: args.filters.blockedDomains
3746
+ } : void 0,
3712
3747
  external_web_access: args.externalWebAccess,
3713
3748
  search_context_size: args.searchContextSize,
3714
3749
  user_location: args.userLocation
@@ -4942,6 +4977,7 @@ function getResponsesUsageMetadata(usage) {
4942
4977
  fileSearch,
4943
4978
  fileSearchArgsSchema,
4944
4979
  fileSearchOutputSchema,
4980
+ getMaxImagesPerCall,
4945
4981
  hasDefaultResponseFormat,
4946
4982
  imageGeneration,
4947
4983
  imageGenerationArgsSchema,
@@ -4954,8 +4990,12 @@ function getResponsesUsageMetadata(usage) {
4954
4990
  openaiImageModelGenerationOptions,
4955
4991
  openaiImageModelOptions,
4956
4992
  openaiSpeechProviderOptionsSchema,
4993
+ webSearch,
4994
+ webSearchArgsSchema,
4995
+ webSearchOutputSchema,
4957
4996
  webSearchPreview,
4958
4997
  webSearchPreviewArgsSchema,
4959
- webSearchPreviewInputSchema
4998
+ webSearchPreviewInputSchema,
4999
+ webSearchToolFactory
4960
5000
  });
4961
5001
  //# sourceMappingURL=index.js.map