@ai-sdk/provider 4.0.0-beta.2 → 4.0.0-beta.20

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.
Files changed (150) hide show
  1. package/CHANGELOG.md +136 -13
  2. package/dist/index.d.ts +1241 -449
  3. package/dist/index.js +53 -75
  4. package/dist/index.js.map +1 -1
  5. package/package.json +12 -12
  6. package/src/embedding-model/v2/embedding-model-v2.ts +2 -2
  7. package/src/embedding-model/v3/embedding-model-v3-call-options.ts +1 -1
  8. package/src/embedding-model/v3/embedding-model-v3-result.ts +2 -2
  9. package/src/embedding-model/v3/embedding-model-v3.ts +2 -2
  10. package/src/embedding-model/v4/embedding-model-v4-call-options.ts +1 -1
  11. package/src/embedding-model/v4/embedding-model-v4-result.ts +2 -2
  12. package/src/embedding-model/v4/embedding-model-v4.ts +2 -2
  13. package/src/embedding-model-middleware/v3/embedding-model-v3-middleware.ts +2 -2
  14. package/src/embedding-model-middleware/v4/embedding-model-v4-middleware.ts +2 -2
  15. package/src/errors/get-error-message.ts +1 -1
  16. package/src/errors/index.ts +1 -0
  17. package/src/errors/no-such-provider-reference-error.ts +35 -0
  18. package/src/files/index.ts +1 -0
  19. package/src/files/v4/files-v4-upload-file-call-options.ts +35 -0
  20. package/src/files/v4/files-v4-upload-file-result.ts +35 -0
  21. package/src/files/v4/files-v4.ts +25 -0
  22. package/src/files/v4/index.ts +3 -0
  23. package/src/image-model/v2/image-model-v2-call-options.ts +1 -1
  24. package/src/image-model/v2/image-model-v2-call-warning.ts +1 -1
  25. package/src/image-model/v2/image-model-v2.ts +3 -3
  26. package/src/image-model/v3/image-model-v3-call-options.ts +2 -2
  27. package/src/image-model/v3/image-model-v3-file.ts +1 -1
  28. package/src/image-model/v3/image-model-v3.ts +4 -4
  29. package/src/image-model/v4/image-model-v4-call-options.ts +2 -2
  30. package/src/image-model/v4/image-model-v4-file.ts +1 -1
  31. package/src/image-model/v4/image-model-v4-result.ts +73 -0
  32. package/src/image-model/v4/image-model-v4.ts +3 -70
  33. package/src/image-model/v4/index.ts +4 -3
  34. package/src/image-model-middleware/v3/image-model-v3-middleware.ts +2 -2
  35. package/src/image-model-middleware/v4/image-model-v4-middleware.ts +2 -2
  36. package/src/index.ts +3 -0
  37. package/src/json-value/is-json.ts +1 -1
  38. package/src/language-model/v2/language-model-v2-call-options.ts +6 -6
  39. package/src/language-model/v2/language-model-v2-call-warning.ts +3 -3
  40. package/src/language-model/v2/language-model-v2-content.ts +6 -6
  41. package/src/language-model/v2/language-model-v2-function-tool.ts +2 -2
  42. package/src/language-model/v2/language-model-v2-prompt.ts +3 -3
  43. package/src/language-model/v2/language-model-v2-reasoning.ts +1 -1
  44. package/src/language-model/v2/language-model-v2-source.ts +1 -1
  45. package/src/language-model/v2/language-model-v2-stream-part.ts +9 -9
  46. package/src/language-model/v2/language-model-v2-text.ts +1 -1
  47. package/src/language-model/v2/language-model-v2-tool-call.ts +1 -1
  48. package/src/language-model/v2/language-model-v2-tool-result.ts +1 -1
  49. package/src/language-model/v2/language-model-v2.ts +9 -9
  50. package/src/language-model/v3/language-model-v3-call-options.ts +6 -6
  51. package/src/language-model/v3/language-model-v3-content.ts +7 -7
  52. package/src/language-model/v3/language-model-v3-file.ts +1 -1
  53. package/src/language-model/v3/language-model-v3-function-tool.ts +3 -3
  54. package/src/language-model/v3/language-model-v3-generate-result.ts +6 -6
  55. package/src/language-model/v3/language-model-v3-prompt.ts +3 -3
  56. package/src/language-model/v3/language-model-v3-reasoning.ts +1 -1
  57. package/src/language-model/v3/language-model-v3-source.ts +1 -1
  58. package/src/language-model/v3/language-model-v3-stream-part.ts +10 -10
  59. package/src/language-model/v3/language-model-v3-stream-result.ts +2 -2
  60. package/src/language-model/v3/language-model-v3-text.ts +1 -1
  61. package/src/language-model/v3/language-model-v3-tool-approval-request.ts +1 -1
  62. package/src/language-model/v3/language-model-v3-tool-call.ts +1 -1
  63. package/src/language-model/v3/language-model-v3-tool-result.ts +2 -2
  64. package/src/language-model/v3/language-model-v3-usage.ts +1 -1
  65. package/src/language-model/v3/language-model-v3.ts +3 -3
  66. package/src/language-model/v4/index.ts +1 -1
  67. package/src/language-model/v4/language-model-v4-call-options.ts +19 -6
  68. package/src/language-model/v4/language-model-v4-content.ts +10 -8
  69. package/src/language-model/v4/language-model-v4-custom-content.ts +21 -0
  70. package/src/language-model/v4/language-model-v4-file.ts +10 -3
  71. package/src/language-model/v4/language-model-v4-function-tool.ts +3 -3
  72. package/src/language-model/v4/language-model-v4-generate-result.ts +6 -6
  73. package/src/language-model/v4/language-model-v4-prompt.ts +64 -103
  74. package/src/language-model/v4/language-model-v4-reasoning-file.ts +10 -3
  75. package/src/language-model/v4/language-model-v4-reasoning.ts +1 -1
  76. package/src/language-model/v4/language-model-v4-source.ts +1 -1
  77. package/src/language-model/v4/language-model-v4-stream-part.ts +13 -11
  78. package/src/language-model/v4/language-model-v4-stream-result.ts +2 -2
  79. package/src/language-model/v4/language-model-v4-text.ts +1 -1
  80. package/src/language-model/v4/language-model-v4-tool-approval-request.ts +1 -1
  81. package/src/language-model/v4/language-model-v4-tool-call.ts +1 -1
  82. package/src/language-model/v4/language-model-v4-tool-result.ts +2 -2
  83. package/src/language-model/v4/language-model-v4-usage.ts +1 -1
  84. package/src/language-model/v4/language-model-v4.ts +3 -3
  85. package/src/language-model-middleware/v2/language-model-v2-middleware.ts +2 -2
  86. package/src/language-model-middleware/v3/language-model-v3-middleware.ts +4 -4
  87. package/src/language-model-middleware/v4/language-model-v4-middleware.ts +4 -4
  88. package/src/provider/v2/provider-v2.ts +5 -5
  89. package/src/provider/v3/provider-v3.ts +6 -6
  90. package/src/provider/v4/provider-v4.ts +22 -6
  91. package/src/realtime-model/index.ts +1 -0
  92. package/src/realtime-model/v4/index.ts +20 -0
  93. package/src/realtime-model/v4/realtime-factory-v4.ts +20 -0
  94. package/src/realtime-model/v4/realtime-model-v4-client-event.ts +68 -0
  95. package/src/realtime-model/v4/realtime-model-v4-client-secret.ts +40 -0
  96. package/src/realtime-model/v4/realtime-model-v4-conversation-item.ts +55 -0
  97. package/src/realtime-model/v4/realtime-model-v4-server-event.ts +199 -0
  98. package/src/realtime-model/v4/realtime-model-v4-session-config.ts +142 -0
  99. package/src/realtime-model/v4/realtime-model-v4-tool-definition.ts +28 -0
  100. package/src/realtime-model/v4/realtime-model-v4.ts +89 -0
  101. package/src/reranking-model/v3/reranking-model-v3-call-options.ts +2 -2
  102. package/src/reranking-model/v3/reranking-model-v3.ts +2 -2
  103. package/src/reranking-model/v4/index.ts +1 -0
  104. package/src/reranking-model/v4/reranking-model-v4-call-options.ts +2 -2
  105. package/src/reranking-model/v4/reranking-model-v4-result.ts +68 -0
  106. package/src/reranking-model/v4/reranking-model-v4.ts +5 -65
  107. package/src/shared/v2/shared-v2-provider-metadata.ts +1 -1
  108. package/src/shared/v2/shared-v2-provider-options.ts +1 -1
  109. package/src/shared/v3/shared-v3-provider-metadata.ts +1 -1
  110. package/src/shared/v3/shared-v3-provider-options.ts +1 -1
  111. package/src/shared/v4/index.ts +2 -0
  112. package/src/shared/v4/shared-v4-file-data.ts +49 -0
  113. package/src/shared/v4/shared-v4-provider-metadata.ts +1 -1
  114. package/src/shared/v4/shared-v4-provider-options.ts +1 -1
  115. package/src/shared/v4/shared-v4-provider-reference.ts +22 -0
  116. package/src/shared/v4/shared-v4-warning.ts +16 -0
  117. package/src/skills/index.ts +1 -0
  118. package/src/skills/v4/index.ts +6 -0
  119. package/src/skills/v4/skills-v4-upload-skill-call-options.ts +37 -0
  120. package/src/skills/v4/skills-v4-upload-skill-result.ts +40 -0
  121. package/src/skills/v4/skills-v4.ts +28 -0
  122. package/src/speech-model/v2/speech-model-v2-call-options.ts +1 -1
  123. package/src/speech-model/v2/speech-model-v2-call-warning.ts +1 -1
  124. package/src/speech-model/v2/speech-model-v2.ts +4 -4
  125. package/src/speech-model/v3/speech-model-v3-call-options.ts +1 -1
  126. package/src/speech-model/v3/speech-model-v3.ts +4 -4
  127. package/src/speech-model/v4/index.ts +1 -0
  128. package/src/speech-model/v4/speech-model-v4-call-options.ts +1 -1
  129. package/src/speech-model/v4/speech-model-v4-result.ts +64 -0
  130. package/src/speech-model/v4/speech-model-v4.ts +5 -61
  131. package/src/transcription-model/v2/transcription-model-v2-call-options.ts +1 -1
  132. package/src/transcription-model/v2/transcription-model-v2-call-warning.ts +1 -1
  133. package/src/transcription-model/v2/transcription-model-v2.ts +4 -4
  134. package/src/transcription-model/v3/transcription-model-v3-call-options.ts +1 -1
  135. package/src/transcription-model/v3/transcription-model-v3.ts +4 -4
  136. package/src/transcription-model/v4/index.ts +1 -0
  137. package/src/transcription-model/v4/transcription-model-v4-call-options.ts +1 -1
  138. package/src/transcription-model/v4/transcription-model-v4-result.ts +92 -0
  139. package/src/transcription-model/v4/transcription-model-v4.ts +5 -89
  140. package/src/video-model/v3/video-model-v3-call-options.ts +7 -2
  141. package/src/video-model/v3/video-model-v3-file.ts +1 -1
  142. package/src/video-model/v4/index.ts +4 -3
  143. package/src/video-model/v4/video-model-v4-call-options.ts +7 -2
  144. package/src/video-model/v4/video-model-v4-file.ts +1 -1
  145. package/src/video-model/v4/video-model-v4-result.ts +92 -0
  146. package/src/video-model/v4/video-model-v4.ts +2 -88
  147. package/dist/index.d.mts +0 -6354
  148. package/dist/index.mjs +0 -404
  149. package/dist/index.mjs.map +0 -1
  150. package/src/language-model/v4/language-model-v4-data-content.ts +0 -4
package/dist/index.d.ts CHANGED
@@ -1,6 +1,69 @@
1
1
  import { JSONSchema7 } from 'json-schema';
2
2
  export { JSONSchema7, JSONSchema7Definition } from 'json-schema';
3
3
 
4
+ /**
5
+ * A mapping of provider names to provider-specific file identifiers.
6
+ *
7
+ * Provider references allow files to be identified across different
8
+ * providers without re-uploading, by storing each provider's own
9
+ * identifier for the same logical file.
10
+ *
11
+ * ```ts
12
+ * {
13
+ * "openai": "file-abc123",
14
+ * "anthropic": "file-xyz789"
15
+ * }
16
+ * ```
17
+ *
18
+ * The `type?: never` constraint excludes any object that has a `type`
19
+ * property, so a `SharedV4ProviderReference` cannot be confused with a
20
+ * tagged file-data shape (e.g. `{ type: 'data', data }` or
21
+ * `{ type: 'reference', reference }`) when both appear in the same union.
22
+ */
23
+ type SharedV4ProviderReference = Record<string, string> & {
24
+ type?: never;
25
+ };
26
+
27
+ /**
28
+ * File data variant containing raw bytes (`Uint8Array`) or a base64-encoded
29
+ * string.
30
+ */
31
+ interface SharedV4FileDataData {
32
+ type: 'data';
33
+ data: Uint8Array | string;
34
+ }
35
+ /**
36
+ * File data variant containing a URL that points to the file.
37
+ */
38
+ interface SharedV4FileDataUrl {
39
+ type: 'url';
40
+ url: URL;
41
+ }
42
+ /**
43
+ * File data variant containing a provider reference (`{ [provider]: id }`).
44
+ */
45
+ interface SharedV4FileDataReference {
46
+ type: 'reference';
47
+ reference: SharedV4ProviderReference;
48
+ }
49
+ /**
50
+ * File data variant containing inline text content (e.g. an inline text
51
+ * document).
52
+ */
53
+ interface SharedV4FileDataText {
54
+ type: 'text';
55
+ text: string;
56
+ }
57
+ /**
58
+ * File data as a tagged discriminated union:
59
+ *
60
+ * - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or base64-encoded string.
61
+ * - `{ type: 'url', url }`: a URL that points to the file.
62
+ * - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
63
+ * - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
64
+ */
65
+ type SharedV4FileData = SharedV4FileDataData | SharedV4FileDataUrl | SharedV4FileDataReference | SharedV4FileDataText;
66
+
4
67
  type SharedV4Headers = Record<string, string>;
5
68
 
6
69
  /**
@@ -91,6 +154,19 @@ type SharedV4Warning = {
91
154
  * Additional details about the warning.
92
155
  */
93
156
  details?: string;
157
+ } | {
158
+ /**
159
+ * A deprecated feature or option is being used.
160
+ */
161
+ type: 'deprecated';
162
+ /**
163
+ * The deprecated setting or feature name.
164
+ */
165
+ setting: string;
166
+ /**
167
+ * A human-readable message explaining what to use instead.
168
+ */
169
+ message: string;
94
170
  } | {
95
171
  /**
96
172
  * Other warning.
@@ -559,13 +635,13 @@ type EmbeddingModelV2<VALUE> = {
559
635
  }>;
560
636
  };
561
637
 
562
- declare const symbol$d: unique symbol;
638
+ declare const symbol$e: unique symbol;
563
639
  /**
564
640
  * Custom error class for AI SDK related errors.
565
641
  * @extends Error
566
642
  */
567
643
  declare class AISDKError extends Error {
568
- private readonly [symbol$d];
644
+ private readonly [symbol$e];
569
645
  /**
570
646
  * The underlying cause of the error, if any.
571
647
  */
@@ -592,9 +668,9 @@ declare class AISDKError extends Error {
592
668
  protected static hasMarker(error: unknown, marker: string): boolean;
593
669
  }
594
670
 
595
- declare const symbol$c: unique symbol;
671
+ declare const symbol$d: unique symbol;
596
672
  declare class APICallError extends AISDKError {
597
- private readonly [symbol$c];
673
+ private readonly [symbol$d];
598
674
  readonly url: string;
599
675
  readonly requestBodyValues: unknown;
600
676
  readonly statusCode?: number;
@@ -617,9 +693,9 @@ declare class APICallError extends AISDKError {
617
693
  static isInstance(error: unknown): error is APICallError;
618
694
  }
619
695
 
620
- declare const symbol$b: unique symbol;
696
+ declare const symbol$c: unique symbol;
621
697
  declare class EmptyResponseBodyError extends AISDKError {
622
- private readonly [symbol$b];
698
+ private readonly [symbol$c];
623
699
  constructor({ message }?: {
624
700
  message?: string;
625
701
  });
@@ -628,12 +704,12 @@ declare class EmptyResponseBodyError extends AISDKError {
628
704
 
629
705
  declare function getErrorMessage(error: unknown | undefined): string;
630
706
 
631
- declare const symbol$a: unique symbol;
707
+ declare const symbol$b: unique symbol;
632
708
  /**
633
709
  * A function argument is invalid.
634
710
  */
635
711
  declare class InvalidArgumentError extends AISDKError {
636
- private readonly [symbol$a];
712
+ private readonly [symbol$b];
637
713
  readonly argument: string;
638
714
  constructor({ message, cause, argument, }: {
639
715
  argument: string;
@@ -643,13 +719,13 @@ declare class InvalidArgumentError extends AISDKError {
643
719
  static isInstance(error: unknown): error is InvalidArgumentError;
644
720
  }
645
721
 
646
- declare const symbol$9: unique symbol;
722
+ declare const symbol$a: unique symbol;
647
723
  /**
648
724
  * A prompt is invalid. This error should be thrown by providers when they cannot
649
725
  * process a prompt.
650
726
  */
651
727
  declare class InvalidPromptError extends AISDKError {
652
- private readonly [symbol$9];
728
+ private readonly [symbol$a];
653
729
  readonly prompt: unknown;
654
730
  constructor({ prompt, message, cause, }: {
655
731
  prompt: unknown;
@@ -659,13 +735,13 @@ declare class InvalidPromptError extends AISDKError {
659
735
  static isInstance(error: unknown): error is InvalidPromptError;
660
736
  }
661
737
 
662
- declare const symbol$8: unique symbol;
738
+ declare const symbol$9: unique symbol;
663
739
  /**
664
740
  * Server returned a response with invalid data content.
665
741
  * This should be thrown by providers when they cannot parse the response from the API.
666
742
  */
667
743
  declare class InvalidResponseDataError extends AISDKError {
668
- private readonly [symbol$8];
744
+ private readonly [symbol$9];
669
745
  readonly data: unknown;
670
746
  constructor({ data, message, }: {
671
747
  data: unknown;
@@ -674,9 +750,9 @@ declare class InvalidResponseDataError extends AISDKError {
674
750
  static isInstance(error: unknown): error is InvalidResponseDataError;
675
751
  }
676
752
 
677
- declare const symbol$7: unique symbol;
753
+ declare const symbol$8: unique symbol;
678
754
  declare class JSONParseError extends AISDKError {
679
- private readonly [symbol$7];
755
+ private readonly [symbol$8];
680
756
  readonly text: string;
681
757
  constructor({ text, cause }: {
682
758
  text: string;
@@ -685,39 +761,39 @@ declare class JSONParseError extends AISDKError {
685
761
  static isInstance(error: unknown): error is JSONParseError;
686
762
  }
687
763
 
688
- declare const symbol$6: unique symbol;
764
+ declare const symbol$7: unique symbol;
689
765
  declare class LoadAPIKeyError extends AISDKError {
690
- private readonly [symbol$6];
766
+ private readonly [symbol$7];
691
767
  constructor({ message }: {
692
768
  message: string;
693
769
  });
694
770
  static isInstance(error: unknown): error is LoadAPIKeyError;
695
771
  }
696
772
 
697
- declare const symbol$5: unique symbol;
773
+ declare const symbol$6: unique symbol;
698
774
  declare class LoadSettingError extends AISDKError {
699
- private readonly [symbol$5];
775
+ private readonly [symbol$6];
700
776
  constructor({ message }: {
701
777
  message: string;
702
778
  });
703
779
  static isInstance(error: unknown): error is LoadSettingError;
704
780
  }
705
781
 
706
- declare const symbol$4: unique symbol;
782
+ declare const symbol$5: unique symbol;
707
783
  /**
708
784
  * Thrown when the AI provider fails to generate any content.
709
785
  */
710
786
  declare class NoContentGeneratedError extends AISDKError {
711
- private readonly [symbol$4];
787
+ private readonly [symbol$5];
712
788
  constructor({ message, }?: {
713
789
  message?: string;
714
790
  });
715
791
  static isInstance(error: unknown): error is NoContentGeneratedError;
716
792
  }
717
793
 
718
- declare const symbol$3: unique symbol;
794
+ declare const symbol$4: unique symbol;
719
795
  declare class NoSuchModelError extends AISDKError {
720
- private readonly [symbol$3];
796
+ private readonly [symbol$4];
721
797
  readonly modelId: string;
722
798
  readonly modelType: 'languageModel' | 'embeddingModel' | 'imageModel' | 'transcriptionModel' | 'speechModel' | 'rerankingModel' | 'videoModel';
723
799
  constructor({ errorName, modelId, modelType, message, }: {
@@ -729,6 +805,23 @@ declare class NoSuchModelError extends AISDKError {
729
805
  static isInstance(error: unknown): error is NoSuchModelError;
730
806
  }
731
807
 
808
+ declare const symbol$3: unique symbol;
809
+ /**
810
+ * Thrown when a provider reference cannot be resolved because the specified
811
+ * provider is not found in the provider reference mapping.
812
+ */
813
+ declare class NoSuchProviderReferenceError extends AISDKError {
814
+ private readonly [symbol$3];
815
+ readonly provider: string;
816
+ readonly reference: SharedV4ProviderReference;
817
+ constructor({ provider, reference, message, }: {
818
+ provider: string;
819
+ reference: SharedV4ProviderReference;
820
+ message?: string;
821
+ });
822
+ static isInstance(error: unknown): error is NoSuchProviderReferenceError;
823
+ }
824
+
732
825
  declare const symbol$2: unique symbol;
733
826
  declare class TooManyEmbeddingValuesForCallError extends AISDKError {
734
827
  private readonly [symbol$2];
@@ -799,26 +892,78 @@ declare class UnsupportedFunctionalityError extends AISDKError {
799
892
  static isInstance(error: unknown): error is UnsupportedFunctionalityError;
800
893
  }
801
894
 
802
- declare function isJSONValue(value: unknown): value is JSONValue;
803
- declare function isJSONArray(value: unknown): value is JSONArray;
804
- declare function isJSONObject(value: unknown): value is JSONObject;
895
+ /**
896
+ * Options for uploading a file via the files interface.
897
+ */
898
+ type FilesV4UploadFileCallOptions = {
899
+ /**
900
+ * The file data.
901
+ *
902
+ * - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or a base64-encoded string.
903
+ * - `{ type: 'text', text }`: inline text (UTF-8).
904
+ */
905
+ data: SharedV4FileDataData | SharedV4FileDataText;
906
+ /**
907
+ * The IANA media type of the file (e.g. `'application/pdf'`).
908
+ */
909
+ mediaType: string;
910
+ /**
911
+ * The filename of the file.
912
+ */
913
+ filename?: string;
914
+ /**
915
+ * Additional provider-specific options. They are passed through
916
+ * to the provider from the AI SDK and enable provider-specific
917
+ * functionality that can be fully encapsulated in the provider.
918
+ */
919
+ providerOptions?: SharedV4ProviderOptions;
920
+ };
805
921
 
806
922
  /**
807
- * Usage information for an image model call.
923
+ * Result of uploading a file via the files interface.
808
924
  */
809
- type ImageModelV4Usage = {
925
+ type FilesV4UploadFileResult = {
810
926
  /**
811
- * The number of input (prompt) tokens used.
927
+ * A provider reference mapping provider names to provider-specific file identifiers.
812
928
  */
813
- inputTokens: number | undefined;
929
+ providerReference: SharedV4ProviderReference;
814
930
  /**
815
- * The number of output tokens used, if reported by the provider.
931
+ * The IANA media type of the uploaded file, if available from the provider.
816
932
  */
817
- outputTokens: number | undefined;
933
+ mediaType?: string;
818
934
  /**
819
- * The total number of tokens as reported by the provider.
935
+ * The filename of the uploaded file, if available from the provider.
820
936
  */
821
- totalTokens: number | undefined;
937
+ filename?: string;
938
+ /**
939
+ * Additional provider-specific metadata. They are passed through
940
+ * to the provider from the AI SDK and enable provider-specific
941
+ * functionality that can be fully encapsulated in the provider.
942
+ */
943
+ providerMetadata?: SharedV4ProviderMetadata;
944
+ /**
945
+ * Warnings from the provider.
946
+ */
947
+ warnings: Array<SharedV4Warning>;
948
+ };
949
+
950
+ /**
951
+ * Specification for a file management interface that implements the files interface version 4.
952
+ */
953
+ type FilesV4 = {
954
+ /**
955
+ * The files interface must specify which files interface version it implements.
956
+ */
957
+ readonly specificationVersion: 'v4';
958
+ /**
959
+ * Provider ID.
960
+ */
961
+ readonly provider: string;
962
+ /**
963
+ * Uploads a file to the provider and returns a provider reference
964
+ * that can be used in subsequent API calls.
965
+ */
966
+ uploadFile(options: FilesV4UploadFileCallOptions): PromiseLike<FilesV4UploadFileResult>;
822
967
  };
823
968
 
824
969
  /**
@@ -920,9 +1065,88 @@ type ImageModelV4CallOptions = {
920
1065
  headers?: Record<string, string | undefined>;
921
1066
  };
922
1067
 
1068
+ declare function isJSONValue(value: unknown): value is JSONValue;
1069
+ declare function isJSONArray(value: unknown): value is JSONArray;
1070
+ declare function isJSONObject(value: unknown): value is JSONObject;
1071
+
1072
+ /**
1073
+ * Usage information for an image model call.
1074
+ */
1075
+ type ImageModelV4Usage = {
1076
+ /**
1077
+ * The number of input (prompt) tokens used.
1078
+ */
1079
+ inputTokens: number | undefined;
1080
+ /**
1081
+ * The number of output tokens used, if reported by the provider.
1082
+ */
1083
+ outputTokens: number | undefined;
1084
+ /**
1085
+ * The total number of tokens as reported by the provider.
1086
+ */
1087
+ totalTokens: number | undefined;
1088
+ };
1089
+
923
1090
  type ImageModelV4ProviderMetadata = Record<string, {
924
1091
  images: JSONArray;
925
1092
  } & JSONValue>;
1093
+ /**
1094
+ * The result of an image model doGenerate call.
1095
+ */
1096
+ type ImageModelV4Result = {
1097
+ /**
1098
+ * Generated images as base64 encoded strings or binary data.
1099
+ * The images should be returned without any unnecessary conversion.
1100
+ * If the API returns base64 encoded strings, the images should be returned
1101
+ * as base64 encoded strings. If the API returns binary data, the images should
1102
+ * be returned as binary data.
1103
+ */
1104
+ images: Array<string> | Array<Uint8Array>;
1105
+ /**
1106
+ * Warnings for the call, e.g. unsupported features.
1107
+ */
1108
+ warnings: Array<SharedV4Warning>;
1109
+ /**
1110
+ * Additional provider-specific metadata. They are passed through
1111
+ * from the provider to the AI SDK and enable provider-specific
1112
+ * results that can be fully encapsulated in the provider.
1113
+ *
1114
+ * The outer record is keyed by the provider name, and the inner
1115
+ * record is provider-specific metadata. It always includes an
1116
+ * `images` key with image-specific metadata
1117
+ *
1118
+ * ```ts
1119
+ * {
1120
+ * "openai": {
1121
+ * "images": ["revisedPrompt": "Revised prompt here."]
1122
+ * }
1123
+ * }
1124
+ * ```
1125
+ */
1126
+ providerMetadata?: ImageModelV4ProviderMetadata;
1127
+ /**
1128
+ * Response information for telemetry and debugging purposes.
1129
+ */
1130
+ response: {
1131
+ /**
1132
+ * Timestamp for the start of the generated response.
1133
+ */
1134
+ timestamp: Date;
1135
+ /**
1136
+ * The ID of the response model that was used to generate the response.
1137
+ */
1138
+ modelId: string;
1139
+ /**
1140
+ * Response headers.
1141
+ */
1142
+ headers: Record<string, string> | undefined;
1143
+ };
1144
+ /**
1145
+ * Optional token usage for the image generation call (if the provider reports it).
1146
+ */
1147
+ usage?: ImageModelV4Usage;
1148
+ };
1149
+
926
1150
  type GetMaxImagesPerCallFunction$2 = (options: {
927
1151
  modelId: string;
928
1152
  }) => PromiseLike<number | undefined> | number | undefined;
@@ -956,59 +1180,7 @@ type ImageModelV4 = {
956
1180
  /**
957
1181
  * Generates an array of images.
958
1182
  */
959
- doGenerate(options: ImageModelV4CallOptions): PromiseLike<{
960
- /**
961
- * Generated images as base64 encoded strings or binary data.
962
- * The images should be returned without any unnecessary conversion.
963
- * If the API returns base64 encoded strings, the images should be returned
964
- * as base64 encoded strings. If the API returns binary data, the images should
965
- * be returned as binary data.
966
- */
967
- images: Array<string> | Array<Uint8Array>;
968
- /**
969
- * Warnings for the call, e.g. unsupported features.
970
- */
971
- warnings: Array<SharedV4Warning>;
972
- /**
973
- * Additional provider-specific metadata. They are passed through
974
- * from the provider to the AI SDK and enable provider-specific
975
- * results that can be fully encapsulated in the provider.
976
- *
977
- * The outer record is keyed by the provider name, and the inner
978
- * record is provider-specific metadata. It always includes an
979
- * `images` key with image-specific metadata
980
- *
981
- * ```ts
982
- * {
983
- * "openai": {
984
- * "images": ["revisedPrompt": "Revised prompt here."]
985
- * }
986
- * }
987
- * ```
988
- */
989
- providerMetadata?: ImageModelV4ProviderMetadata;
990
- /**
991
- * Response information for telemetry and debugging purposes.
992
- */
993
- response: {
994
- /**
995
- * Timestamp for the start of the generated response.
996
- */
997
- timestamp: Date;
998
- /**
999
- * The ID of the response model that was used to generate the response.
1000
- */
1001
- modelId: string;
1002
- /**
1003
- * Response headers.
1004
- */
1005
- headers: Record<string, string> | undefined;
1006
- };
1007
- /**
1008
- * Optional token usage for the image generation call (if the provider reports it).
1009
- */
1010
- usage?: ImageModelV4Usage;
1011
- }>;
1183
+ doGenerate(options: ImageModelV4CallOptions): PromiseLike<ImageModelV4Result>;
1012
1184
  };
1013
1185
 
1014
1186
  /**
@@ -1533,11 +1705,6 @@ type LanguageModelV4FunctionTool = {
1533
1705
  providerOptions?: SharedV4ProviderOptions;
1534
1706
  };
1535
1707
 
1536
- /**
1537
- * Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
1538
- */
1539
- type LanguageModelV4DataContent = Uint8Array | string | URL;
1540
-
1541
1708
  /**
1542
1709
  * A prompt is a list of messages.
1543
1710
  *
@@ -1556,7 +1723,7 @@ type LanguageModelV4Message = ({
1556
1723
  content: Array<LanguageModelV4TextPart | LanguageModelV4FilePart>;
1557
1724
  } | {
1558
1725
  role: 'assistant';
1559
- content: Array<LanguageModelV4TextPart | LanguageModelV4FilePart | LanguageModelV4ReasoningPart | LanguageModelV4ReasoningFilePart | LanguageModelV4ToolCallPart | LanguageModelV4ToolResultPart>;
1726
+ content: Array<LanguageModelV4TextPart | LanguageModelV4FilePart | LanguageModelV4CustomPart | LanguageModelV4ReasoningPart | LanguageModelV4ReasoningFilePart | LanguageModelV4ToolCallPart | LanguageModelV4ToolResultPart>;
1560
1727
  } | {
1561
1728
  role: 'tool';
1562
1729
  content: Array<LanguageModelV4ToolResultPart | LanguageModelV4ToolApprovalResponsePart>;
@@ -1606,9 +1773,12 @@ interface LanguageModelV4ReasoningPart {
1606
1773
  interface LanguageModelV4ReasoningFilePart {
1607
1774
  type: 'reasoning-file';
1608
1775
  /**
1609
- * File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
1776
+ * File data as a tagged discriminated union:
1777
+ *
1778
+ * - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
1779
+ * - `{ type: 'url', url }`: a URL that points to the file.
1610
1780
  */
1611
- data: LanguageModelV4DataContent;
1781
+ data: SharedV4FileDataData | SharedV4FileDataUrl;
1612
1782
  /**
1613
1783
  * IANA media type of the file.
1614
1784
  *
@@ -1622,6 +1792,23 @@ interface LanguageModelV4ReasoningFilePart {
1622
1792
  */
1623
1793
  providerOptions?: SharedV4ProviderOptions;
1624
1794
  }
1795
+ /**
1796
+ * Provider-specific content part of a prompt. It contains no standardized
1797
+ * payload beyond provider-specific options.
1798
+ */
1799
+ interface LanguageModelV4CustomPart {
1800
+ type: 'custom';
1801
+ /**
1802
+ * The kind of custom content, in the format `{provider}.{provider-type}`.
1803
+ */
1804
+ kind: `${string}.${string}`;
1805
+ /**
1806
+ * Additional provider-specific options. They are passed through
1807
+ * to the provider from the AI SDK and enable provider-specific
1808
+ * functionality that can be fully encapsulated in the provider.
1809
+ */
1810
+ providerOptions?: SharedV4ProviderOptions;
1811
+ }
1625
1812
  /**
1626
1813
  * File content part of a prompt. It contains a file.
1627
1814
  */
@@ -1632,13 +1819,23 @@ interface LanguageModelV4FilePart {
1632
1819
  */
1633
1820
  filename?: string;
1634
1821
  /**
1635
- * File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
1822
+ * File data as a tagged discriminated union:
1823
+ *
1824
+ * - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
1825
+ * - `{ type: 'url', url }`: a URL that points to the file.
1826
+ * - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
1827
+ * - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
1636
1828
  */
1637
- data: LanguageModelV4DataContent;
1829
+ data: SharedV4FileData;
1638
1830
  /**
1639
- * IANA media type of the file.
1831
+ * Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
1832
+ * the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
1640
1833
  *
1641
- * Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
1834
+ * `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
1835
+ * top-level segment alone (e.g. `image`). Providers can use the helpers in
1836
+ * `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
1837
+ * `detectMediaType`) to resolve the field according to their API
1838
+ * requirements.
1642
1839
  *
1643
1840
  * @see https://www.iana.org/assignments/media-types/media-types.xhtml
1644
1841
  */
@@ -1788,13 +1985,26 @@ type LanguageModelV4ToolResultOutput = {
1788
1985
  */
1789
1986
  providerOptions?: SharedV4ProviderOptions;
1790
1987
  } | {
1791
- type: 'file-data';
1988
+ type: 'file';
1792
1989
  /**
1793
- * Base-64 encoded media data.
1990
+ * File data as a tagged discriminated union:
1991
+ *
1992
+ * - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
1993
+ * - `{ type: 'url', url }`: a URL that points to the file.
1994
+ * - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
1995
+ * - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
1794
1996
  */
1795
- data: string;
1997
+ data: SharedV4FileData;
1796
1998
  /**
1797
- * IANA media type.
1999
+ * Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
2000
+ * the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
2001
+ *
2002
+ * `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
2003
+ * top-level segment alone (e.g. `image`). Providers can use the helpers in
2004
+ * `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
2005
+ * `detectMediaType`) to resolve the field according to their API
2006
+ * requirements.
2007
+ *
1798
2008
  * @see https://www.iana.org/assignments/media-types/media-types.xhtml
1799
2009
  */
1800
2010
  mediaType: string;
@@ -1806,80 +2016,6 @@ type LanguageModelV4ToolResultOutput = {
1806
2016
  * Provider-specific options.
1807
2017
  */
1808
2018
  providerOptions?: SharedV4ProviderOptions;
1809
- } | {
1810
- type: 'file-url';
1811
- /**
1812
- * URL of the file.
1813
- */
1814
- url: string;
1815
- /**
1816
- * Provider-specific options.
1817
- */
1818
- providerOptions?: SharedV4ProviderOptions;
1819
- } | {
1820
- type: 'file-id';
1821
- /**
1822
- * ID of the file.
1823
- *
1824
- * If you use multiple providers, you need to
1825
- * specify the provider specific ids using
1826
- * the Record option. The key is the provider
1827
- * name, e.g. 'openai' or 'anthropic'.
1828
- */
1829
- fileId: string | Record<string, string>;
1830
- /**
1831
- * Provider-specific options.
1832
- */
1833
- providerOptions?: SharedV4ProviderOptions;
1834
- } | {
1835
- /**
1836
- * Images that are referenced using base64 encoded data.
1837
- */
1838
- type: 'image-data';
1839
- /**
1840
- * Base-64 encoded image data.
1841
- */
1842
- data: string;
1843
- /**
1844
- * IANA media type.
1845
- * @see https://www.iana.org/assignments/media-types/media-types.xhtml
1846
- */
1847
- mediaType: string;
1848
- /**
1849
- * Provider-specific options.
1850
- */
1851
- providerOptions?: SharedV4ProviderOptions;
1852
- } | {
1853
- /**
1854
- * Images that are referenced using a URL.
1855
- */
1856
- type: 'image-url';
1857
- /**
1858
- * URL of the image.
1859
- */
1860
- url: string;
1861
- /**
1862
- * Provider-specific options.
1863
- */
1864
- providerOptions?: SharedV4ProviderOptions;
1865
- } | {
1866
- /**
1867
- * Images that are referenced using a provider file id.
1868
- */
1869
- type: 'image-file-id';
1870
- /**
1871
- * Image that is referenced using a provider file id.
1872
- *
1873
- * If you use multiple providers, you need to
1874
- * specify the provider specific ids using
1875
- * the Record option. The key is the provider
1876
- * name, e.g. 'openai' or 'anthropic'.
1877
- */
1878
- fileId: string | Record<string, string>;
1879
- /**
1880
- * Provider-specific options.
1881
- */
1882
- providerOptions?: SharedV4ProviderOptions;
1883
2019
  } | {
1884
2020
  /**
1885
2021
  * Custom content part. This can be used to implement
@@ -2023,6 +2159,11 @@ type LanguageModelV4CallOptions = {
2023
2159
  * Only applicable for HTTP-based providers.
2024
2160
  */
2025
2161
  headers?: Record<string, string | undefined>;
2162
+ /**
2163
+ * Reasoning effort level for the model. Controls how much reasoning
2164
+ * the model performs before generating a response. Defaults to 'provider-default'.
2165
+ */
2166
+ reasoning?: 'provider-default' | 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
2026
2167
  /**
2027
2168
  * Additional provider-specific options. They are passed through
2028
2169
  * to the provider from the AI SDK and enable provider-specific
@@ -2031,6 +2172,24 @@ type LanguageModelV4CallOptions = {
2031
2172
  providerOptions?: SharedV4ProviderOptions;
2032
2173
  };
2033
2174
 
2175
+ /**
2176
+ * A provider-specific content block that does not map to another standardized
2177
+ * content part type.
2178
+ */
2179
+ type LanguageModelV4CustomContent = {
2180
+ type: 'custom';
2181
+ /**
2182
+ * The kind of custom content, in the format `{provider}.{provider-type}`.
2183
+ */
2184
+ kind: `${string}.${string}`;
2185
+ /**
2186
+ * Additional provider-specific options. They are passed through
2187
+ * to the provider from the AI SDK and enable provider-specific
2188
+ * functionality that can be fully encapsulated in the provider.
2189
+ */
2190
+ providerMetadata?: SharedV4ProviderMetadata;
2191
+ };
2192
+
2034
2193
  /**
2035
2194
  * A file that has been generated by the model.
2036
2195
  * Generated files as base64 encoded strings or binary data.
@@ -2045,14 +2204,17 @@ type LanguageModelV4File = {
2045
2204
  */
2046
2205
  mediaType: string;
2047
2206
  /**
2048
- * Generated file data as base64 encoded strings or binary data.
2207
+ * Generated file data as a tagged discriminated union:
2208
+ *
2209
+ * - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
2210
+ * - `{ type: 'url', url }`: a URL that points to the file.
2049
2211
  *
2050
2212
  * The file data should be returned without any unnecessary conversion.
2051
2213
  * If the API returns base64 encoded strings, the file data should be returned
2052
2214
  * as base64 encoded strings. If the API returns binary data, the file data should
2053
2215
  * be returned as binary data.
2054
2216
  */
2055
- data: string | Uint8Array;
2217
+ data: SharedV4FileDataData | SharedV4FileDataUrl;
2056
2218
  /**
2057
2219
  * Optional provider-specific metadata for the file part.
2058
2220
  */
@@ -2085,14 +2247,17 @@ type LanguageModelV4ReasoningFile = {
2085
2247
  */
2086
2248
  mediaType: string;
2087
2249
  /**
2088
- * Generated file data as base64 encoded strings or binary data.
2250
+ * Generated file data as a tagged discriminated union:
2251
+ *
2252
+ * - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
2253
+ * - `{ type: 'url', url }`: a URL that points to the file.
2089
2254
  *
2090
2255
  * The file data should be returned without any unnecessary conversion.
2091
2256
  * If the API returns base64 encoded strings, the file data should be returned
2092
2257
  * as base64 encoded strings. If the API returns binary data, the file data should
2093
2258
  * be returned as binary data.
2094
2259
  */
2095
- data: string | Uint8Array;
2260
+ data: SharedV4FileDataData | SharedV4FileDataUrl;
2096
2261
  /**
2097
2262
  * Optional provider-specific metadata for the reasoning file part.
2098
2263
  */
@@ -2263,7 +2428,7 @@ type LanguageModelV4ToolResult = {
2263
2428
  providerMetadata?: SharedV4ProviderMetadata;
2264
2429
  };
2265
2430
 
2266
- type LanguageModelV4Content = LanguageModelV4Text | LanguageModelV4Reasoning | LanguageModelV4ReasoningFile | LanguageModelV4File | LanguageModelV4ToolApprovalRequest | LanguageModelV4Source | LanguageModelV4ToolCall | LanguageModelV4ToolResult;
2431
+ type LanguageModelV4Content = LanguageModelV4Text | LanguageModelV4Reasoning | LanguageModelV4CustomContent | LanguageModelV4ReasoningFile | LanguageModelV4File | LanguageModelV4ToolApprovalRequest | LanguageModelV4Source | LanguageModelV4ToolCall | LanguageModelV4ToolResult;
2267
2432
 
2268
2433
  /**
2269
2434
  * Reason why a language model finished generating a response.
@@ -2451,7 +2616,7 @@ type LanguageModelV4StreamPart = {
2451
2616
  type: 'tool-input-end';
2452
2617
  id: string;
2453
2618
  providerMetadata?: SharedV4ProviderMetadata;
2454
- } | LanguageModelV4ToolApprovalRequest | LanguageModelV4ToolCall | LanguageModelV4ToolResult | LanguageModelV4File | LanguageModelV4ReasoningFile | LanguageModelV4Source | {
2619
+ } | LanguageModelV4ToolApprovalRequest | LanguageModelV4ToolCall | LanguageModelV4ToolResult | LanguageModelV4CustomContent | LanguageModelV4File | LanguageModelV4ReasoningFile | LanguageModelV4Source | {
2455
2620
  type: 'stream-start';
2456
2621
  warnings: Array<SharedV4Warning>;
2457
2622
  } | ({
@@ -4712,6 +4877,61 @@ type RerankingModelV4CallOptions = {
4712
4877
  headers?: SharedV4Headers;
4713
4878
  };
4714
4879
 
4880
+ /**
4881
+ * The result of a reranking model doRerank call.
4882
+ */
4883
+ type RerankingModelV4Result = {
4884
+ /**
4885
+ * Ordered list of reranked documents (via index before reranking).
4886
+ * The documents are sorted by the descending order of relevance scores.
4887
+ */
4888
+ ranking: Array<{
4889
+ /**
4890
+ * The index of the document in the original list of documents before reranking.
4891
+ */
4892
+ index: number;
4893
+ /**
4894
+ * The relevance score of the document after reranking.
4895
+ */
4896
+ relevanceScore: number;
4897
+ }>;
4898
+ /**
4899
+ * Additional provider-specific metadata. They are passed through
4900
+ * to the provider from the AI SDK and enable provider-specific
4901
+ * functionality that can be fully encapsulated in the provider.
4902
+ */
4903
+ providerMetadata?: SharedV4ProviderMetadata;
4904
+ /**
4905
+ * Warnings for the call, e.g. unsupported settings.
4906
+ */
4907
+ warnings?: Array<SharedV4Warning>;
4908
+ /**
4909
+ * Optional response information for debugging purposes.
4910
+ */
4911
+ response?: {
4912
+ /**
4913
+ * ID for the generated response, if the provider sends one.
4914
+ */
4915
+ id?: string;
4916
+ /**
4917
+ * Timestamp for the start of the generated response, if the provider sends one.
4918
+ */
4919
+ timestamp?: Date;
4920
+ /**
4921
+ * The ID of the response model that was used to generate the response, if the provider sends one.
4922
+ */
4923
+ modelId?: string;
4924
+ /**
4925
+ * Response headers.
4926
+ */
4927
+ headers?: SharedV4Headers;
4928
+ /**
4929
+ * Response body.
4930
+ */
4931
+ body?: unknown;
4932
+ };
4933
+ };
4934
+
4715
4935
  /**
4716
4936
  * Specification for a reranking model that implements the reranking model interface version 3.
4717
4937
  */
@@ -4731,57 +4951,7 @@ type RerankingModelV4 = {
4731
4951
  /**
4732
4952
  * Reranking a list of documents using the query.
4733
4953
  */
4734
- doRerank(options: RerankingModelV4CallOptions): PromiseLike<{
4735
- /**
4736
- * Ordered list of reranked documents (via index before reranking).
4737
- * The documents are sorted by the descending order of relevance scores.
4738
- */
4739
- ranking: Array<{
4740
- /**
4741
- * The index of the document in the original list of documents before reranking.
4742
- */
4743
- index: number;
4744
- /**
4745
- * The relevance score of the document after reranking.
4746
- */
4747
- relevanceScore: number;
4748
- }>;
4749
- /**
4750
- * Additional provider-specific metadata. They are passed through
4751
- * to the provider from the AI SDK and enable provider-specific
4752
- * functionality that can be fully encapsulated in the provider.
4753
- */
4754
- providerMetadata?: SharedV4ProviderMetadata;
4755
- /**
4756
- * Warnings for the call, e.g. unsupported settings.
4757
- */
4758
- warnings?: Array<SharedV4Warning>;
4759
- /**
4760
- * Optional response information for debugging purposes.
4761
- */
4762
- response?: {
4763
- /**
4764
- * ID for the generated response, if the provider sends one.
4765
- */
4766
- id?: string;
4767
- /**
4768
- * Timestamp for the start of the generated response, if the provider sends one.
4769
- */
4770
- timestamp?: Date;
4771
- /**
4772
- * The ID of the response model that was used to generate the response, if the provider sends one.
4773
- */
4774
- modelId?: string;
4775
- /**
4776
- * Response headers.
4777
- */
4778
- headers?: SharedV4Headers;
4779
- /**
4780
- * Response body.
4781
- */
4782
- body?: unknown;
4783
- };
4784
- }>;
4954
+ doRerank(options: RerankingModelV4CallOptions): PromiseLike<RerankingModelV4Result>;
4785
4955
  };
4786
4956
 
4787
4957
  type SpeechModelV4ProviderOptions = Record<string, JSONObject>;
@@ -4836,6 +5006,60 @@ type SpeechModelV4CallOptions = {
4836
5006
  headers?: Record<string, string | undefined>;
4837
5007
  };
4838
5008
 
5009
+ /**
5010
+ * The result of a speech model doGenerate call.
5011
+ */
5012
+ type SpeechModelV4Result = {
5013
+ /**
5014
+ * Generated audio as an ArrayBuffer.
5015
+ * The audio should be returned without any unnecessary conversion.
5016
+ * If the API returns base64 encoded strings, the audio should be returned
5017
+ * as base64 encoded strings. If the API returns binary data, the audio
5018
+ * should be returned as binary data.
5019
+ */
5020
+ audio: string | Uint8Array;
5021
+ /**
5022
+ * Warnings for the call, e.g. unsupported settings.
5023
+ */
5024
+ warnings: Array<SharedV4Warning>;
5025
+ /**
5026
+ * Optional request information for telemetry and debugging purposes.
5027
+ */
5028
+ request?: {
5029
+ /**
5030
+ * Response body (available only for providers that use HTTP requests).
5031
+ */
5032
+ body?: unknown;
5033
+ };
5034
+ /**
5035
+ * Response information for telemetry and debugging purposes.
5036
+ */
5037
+ response: {
5038
+ /**
5039
+ * Timestamp for the start of the generated response.
5040
+ */
5041
+ timestamp: Date;
5042
+ /**
5043
+ * The ID of the response model that was used to generate the response.
5044
+ */
5045
+ modelId: string;
5046
+ /**
5047
+ * Response headers.
5048
+ */
5049
+ headers?: SharedV2Headers;
5050
+ /**
5051
+ * Response body.
5052
+ */
5053
+ body?: unknown;
5054
+ };
5055
+ /**
5056
+ * Additional provider-specific metadata. They are passed through
5057
+ * from the provider to the AI SDK and enable provider-specific
5058
+ * results that can be fully encapsulated in the provider.
5059
+ */
5060
+ providerMetadata?: Record<string, JSONObject>;
5061
+ };
5062
+
4839
5063
  /**
4840
5064
  * Speech model specification version 3.
4841
5065
  */
@@ -4859,56 +5083,7 @@ type SpeechModelV4 = {
4859
5083
  /**
4860
5084
  * Generates speech audio from text.
4861
5085
  */
4862
- doGenerate(options: SpeechModelV4CallOptions): PromiseLike<{
4863
- /**
4864
- * Generated audio as an ArrayBuffer.
4865
- * The audio should be returned without any unnecessary conversion.
4866
- * If the API returns base64 encoded strings, the audio should be returned
4867
- * as base64 encoded strings. If the API returns binary data, the audio
4868
- * should be returned as binary data.
4869
- */
4870
- audio: string | Uint8Array;
4871
- /**
4872
- * Warnings for the call, e.g. unsupported settings.
4873
- */
4874
- warnings: Array<SharedV4Warning>;
4875
- /**
4876
- * Optional request information for telemetry and debugging purposes.
4877
- */
4878
- request?: {
4879
- /**
4880
- * Response body (available only for providers that use HTTP requests).
4881
- */
4882
- body?: unknown;
4883
- };
4884
- /**
4885
- * Response information for telemetry and debugging purposes.
4886
- */
4887
- response: {
4888
- /**
4889
- * Timestamp for the start of the generated response.
4890
- */
4891
- timestamp: Date;
4892
- /**
4893
- * The ID of the response model that was used to generate the response.
4894
- */
4895
- modelId: string;
4896
- /**
4897
- * Response headers.
4898
- */
4899
- headers?: SharedV2Headers;
4900
- /**
4901
- * Response body.
4902
- */
4903
- body?: unknown;
4904
- };
4905
- /**
4906
- * Additional provider-specific metadata. They are passed through
4907
- * from the provider to the AI SDK and enable provider-specific
4908
- * results that can be fully encapsulated in the provider.
4909
- */
4910
- providerMetadata?: Record<string, JSONObject>;
4911
- }>;
5086
+ doGenerate(options: SpeechModelV4CallOptions): PromiseLike<SpeechModelV4Result>;
4912
5087
  };
4913
5088
 
4914
5089
  type TranscriptionModelV4ProviderOptions = Record<string, JSONObject>;
@@ -4951,105 +5126,191 @@ type TranscriptionModelV4CallOptions = {
4951
5126
  };
4952
5127
 
4953
5128
  /**
4954
- * Transcription model specification version 3.
5129
+ * The result of a transcription model doGenerate call.
4955
5130
  */
4956
- type TranscriptionModelV4 = {
5131
+ type TranscriptionModelV4Result = {
4957
5132
  /**
4958
- * The transcription model must specify which transcription model interface
4959
- * version it implements. This will allow us to evolve the transcription
4960
- * model interface and retain backwards compatibility. The different
4961
- * implementation versions can be handled as a discriminated union
4962
- * on our side.
4963
- */
4964
- readonly specificationVersion: 'v4';
4965
- /**
4966
- * Name of the provider for logging purposes.
4967
- */
4968
- readonly provider: string;
4969
- /**
4970
- * Provider-specific model ID for logging purposes.
5133
+ * The complete transcribed text from the audio.
4971
5134
  */
4972
- readonly modelId: string;
5135
+ text: string;
4973
5136
  /**
4974
- * Generates a transcript.
5137
+ * Array of transcript segments with timing information.
5138
+ * Each segment represents a portion of the transcribed text with start and end times.
4975
5139
  */
4976
- doGenerate(options: TranscriptionModelV4CallOptions): PromiseLike<{
5140
+ segments: Array<{
4977
5141
  /**
4978
- * The complete transcribed text from the audio.
5142
+ * The text content of this segment.
4979
5143
  */
4980
5144
  text: string;
4981
5145
  /**
4982
- * Array of transcript segments with timing information.
4983
- * Each segment represents a portion of the transcribed text with start and end times.
5146
+ * The start time of this segment in seconds.
4984
5147
  */
4985
- segments: Array<{
4986
- /**
4987
- * The text content of this segment.
4988
- */
4989
- text: string;
4990
- /**
4991
- * The start time of this segment in seconds.
4992
- */
4993
- startSecond: number;
4994
- /**
4995
- * The end time of this segment in seconds.
4996
- */
4997
- endSecond: number;
4998
- }>;
5148
+ startSecond: number;
4999
5149
  /**
5000
- * The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
5001
- * May be undefined if the language couldn't be detected.
5150
+ * The end time of this segment in seconds.
5002
5151
  */
5003
- language: string | undefined;
5152
+ endSecond: number;
5153
+ }>;
5154
+ /**
5155
+ * The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
5156
+ * May be undefined if the language couldn't be detected.
5157
+ */
5158
+ language: string | undefined;
5159
+ /**
5160
+ * The total duration of the audio file in seconds.
5161
+ * May be undefined if the duration couldn't be determined.
5162
+ */
5163
+ durationInSeconds: number | undefined;
5164
+ /**
5165
+ * Warnings for the call, e.g. unsupported settings.
5166
+ */
5167
+ warnings: Array<SharedV4Warning>;
5168
+ /**
5169
+ * Optional request information for telemetry and debugging purposes.
5170
+ */
5171
+ request?: {
5004
5172
  /**
5005
- * The total duration of the audio file in seconds.
5006
- * May be undefined if the duration couldn't be determined.
5173
+ * Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
5174
+ * Non-HTTP(s) providers should not set this.
5007
5175
  */
5008
- durationInSeconds: number | undefined;
5176
+ body?: string;
5177
+ };
5178
+ /**
5179
+ * Response information for telemetry and debugging purposes.
5180
+ */
5181
+ response: {
5009
5182
  /**
5010
- * Warnings for the call, e.g. unsupported settings.
5183
+ * Timestamp for the start of the generated response.
5011
5184
  */
5012
- warnings: Array<SharedV4Warning>;
5185
+ timestamp: Date;
5013
5186
  /**
5014
- * Optional request information for telemetry and debugging purposes.
5187
+ * The ID of the response model that was used to generate the response.
5015
5188
  */
5016
- request?: {
5017
- /**
5018
- * Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
5019
- * Non-HTTP(s) providers should not set this.
5020
- */
5021
- body?: string;
5022
- };
5189
+ modelId: string;
5023
5190
  /**
5024
- * Response information for telemetry and debugging purposes.
5191
+ * Response headers.
5025
5192
  */
5026
- response: {
5027
- /**
5028
- * Timestamp for the start of the generated response.
5029
- */
5030
- timestamp: Date;
5031
- /**
5032
- * The ID of the response model that was used to generate the response.
5033
- */
5034
- modelId: string;
5035
- /**
5036
- * Response headers.
5037
- */
5038
- headers?: SharedV4Headers;
5039
- /**
5040
- * Response body.
5041
- */
5042
- body?: unknown;
5043
- };
5193
+ headers?: SharedV4Headers;
5044
5194
  /**
5045
- * Additional provider-specific metadata. They are passed through
5046
- * from the provider to the AI SDK and enable provider-specific
5047
- * results that can be fully encapsulated in the provider.
5195
+ * Response body.
5048
5196
  */
5049
- providerMetadata?: Record<string, JSONObject>;
5050
- }>;
5197
+ body?: unknown;
5198
+ };
5199
+ /**
5200
+ * Additional provider-specific metadata. They are passed through
5201
+ * from the provider to the AI SDK and enable provider-specific
5202
+ * results that can be fully encapsulated in the provider.
5203
+ */
5204
+ providerMetadata?: Record<string, JSONObject>;
5205
+ };
5206
+
5207
+ /**
5208
+ * Transcription model specification version 3.
5209
+ */
5210
+ type TranscriptionModelV4 = {
5211
+ /**
5212
+ * The transcription model must specify which transcription model interface
5213
+ * version it implements. This will allow us to evolve the transcription
5214
+ * model interface and retain backwards compatibility. The different
5215
+ * implementation versions can be handled as a discriminated union
5216
+ * on our side.
5217
+ */
5218
+ readonly specificationVersion: 'v4';
5219
+ /**
5220
+ * Name of the provider for logging purposes.
5221
+ */
5222
+ readonly provider: string;
5223
+ /**
5224
+ * Provider-specific model ID for logging purposes.
5225
+ */
5226
+ readonly modelId: string;
5227
+ /**
5228
+ * Generates a transcript.
5229
+ */
5230
+ doGenerate(options: TranscriptionModelV4CallOptions): PromiseLike<TranscriptionModelV4Result>;
5051
5231
  };
5052
5232
 
5233
+ interface SkillsV4File {
5234
+ /**
5235
+ * The path of the file relative to the skill root.
5236
+ */
5237
+ path: string;
5238
+ /**
5239
+ * The file data.
5240
+ *
5241
+ * - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or a base64-encoded string.
5242
+ * - `{ type: 'text', text }`: inline text (UTF-8).
5243
+ */
5244
+ data: SharedV4FileDataData | SharedV4FileDataText;
5245
+ }
5246
+ interface SkillsV4UploadSkillCallOptions {
5247
+ /**
5248
+ * The files that make up the skill.
5249
+ */
5250
+ files: SkillsV4File[];
5251
+ /**
5252
+ * Optional human-readable title for the skill.
5253
+ */
5254
+ displayTitle?: string;
5255
+ /**
5256
+ * Additional provider-specific options.
5257
+ */
5258
+ providerOptions?: SharedV4ProviderOptions;
5259
+ }
5260
+
5261
+ interface SkillsV4UploadSkillResult {
5262
+ /**
5263
+ * A provider reference mapping provider names to provider-specific skill identifiers.
5264
+ */
5265
+ providerReference: SharedV4ProviderReference;
5266
+ /**
5267
+ * Optional human-readable title for the uploaded skill.
5268
+ */
5269
+ displayTitle?: string;
5270
+ /**
5271
+ * Optional name of the uploaded skill.
5272
+ */
5273
+ name?: string;
5274
+ /**
5275
+ * Optional description of what the uploaded skill does.
5276
+ */
5277
+ description?: string;
5278
+ /**
5279
+ * Optional latest version identifier of the uploaded skill.
5280
+ */
5281
+ latestVersion?: string;
5282
+ /**
5283
+ * Additional provider-specific metadata.
5284
+ */
5285
+ providerMetadata?: SharedV4ProviderMetadata;
5286
+ /**
5287
+ * Warnings for the call, e.g. unsupported settings.
5288
+ */
5289
+ warnings: SharedV4Warning[];
5290
+ }
5291
+
5292
+ /**
5293
+ * Skills specification version 4.
5294
+ */
5295
+ interface SkillsV4 {
5296
+ /**
5297
+ * The skills implementation must specify which skills interface
5298
+ * version it implements. This will allow us to evolve the skills
5299
+ * interface and retain backwards compatibility. The different
5300
+ * implementation versions can be handled as a discriminated union
5301
+ * on our side.
5302
+ */
5303
+ readonly specificationVersion: 'v4';
5304
+ /**
5305
+ * Name of the provider for logging purposes.
5306
+ */
5307
+ readonly provider: string;
5308
+ /**
5309
+ * Uploads a new skill from the given files.
5310
+ */
5311
+ uploadSkill(params: SkillsV4UploadSkillCallOptions): PromiseLike<SkillsV4UploadSkillResult>;
5312
+ }
5313
+
5053
5314
  /**
5054
5315
  * Provider for language, text embedding, and image generation models.
5055
5316
  */
@@ -5115,6 +5376,18 @@ interface ProviderV4 {
5115
5376
  * @throws {NoSuchModelError} If no such model exists.
5116
5377
  */
5117
5378
  rerankingModel?(modelId: string): RerankingModelV4;
5379
+ /**
5380
+ * Returns the files interface for uploading files to the provider.
5381
+ * The returned interface can be passed to the `uploadFile` function.
5382
+ *
5383
+ * @returns {FilesV4} The files interface for this provider.
5384
+ */
5385
+ files?(): FilesV4;
5386
+ /**
5387
+ * Returns the skills interface for uploading skills to the provider.
5388
+ * The returned interface can be passed to the `uploadSkill` function.
5389
+ */
5390
+ skills?(): SkillsV4;
5118
5391
  }
5119
5392
 
5120
5393
  type RerankingModelV3CallOptions = {
@@ -5920,60 +6193,566 @@ interface ProviderV2 {
5920
6193
  }
5921
6194
 
5922
6195
  /**
5923
- * A video or image file that can be used for video editing or image-to-video generation.
5924
- * Supports both image inputs (for image-to-video) and video inputs (for editing).
6196
+ * A tool definition for realtime models. Sent as part of the session
6197
+ * configuration so the model knows which functions it can call.
5925
6198
  */
5926
- type VideoModelV4File = {
5927
- type: 'file';
5928
- /**
5929
- * The IANA media type of the file.
5930
- * Video types: 'video/mp4', 'video/webm', 'video/quicktime'
5931
- * Image types: 'image/png', 'image/jpeg', 'image/webp'
5932
- */
5933
- mediaType: string;
6199
+ type RealtimeModelV4ToolDefinition = {
5934
6200
  /**
5935
- * File data as base64 encoded string or binary data.
6201
+ * The type of the tool (always 'function').
5936
6202
  */
5937
- data: string | Uint8Array;
6203
+ type: 'function';
5938
6204
  /**
5939
- * Optional provider-specific metadata for the file part.
6205
+ * The name of the tool. Unique within the session.
5940
6206
  */
5941
- providerOptions?: SharedV4ProviderMetadata;
5942
- } | {
5943
- type: 'url';
6207
+ name: string;
5944
6208
  /**
5945
- * The URL of the video or image file.
6209
+ * A description of what the tool does. The model uses this to decide
6210
+ * whether to call the tool.
5946
6211
  */
5947
- url: string;
6212
+ description?: string;
5948
6213
  /**
5949
- * Optional provider-specific metadata for the file part.
6214
+ * JSON Schema describing the parameters the tool expects.
5950
6215
  */
5951
- providerOptions?: SharedV4ProviderMetadata;
6216
+ parameters: JSONSchema7;
5952
6217
  };
5953
6218
 
5954
- type VideoModelV4CallOptions = {
6219
+ /**
6220
+ * Provider-neutral configuration for a realtime session.
6221
+ * Each provider maps this to their specific session.update payload.
6222
+ */
6223
+ type RealtimeModelV4SessionConfig = {
5955
6224
  /**
5956
- * Text prompt for the video generation.
6225
+ * System instructions for the model.
5957
6226
  */
5958
- prompt: string | undefined;
6227
+ instructions?: string;
5959
6228
  /**
5960
- * Number of videos to generate. Default: 1.
5961
- * Most video models only support n=1 due to computational cost.
6229
+ * Voice to use for audio output.
5962
6230
  */
5963
- n: number;
6231
+ voice?: string;
5964
6232
  /**
5965
- * Aspect ratio of the videos to generate.
5966
- * Must have the format `{width}:{height}`.
5967
- * `undefined` will use the provider's default aspect ratio.
5968
- * Common values: '16:9', '9:16', '1:1', '21:9', '4:3'
6233
+ * Which output modalities the model should produce.
5969
6234
  */
5970
- aspectRatio: `${number}:${number}` | undefined;
6235
+ outputModalities?: Array<'text' | 'audio'>;
5971
6236
  /**
5972
- * Resolution of the video to generate.
5973
- * Format: `{width}x{height}` (e.g., '1280x720', '1920x1080')
5974
- * `undefined` will use the provider's default resolution.
6237
+ * Audio format configuration for input audio.
5975
6238
  */
5976
- resolution: `${number}x${number}` | undefined;
6239
+ inputAudioFormat?: {
6240
+ /**
6241
+ * Audio format type (e.g. "audio/pcm", "audio/pcmu", "audio/pcma").
6242
+ */
6243
+ type: string;
6244
+ /**
6245
+ * Sample rate in Hz. Only applicable for PCM format.
6246
+ */
6247
+ rate?: number;
6248
+ };
6249
+ /**
6250
+ * Input audio transcription configuration.
6251
+ *
6252
+ * When enabled, providers that support input transcription emit normalized
6253
+ * `input-transcription-completed` events that can be rendered as user
6254
+ * messages.
6255
+ */
6256
+ inputAudioTranscription?: {
6257
+ /**
6258
+ * Provider-specific transcription model.
6259
+ */
6260
+ model?: string;
6261
+ /**
6262
+ * Optional language hint for the input audio.
6263
+ */
6264
+ language?: string;
6265
+ /**
6266
+ * Optional prompt to guide transcription.
6267
+ */
6268
+ prompt?: string;
6269
+ };
6270
+ /**
6271
+ * Output audio transcription configuration.
6272
+ *
6273
+ * When enabled, providers that support output transcription emit normalized
6274
+ * `audio-transcript-delta` / `audio-transcript-done` events for the model's
6275
+ * spoken response. Some providers transcribe output by default; setting this
6276
+ * makes the behavior explicit rather than relying on that default.
6277
+ */
6278
+ outputAudioTranscription?: {
6279
+ /**
6280
+ * Provider-specific transcription model.
6281
+ */
6282
+ model?: string;
6283
+ /**
6284
+ * Optional language hint for the output audio.
6285
+ */
6286
+ language?: string;
6287
+ /**
6288
+ * Optional prompt to guide transcription.
6289
+ */
6290
+ prompt?: string;
6291
+ };
6292
+ /**
6293
+ * Audio format configuration for output audio.
6294
+ */
6295
+ outputAudioFormat?: {
6296
+ /**
6297
+ * Audio format type (e.g. "audio/pcm", "audio/pcmu", "audio/pcma").
6298
+ */
6299
+ type: string;
6300
+ /**
6301
+ * Sample rate in Hz. Only applicable for PCM format.
6302
+ */
6303
+ rate?: number;
6304
+ };
6305
+ /**
6306
+ * Voice activity detection configuration.
6307
+ * Set to null or type 'disabled' to turn off VAD (push-to-talk mode).
6308
+ */
6309
+ turnDetection?: {
6310
+ /**
6311
+ * VAD mode. 'server-vad' for automatic detection,
6312
+ * 'semantic-vad' for OpenAI's semantic detection,
6313
+ * 'disabled' to turn off VAD.
6314
+ */
6315
+ type: 'server-vad' | 'semantic-vad' | 'disabled';
6316
+ /**
6317
+ * VAD activation threshold (0.0-1.0).
6318
+ * Higher values require louder audio to trigger.
6319
+ */
6320
+ threshold?: number;
6321
+ /**
6322
+ * How long the user must be silent (in ms) before
6323
+ * the server ends the turn.
6324
+ */
6325
+ silenceDurationMs?: number;
6326
+ /**
6327
+ * Amount of audio (in ms) to include before the
6328
+ * detected start of speech.
6329
+ */
6330
+ prefixPaddingMs?: number;
6331
+ } | null;
6332
+ /**
6333
+ * Tool definitions available to the model in this session.
6334
+ */
6335
+ tools?: RealtimeModelV4ToolDefinition[];
6336
+ /**
6337
+ * Provider-specific options that are passed through to the provider.
6338
+ */
6339
+ providerOptions?: Record<string, unknown>;
6340
+ };
6341
+
6342
+ /**
6343
+ * Options for creating an ephemeral client secret for browser-side
6344
+ * WebSocket connections to a realtime model.
6345
+ */
6346
+ type RealtimeModelV4ClientSecretOptions = {
6347
+ /**
6348
+ * Number of seconds until the client secret expires.
6349
+ */
6350
+ expiresAfterSeconds?: number;
6351
+ /**
6352
+ * Optional session configuration to embed in the token request.
6353
+ * Some providers (e.g. Google) require the full session config at token creation time.
6354
+ */
6355
+ sessionConfig?: RealtimeModelV4SessionConfig;
6356
+ };
6357
+ /**
6358
+ * Result of creating an ephemeral client secret.
6359
+ */
6360
+ type RealtimeModelV4ClientSecretResult = {
6361
+ /**
6362
+ * The ephemeral token value. Used as a Bearer token or in the
6363
+ * WebSocket subprotocol header for authentication.
6364
+ */
6365
+ token: string;
6366
+ /**
6367
+ * The WebSocket URL to connect to. Includes any provider-specific
6368
+ * query parameters (e.g. model ID).
6369
+ */
6370
+ url: string;
6371
+ /**
6372
+ * Unix timestamp (seconds) when this client secret expires.
6373
+ */
6374
+ expiresAt?: number;
6375
+ };
6376
+
6377
+ /**
6378
+ * A conversation item that can be created by the client and sent to
6379
+ * the model via the conversation.item.create event.
6380
+ */
6381
+ type RealtimeModelV4ConversationItem = RealtimeModelV4TextMessage | RealtimeModelV4AudioMessage | RealtimeModelV4FunctionCallOutput;
6382
+ /**
6383
+ * A text message from the user.
6384
+ */
6385
+ type RealtimeModelV4TextMessage = {
6386
+ type: 'text-message';
6387
+ role: 'user';
6388
+ text: string;
6389
+ };
6390
+ /**
6391
+ * An audio message from the user (complete audio, not streamed).
6392
+ */
6393
+ type RealtimeModelV4AudioMessage = {
6394
+ type: 'audio-message';
6395
+ role: 'user';
6396
+ /**
6397
+ * Base64-encoded audio data.
6398
+ */
6399
+ audio: string;
6400
+ };
6401
+ /**
6402
+ * The output of a function call, sent back to the model so it can
6403
+ * continue generating a response using the tool result.
6404
+ */
6405
+ type RealtimeModelV4FunctionCallOutput = {
6406
+ type: 'function-call-output';
6407
+ /**
6408
+ * The call ID from the function-call-arguments-done event.
6409
+ * Must match so the model knows which function call this result is for.
6410
+ */
6411
+ callId: string;
6412
+ /**
6413
+ * The name of the function that was called.
6414
+ * Required by some providers (e.g. Google) in the tool response routing.
6415
+ */
6416
+ name?: string;
6417
+ /**
6418
+ * JSON string containing the function call result.
6419
+ */
6420
+ output: string;
6421
+ };
6422
+
6423
+ /**
6424
+ * Normalized events sent from the browser to the realtime model.
6425
+ * Each provider maps this to its native event format before sending
6426
+ * over the WebSocket.
6427
+ */
6428
+ type RealtimeModelV4ClientEvent = {
6429
+ type: 'session-update';
6430
+ config: RealtimeModelV4SessionConfig;
6431
+ } | {
6432
+ type: 'input-audio-append';
6433
+ /**
6434
+ * Base64-encoded audio chunk to append to the input buffer.
6435
+ */
6436
+ audio: string;
6437
+ } | {
6438
+ type: 'input-audio-commit';
6439
+ } | {
6440
+ type: 'input-audio-clear';
6441
+ } | {
6442
+ type: 'conversation-item-create';
6443
+ item: RealtimeModelV4ConversationItem;
6444
+ } | {
6445
+ type: 'conversation-item-truncate';
6446
+ /**
6447
+ * The ID of the assistant message item to truncate.
6448
+ */
6449
+ itemId: string;
6450
+ /**
6451
+ * The index of the content part to truncate.
6452
+ */
6453
+ contentIndex: number;
6454
+ /**
6455
+ * Truncate audio after this many milliseconds.
6456
+ */
6457
+ audioEndMs: number;
6458
+ } | {
6459
+ type: 'response-create';
6460
+ options?: {
6461
+ modalities?: string[];
6462
+ instructions?: string;
6463
+ metadata?: Record<string, unknown>;
6464
+ };
6465
+ } | {
6466
+ type: 'response-cancel';
6467
+ };
6468
+
6469
+ /**
6470
+ * Normalized events emitted by the realtime model (model → browser).
6471
+ * Each provider maps its native event format to this discriminated union.
6472
+ *
6473
+ * Every event includes a `raw` field with the original provider-specific
6474
+ * event data for debugging and provider-specific access.
6475
+ */
6476
+ type RealtimeModelV4ServerEvent = {
6477
+ type: 'session-created';
6478
+ sessionId?: string;
6479
+ raw: unknown;
6480
+ } | {
6481
+ type: 'session-updated';
6482
+ raw: unknown;
6483
+ } | {
6484
+ type: 'speech-started';
6485
+ itemId?: string;
6486
+ raw: unknown;
6487
+ } | {
6488
+ type: 'speech-stopped';
6489
+ itemId?: string;
6490
+ raw: unknown;
6491
+ } | {
6492
+ type: 'audio-committed';
6493
+ itemId?: string;
6494
+ previousItemId?: string;
6495
+ raw: unknown;
6496
+ } | {
6497
+ type: 'conversation-item-added';
6498
+ itemId: string;
6499
+ item: unknown;
6500
+ raw: unknown;
6501
+ } | {
6502
+ type: 'input-transcription-completed';
6503
+ itemId: string;
6504
+ transcript: string;
6505
+ raw: unknown;
6506
+ } | {
6507
+ type: 'response-created';
6508
+ responseId: string;
6509
+ raw: unknown;
6510
+ } | {
6511
+ type: 'response-done';
6512
+ responseId: string;
6513
+ status: string;
6514
+ raw: unknown;
6515
+ } | {
6516
+ type: 'output-item-added';
6517
+ responseId: string;
6518
+ itemId: string;
6519
+ raw: unknown;
6520
+ } | {
6521
+ type: 'output-item-done';
6522
+ responseId: string;
6523
+ itemId: string;
6524
+ raw: unknown;
6525
+ } | {
6526
+ type: 'content-part-added';
6527
+ responseId: string;
6528
+ itemId: string;
6529
+ raw: unknown;
6530
+ } | {
6531
+ type: 'content-part-done';
6532
+ responseId: string;
6533
+ itemId: string;
6534
+ raw: unknown;
6535
+ } | {
6536
+ type: 'audio-delta';
6537
+ responseId: string;
6538
+ itemId: string;
6539
+ /**
6540
+ * Base64-encoded audio chunk.
6541
+ */
6542
+ delta: string;
6543
+ raw: unknown;
6544
+ } | {
6545
+ type: 'audio-done';
6546
+ responseId: string;
6547
+ itemId: string;
6548
+ raw: unknown;
6549
+ } | {
6550
+ type: 'audio-transcript-delta';
6551
+ responseId: string;
6552
+ itemId: string;
6553
+ /**
6554
+ * Text chunk of the audio transcript.
6555
+ */
6556
+ delta: string;
6557
+ raw: unknown;
6558
+ } | {
6559
+ type: 'audio-transcript-done';
6560
+ responseId: string;
6561
+ itemId: string;
6562
+ transcript?: string;
6563
+ raw: unknown;
6564
+ } | {
6565
+ type: 'text-delta';
6566
+ responseId: string;
6567
+ itemId: string;
6568
+ /**
6569
+ * Text chunk of the model's text response.
6570
+ */
6571
+ delta: string;
6572
+ raw: unknown;
6573
+ } | {
6574
+ type: 'text-done';
6575
+ responseId: string;
6576
+ itemId: string;
6577
+ text?: string;
6578
+ raw: unknown;
6579
+ } | {
6580
+ type: 'function-call-arguments-delta';
6581
+ responseId: string;
6582
+ itemId: string;
6583
+ callId: string;
6584
+ /**
6585
+ * Partial JSON string of function call arguments.
6586
+ */
6587
+ delta: string;
6588
+ raw: unknown;
6589
+ } | {
6590
+ type: 'function-call-arguments-done';
6591
+ responseId: string;
6592
+ itemId: string;
6593
+ callId: string;
6594
+ /**
6595
+ * The name of the function to call.
6596
+ */
6597
+ name: string;
6598
+ /**
6599
+ * Complete JSON string of function call arguments.
6600
+ */
6601
+ arguments: string;
6602
+ raw: unknown;
6603
+ } | {
6604
+ type: 'error';
6605
+ message: string;
6606
+ code?: string;
6607
+ raw: unknown;
6608
+ } | {
6609
+ type: 'custom';
6610
+ /**
6611
+ * The original event type string from the provider.
6612
+ */
6613
+ rawType: string;
6614
+ raw: unknown;
6615
+ };
6616
+
6617
+ /**
6618
+ * Specification for a realtime model that supports bidirectional
6619
+ * audio/text communication over WebSocket.
6620
+ *
6621
+ * Providers implement this interface to enable realtime voice
6622
+ * conversations through the AI SDK.
6623
+ */
6624
+ type RealtimeModelV4 = {
6625
+ /**
6626
+ * The realtime model must specify which interface version it implements.
6627
+ */
6628
+ readonly specificationVersion: 'v4';
6629
+ /**
6630
+ * Provider ID (e.g. 'openai', 'xai').
6631
+ */
6632
+ readonly provider: string;
6633
+ /**
6634
+ * Provider-specific model ID (e.g. 'gpt-4o-realtime', 'grok-3').
6635
+ */
6636
+ readonly modelId: string;
6637
+ /**
6638
+ * Server-side: Creates an ephemeral client secret for authenticating
6639
+ * browser-side WebSocket connections. The secret is short-lived and
6640
+ * safe to expose to client code.
6641
+ *
6642
+ * Naming: "do" prefix to prevent accidental direct usage by the user.
6643
+ */
6644
+ doCreateClientSecret(options: RealtimeModelV4ClientSecretOptions): PromiseLike<RealtimeModelV4ClientSecretResult>;
6645
+ /**
6646
+ * Browser-side: Returns the WebSocket URL and subprotocols to use
6647
+ * when connecting. Each provider has its own authentication mechanism
6648
+ * (e.g. OpenAI uses subprotocol headers, xAI may use query params).
6649
+ */
6650
+ getWebSocketConfig(options: {
6651
+ token: string;
6652
+ url: string;
6653
+ }): {
6654
+ url: string;
6655
+ protocols?: string[];
6656
+ };
6657
+ /**
6658
+ * Browser-side: Parses a raw JSON event received over the WebSocket
6659
+ * and returns one or more normalized events. Providers map their native
6660
+ * event format to the common RealtimeModelV4ServerEvent union.
6661
+ *
6662
+ * Returns an array when a single provider message maps to multiple
6663
+ * normalized events (e.g. Google's serverContent can contain audio,
6664
+ * text, and turn-complete data in one message).
6665
+ */
6666
+ parseServerEvent(raw: unknown): RealtimeModelV4ServerEvent | RealtimeModelV4ServerEvent[];
6667
+ /**
6668
+ * Browser-side: Serializes a normalized client event into the
6669
+ * provider's native JSON format for sending over the WebSocket.
6670
+ */
6671
+ serializeClientEvent(event: RealtimeModelV4ClientEvent): unknown | PromiseLike<unknown>;
6672
+ /**
6673
+ * Browser-side: Builds the provider-specific session configuration
6674
+ * payload from a normalized session config. Used to construct the
6675
+ * session.update event sent after WebSocket connection.
6676
+ */
6677
+ buildSessionConfig(config: RealtimeModelV4SessionConfig): unknown;
6678
+ /**
6679
+ * Browser-side: Returns a message to auto-send back over the WebSocket
6680
+ * in response to a raw incoming message, or null if no response is needed.
6681
+ *
6682
+ * Used for provider-specific keepalive protocols (e.g. ping/pong).
6683
+ * Called by the session layer before parseServerEvent.
6684
+ */
6685
+ getHealthCheckResponse?(raw: unknown): unknown | null;
6686
+ };
6687
+
6688
+ type RealtimeFactoryV4GetTokenOptions = {
6689
+ model: string;
6690
+ } & RealtimeModelV4ClientSecretOptions;
6691
+ type RealtimeFactoryV4GetTokenResult = {
6692
+ token: string;
6693
+ url: string;
6694
+ expiresAt?: number;
6695
+ };
6696
+ interface RealtimeFactoryV4 {
6697
+ (modelId: string): RealtimeModelV4;
6698
+ getToken(options: RealtimeFactoryV4GetTokenOptions): Promise<RealtimeFactoryV4GetTokenResult>;
6699
+ }
6700
+
6701
+ /**
6702
+ * A video or image file that can be used for video editing or image-to-video generation.
6703
+ * Supports both image inputs (for image-to-video) and video inputs (for editing).
6704
+ */
6705
+ type VideoModelV4File = {
6706
+ type: 'file';
6707
+ /**
6708
+ * The IANA media type of the file.
6709
+ * Video types: 'video/mp4', 'video/webm', 'video/quicktime'
6710
+ * Image types: 'image/png', 'image/jpeg', 'image/webp'
6711
+ */
6712
+ mediaType: string;
6713
+ /**
6714
+ * File data as base64 encoded string or binary data.
6715
+ */
6716
+ data: string | Uint8Array;
6717
+ /**
6718
+ * Optional provider-specific metadata for the file part.
6719
+ */
6720
+ providerOptions?: SharedV4ProviderMetadata;
6721
+ } | {
6722
+ type: 'url';
6723
+ /**
6724
+ * The URL of the video or image file.
6725
+ */
6726
+ url: string;
6727
+ /**
6728
+ * Optional provider-specific metadata for the file part.
6729
+ */
6730
+ providerOptions?: SharedV4ProviderMetadata;
6731
+ };
6732
+
6733
+ type VideoModelV4CallOptions = {
6734
+ /**
6735
+ * Text prompt for the video generation.
6736
+ */
6737
+ prompt: string | undefined;
6738
+ /**
6739
+ * Number of videos to generate. Default: 1.
6740
+ * Most video models only support n=1 due to computational cost.
6741
+ */
6742
+ n: number;
6743
+ /**
6744
+ * Aspect ratio of the videos to generate.
6745
+ * Must have the format `{width}:{height}`.
6746
+ * `undefined` will use the provider's default aspect ratio.
6747
+ * Common values: '16:9', '9:16', '1:1', '21:9', '4:3'
6748
+ */
6749
+ aspectRatio: `${number}:${number}` | undefined;
6750
+ /**
6751
+ * Resolution of the video to generate.
6752
+ * Format: `{width}x{height}` (e.g., '1280x720', '1920x1080')
6753
+ * `undefined` will use the provider's default resolution.
6754
+ */
6755
+ resolution: `${number}x${number}` | undefined;
5977
6756
  /**
5978
6757
  * Duration of the video in seconds.
5979
6758
  * `undefined` will use the provider's default duration.
@@ -5996,6 +6775,10 @@ type VideoModelV4CallOptions = {
5996
6775
  * The image serves as the starting frame that the model will animate.
5997
6776
  */
5998
6777
  image: VideoModelV4File | undefined;
6778
+ /**
6779
+ * Whether the model should generate audio alongside the video.
6780
+ */
6781
+ generateAudio: boolean | undefined;
5999
6782
  /**
6000
6783
  * Additional provider-specific options that are passed through to the provider
6001
6784
  * as body parameters.
@@ -6020,9 +6803,6 @@ type VideoModelV4CallOptions = {
6020
6803
  headers?: Record<string, string | undefined>;
6021
6804
  };
6022
6805
 
6023
- type GetMaxVideosPerCallFunction$1 = (options: {
6024
- modelId: string;
6025
- }) => PromiseLike<number | undefined> | number | undefined;
6026
6806
  /**
6027
6807
  * Generated video data. Can be a URL, base64-encoded string, or binary data.
6028
6808
  */
@@ -6048,6 +6828,65 @@ type VideoModelV4VideoData = {
6048
6828
  data: Uint8Array;
6049
6829
  mediaType: string;
6050
6830
  };
6831
+ /**
6832
+ * The result of a video model doGenerate call.
6833
+ */
6834
+ type VideoModelV4Result = {
6835
+ /**
6836
+ * Generated videos as URLs, base64 strings, or binary data.
6837
+ *
6838
+ * Most providers return URLs to video files (MP4, WebM) due to large file sizes.
6839
+ * Use the discriminated union to indicate the type of video data being returned.
6840
+ */
6841
+ videos: Array<VideoModelV4VideoData>;
6842
+ /**
6843
+ * Warnings for the call, e.g. unsupported features.
6844
+ */
6845
+ warnings: Array<SharedV4Warning>;
6846
+ /**
6847
+ * Additional provider-specific metadata. They are passed through
6848
+ * from the provider to the AI SDK and enable provider-specific
6849
+ * results that can be fully encapsulated in the provider.
6850
+ *
6851
+ * The outer record is keyed by the provider name, and the inner
6852
+ * record is provider-specific metadata.
6853
+ *
6854
+ * ```ts
6855
+ * {
6856
+ * "fal": {
6857
+ * "videos": [{
6858
+ * "duration": 5.0,
6859
+ * "fps": 24,
6860
+ * "width": 1280,
6861
+ * "height": 720
6862
+ * }]
6863
+ * }
6864
+ * }
6865
+ * ```
6866
+ */
6867
+ providerMetadata?: SharedV4ProviderMetadata;
6868
+ /**
6869
+ * Response information for telemetry and debugging purposes.
6870
+ */
6871
+ response: {
6872
+ /**
6873
+ * Timestamp for the start of the generated response.
6874
+ */
6875
+ timestamp: Date;
6876
+ /**
6877
+ * The ID of the response model that was used to generate the response.
6878
+ */
6879
+ modelId: string;
6880
+ /**
6881
+ * Response headers.
6882
+ */
6883
+ headers: Record<string, string> | undefined;
6884
+ };
6885
+ };
6886
+
6887
+ type GetMaxVideosPerCallFunction$1 = (options: {
6888
+ modelId: string;
6889
+ }) => PromiseLike<number | undefined> | number | undefined;
6051
6890
  /**
6052
6891
  * Video generation model specification version 3.
6053
6892
  */
@@ -6081,58 +6920,7 @@ type VideoModelV4 = {
6081
6920
  /**
6082
6921
  * Generates an array of videos.
6083
6922
  */
6084
- doGenerate(options: VideoModelV4CallOptions): PromiseLike<{
6085
- /**
6086
- * Generated videos as URLs, base64 strings, or binary data.
6087
- *
6088
- * Most providers return URLs to video files (MP4, WebM) due to large file sizes.
6089
- * Use the discriminated union to indicate the type of video data being returned.
6090
- */
6091
- videos: Array<VideoModelV4VideoData>;
6092
- /**
6093
- * Warnings for the call, e.g. unsupported features.
6094
- */
6095
- warnings: Array<SharedV4Warning>;
6096
- /**
6097
- * Additional provider-specific metadata. They are passed through
6098
- * from the provider to the AI SDK and enable provider-specific
6099
- * results that can be fully encapsulated in the provider.
6100
- *
6101
- * The outer record is keyed by the provider name, and the inner
6102
- * record is provider-specific metadata.
6103
- *
6104
- * ```ts
6105
- * {
6106
- * "fal": {
6107
- * "videos": [{
6108
- * "duration": 5.0,
6109
- * "fps": 24,
6110
- * "width": 1280,
6111
- * "height": 720
6112
- * }]
6113
- * }
6114
- * }
6115
- * ```
6116
- */
6117
- providerMetadata?: SharedV4ProviderMetadata;
6118
- /**
6119
- * Response information for telemetry and debugging purposes.
6120
- */
6121
- response: {
6122
- /**
6123
- * Timestamp for the start of the generated response.
6124
- */
6125
- timestamp: Date;
6126
- /**
6127
- * The ID of the response model that was used to generate the response.
6128
- */
6129
- modelId: string;
6130
- /**
6131
- * Response headers.
6132
- */
6133
- headers: Record<string, string> | undefined;
6134
- };
6135
- }>;
6923
+ doGenerate(options: VideoModelV4CallOptions): PromiseLike<VideoModelV4Result>;
6136
6924
  };
6137
6925
 
6138
6926
  /**
@@ -6212,6 +7000,10 @@ type VideoModelV3CallOptions = {
6212
7000
  * The image serves as the starting frame that the model will animate.
6213
7001
  */
6214
7002
  image: VideoModelV3File | undefined;
7003
+ /**
7004
+ * Whether the model should generate audio alongside the video.
7005
+ */
7006
+ generateAudio: boolean | undefined;
6215
7007
  /**
6216
7008
  * Additional provider-specific options that are passed through to the provider
6217
7009
  * as body parameters.
@@ -6351,4 +7143,4 @@ type VideoModelV3 = {
6351
7143
  }>;
6352
7144
  };
6353
7145
 
6354
- export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, type EmbeddingModelV4, type EmbeddingModelV4CallOptions, type EmbeddingModelV4Embedding, type EmbeddingModelV4Middleware, type EmbeddingModelV4Result, EmptyResponseBodyError, type VideoModelV3 as Experimental_VideoModelV3, type VideoModelV3CallOptions as Experimental_VideoModelV3CallOptions, type VideoModelV3File as Experimental_VideoModelV3File, type VideoModelV3VideoData as Experimental_VideoModelV3VideoData, type VideoModelV4 as Experimental_VideoModelV4, type VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions, type VideoModelV4File as Experimental_VideoModelV4File, type VideoModelV4VideoData as Experimental_VideoModelV4VideoData, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, type ImageModelV4, type ImageModelV4CallOptions, type ImageModelV4File, type ImageModelV4Middleware, type ImageModelV4ProviderMetadata, type ImageModelV4Usage, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, type LanguageModelV4, type LanguageModelV4CallOptions, type LanguageModelV4Content, type LanguageModelV4DataContent, type LanguageModelV4File, type LanguageModelV4FilePart, type LanguageModelV4FinishReason, type LanguageModelV4FunctionTool, type LanguageModelV4GenerateResult, type LanguageModelV4Message, type LanguageModelV4Middleware, type LanguageModelV4Prompt, type LanguageModelV4ProviderTool, type LanguageModelV4Reasoning, type LanguageModelV4ReasoningFile, type LanguageModelV4ReasoningFilePart, type LanguageModelV4ReasoningPart, type LanguageModelV4ResponseMetadata, type LanguageModelV4Source, type LanguageModelV4StreamPart, type LanguageModelV4StreamResult, type LanguageModelV4Text, type LanguageModelV4TextPart, type LanguageModelV4ToolApprovalRequest, type LanguageModelV4ToolApprovalResponsePart, type LanguageModelV4ToolCall, type LanguageModelV4ToolCallPart, type LanguageModelV4ToolChoice, type LanguageModelV4ToolResult, type LanguageModelV4ToolResultOutput, type LanguageModelV4ToolResultPart, type LanguageModelV4Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV2, type ProviderV3, type ProviderV4, type RerankingModelV3, type RerankingModelV3CallOptions, type RerankingModelV4, type RerankingModelV4CallOptions, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SharedV3Headers, type SharedV3ProviderMetadata, type SharedV3ProviderOptions, type SharedV3Warning, type SharedV4Headers, type SharedV4ProviderMetadata, type SharedV4ProviderOptions, type SharedV4Warning, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, type SpeechModelV3, type SpeechModelV3CallOptions, type SpeechModelV4, type SpeechModelV4CallOptions, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, type TranscriptionModelV3, type TranscriptionModelV3CallOptions, type TranscriptionModelV4, type TranscriptionModelV4CallOptions, type TypeValidationContext, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
7146
+ export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, type EmbeddingModelV4, type EmbeddingModelV4CallOptions, type EmbeddingModelV4Embedding, type EmbeddingModelV4Middleware, type EmbeddingModelV4Result, EmptyResponseBodyError, type RealtimeFactoryV4 as Experimental_RealtimeFactoryV4, type RealtimeFactoryV4GetTokenOptions as Experimental_RealtimeFactoryV4GetTokenOptions, type RealtimeFactoryV4GetTokenResult as Experimental_RealtimeFactoryV4GetTokenResult, type RealtimeModelV4 as Experimental_RealtimeModelV4, type RealtimeModelV4AudioMessage as Experimental_RealtimeModelV4AudioMessage, type RealtimeModelV4ClientEvent as Experimental_RealtimeModelV4ClientEvent, type RealtimeModelV4ClientSecretOptions as Experimental_RealtimeModelV4ClientSecretOptions, type RealtimeModelV4ClientSecretResult as Experimental_RealtimeModelV4ClientSecretResult, type RealtimeModelV4ConversationItem as Experimental_RealtimeModelV4ConversationItem, type RealtimeModelV4FunctionCallOutput as Experimental_RealtimeModelV4FunctionCallOutput, type RealtimeModelV4ServerEvent as Experimental_RealtimeModelV4ServerEvent, type RealtimeModelV4SessionConfig as Experimental_RealtimeModelV4SessionConfig, type RealtimeModelV4TextMessage as Experimental_RealtimeModelV4TextMessage, type RealtimeModelV4ToolDefinition as Experimental_RealtimeModelV4ToolDefinition, type VideoModelV3 as Experimental_VideoModelV3, type VideoModelV3CallOptions as Experimental_VideoModelV3CallOptions, type VideoModelV3File as Experimental_VideoModelV3File, type VideoModelV3VideoData as Experimental_VideoModelV3VideoData, type VideoModelV4 as Experimental_VideoModelV4, type VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions, type VideoModelV4File as Experimental_VideoModelV4File, type VideoModelV4Result as Experimental_VideoModelV4Result, type VideoModelV4VideoData as Experimental_VideoModelV4VideoData, type FilesV4, type FilesV4UploadFileCallOptions, type FilesV4UploadFileResult, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, type ImageModelV4, type ImageModelV4CallOptions, type ImageModelV4File, type ImageModelV4Middleware, type ImageModelV4ProviderMetadata, type ImageModelV4Result, type ImageModelV4Usage, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, type LanguageModelV4, type LanguageModelV4CallOptions, type LanguageModelV4Content, type LanguageModelV4CustomContent, type LanguageModelV4CustomPart, type LanguageModelV4File, type LanguageModelV4FilePart, type LanguageModelV4FinishReason, type LanguageModelV4FunctionTool, type LanguageModelV4GenerateResult, type LanguageModelV4Message, type LanguageModelV4Middleware, type LanguageModelV4Prompt, type LanguageModelV4ProviderTool, type LanguageModelV4Reasoning, type LanguageModelV4ReasoningFile, type LanguageModelV4ReasoningFilePart, type LanguageModelV4ReasoningPart, type LanguageModelV4ResponseMetadata, type LanguageModelV4Source, type LanguageModelV4StreamPart, type LanguageModelV4StreamResult, type LanguageModelV4Text, type LanguageModelV4TextPart, type LanguageModelV4ToolApprovalRequest, type LanguageModelV4ToolApprovalResponsePart, type LanguageModelV4ToolCall, type LanguageModelV4ToolCallPart, type LanguageModelV4ToolChoice, type LanguageModelV4ToolResult, type LanguageModelV4ToolResultOutput, type LanguageModelV4ToolResultPart, type LanguageModelV4Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, NoSuchProviderReferenceError, type ProviderV2, type ProviderV3, type ProviderV4, type RerankingModelV3, type RerankingModelV3CallOptions, type RerankingModelV4, type RerankingModelV4CallOptions, type RerankingModelV4Result, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SharedV3Headers, type SharedV3ProviderMetadata, type SharedV3ProviderOptions, type SharedV3Warning, type SharedV4FileData, type SharedV4FileDataData, type SharedV4FileDataReference, type SharedV4FileDataText, type SharedV4FileDataUrl, type SharedV4Headers, type SharedV4ProviderMetadata, type SharedV4ProviderOptions, type SharedV4ProviderReference, type SharedV4Warning, type SkillsV4, type SkillsV4File, type SkillsV4UploadSkillCallOptions, type SkillsV4UploadSkillResult, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, type SpeechModelV3, type SpeechModelV3CallOptions, type SpeechModelV4, type SpeechModelV4CallOptions, type SpeechModelV4Result, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, type TranscriptionModelV3, type TranscriptionModelV3CallOptions, type TranscriptionModelV4, type TranscriptionModelV4CallOptions, type TranscriptionModelV4Result, type TypeValidationContext, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };