@ai-sdk/provider 4.0.0-beta.1 → 4.0.0-beta.10

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 (48) hide show
  1. package/CHANGELOG.md +68 -13
  2. package/dist/index.d.mts +681 -366
  3. package/dist/index.d.ts +681 -366
  4. package/dist/index.js +54 -31
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +51 -29
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +2 -4
  9. package/src/errors/get-error-message.ts +1 -1
  10. package/src/errors/index.ts +1 -0
  11. package/src/errors/no-such-provider-reference-error.ts +35 -0
  12. package/src/files/index.ts +1 -0
  13. package/src/files/v4/files-v4-upload-file-call-options.ts +28 -0
  14. package/src/files/v4/files-v4-upload-file-result.ts +35 -0
  15. package/src/files/v4/files-v4.ts +25 -0
  16. package/src/files/v4/index.ts +3 -0
  17. package/src/image-model/v4/image-model-v4-result.ts +73 -0
  18. package/src/image-model/v4/image-model-v4.ts +2 -69
  19. package/src/image-model/v4/index.ts +4 -3
  20. package/src/index.ts +2 -0
  21. package/src/language-model/v4/index.ts +2 -0
  22. package/src/language-model/v4/language-model-v4-call-options.ts +13 -0
  23. package/src/language-model/v4/language-model-v4-content.ts +4 -0
  24. package/src/language-model/v4/language-model-v4-custom-content.ts +21 -0
  25. package/src/language-model/v4/language-model-v4-prompt.ts +61 -19
  26. package/src/language-model/v4/language-model-v4-reasoning-file.ts +32 -0
  27. package/src/language-model/v4/language-model-v4-stream-part.ts +4 -0
  28. package/src/provider/v4/provider-v4.ts +16 -0
  29. package/src/reranking-model/v4/index.ts +1 -0
  30. package/src/reranking-model/v4/reranking-model-v4-result.ts +68 -0
  31. package/src/reranking-model/v4/reranking-model-v4.ts +4 -64
  32. package/src/shared/v4/index.ts +1 -0
  33. package/src/shared/v4/shared-v4-provider-reference.ts +15 -0
  34. package/src/shared/v4/shared-v4-warning.ts +16 -0
  35. package/src/skills/index.ts +1 -0
  36. package/src/skills/v4/index.ts +6 -0
  37. package/src/skills/v4/skills-v4-upload-skill-call-options.ts +30 -0
  38. package/src/skills/v4/skills-v4-upload-skill-result.ts +40 -0
  39. package/src/skills/v4/skills-v4.ts +28 -0
  40. package/src/speech-model/v4/index.ts +1 -0
  41. package/src/speech-model/v4/speech-model-v4-result.ts +64 -0
  42. package/src/speech-model/v4/speech-model-v4.ts +4 -60
  43. package/src/transcription-model/v4/index.ts +1 -0
  44. package/src/transcription-model/v4/transcription-model-v4-result.ts +92 -0
  45. package/src/transcription-model/v4/transcription-model-v4.ts +4 -88
  46. package/src/video-model/v4/index.ts +4 -3
  47. package/src/video-model/v4/video-model-v4-result.ts +92 -0
  48. package/src/video-model/v4/video-model-v4.ts +2 -88
package/dist/index.d.mts CHANGED
@@ -59,6 +59,22 @@ type SharedV4ProviderMetadata = Record<string, JSONObject>;
59
59
  */
60
60
  type SharedV4ProviderOptions = Record<string, JSONObject>;
61
61
 
62
+ /**
63
+ * A mapping of provider names to provider-specific file identifiers.
64
+ *
65
+ * Provider references allow files to be identified across different
66
+ * providers without re-uploading, by storing each provider's own
67
+ * identifier for the same logical file.
68
+ *
69
+ * ```ts
70
+ * {
71
+ * "openai": "file-abc123",
72
+ * "anthropic": "file-xyz789"
73
+ * }
74
+ * ```
75
+ */
76
+ type SharedV4ProviderReference = Record<string, string>;
77
+
62
78
  /**
63
79
  * Warning from the model.
64
80
  *
@@ -91,6 +107,19 @@ type SharedV4Warning = {
91
107
  * Additional details about the warning.
92
108
  */
93
109
  details?: string;
110
+ } | {
111
+ /**
112
+ * A deprecated feature or option is being used.
113
+ */
114
+ type: 'deprecated';
115
+ /**
116
+ * The deprecated setting or feature name.
117
+ */
118
+ setting: string;
119
+ /**
120
+ * A human-readable message explaining what to use instead.
121
+ */
122
+ message: string;
94
123
  } | {
95
124
  /**
96
125
  * Other warning.
@@ -559,13 +588,13 @@ type EmbeddingModelV2<VALUE> = {
559
588
  }>;
560
589
  };
561
590
 
562
- declare const symbol$d: unique symbol;
591
+ declare const symbol$e: unique symbol;
563
592
  /**
564
593
  * Custom error class for AI SDK related errors.
565
594
  * @extends Error
566
595
  */
567
596
  declare class AISDKError extends Error {
568
- private readonly [symbol$d];
597
+ private readonly [symbol$e];
569
598
  /**
570
599
  * The underlying cause of the error, if any.
571
600
  */
@@ -592,9 +621,9 @@ declare class AISDKError extends Error {
592
621
  protected static hasMarker(error: unknown, marker: string): boolean;
593
622
  }
594
623
 
595
- declare const symbol$c: unique symbol;
624
+ declare const symbol$d: unique symbol;
596
625
  declare class APICallError extends AISDKError {
597
- private readonly [symbol$c];
626
+ private readonly [symbol$d];
598
627
  readonly url: string;
599
628
  readonly requestBodyValues: unknown;
600
629
  readonly statusCode?: number;
@@ -617,9 +646,9 @@ declare class APICallError extends AISDKError {
617
646
  static isInstance(error: unknown): error is APICallError;
618
647
  }
619
648
 
620
- declare const symbol$b: unique symbol;
649
+ declare const symbol$c: unique symbol;
621
650
  declare class EmptyResponseBodyError extends AISDKError {
622
- private readonly [symbol$b];
651
+ private readonly [symbol$c];
623
652
  constructor({ message }?: {
624
653
  message?: string;
625
654
  });
@@ -628,12 +657,12 @@ declare class EmptyResponseBodyError extends AISDKError {
628
657
 
629
658
  declare function getErrorMessage(error: unknown | undefined): string;
630
659
 
631
- declare const symbol$a: unique symbol;
660
+ declare const symbol$b: unique symbol;
632
661
  /**
633
662
  * A function argument is invalid.
634
663
  */
635
664
  declare class InvalidArgumentError extends AISDKError {
636
- private readonly [symbol$a];
665
+ private readonly [symbol$b];
637
666
  readonly argument: string;
638
667
  constructor({ message, cause, argument, }: {
639
668
  argument: string;
@@ -643,13 +672,13 @@ declare class InvalidArgumentError extends AISDKError {
643
672
  static isInstance(error: unknown): error is InvalidArgumentError;
644
673
  }
645
674
 
646
- declare const symbol$9: unique symbol;
675
+ declare const symbol$a: unique symbol;
647
676
  /**
648
677
  * A prompt is invalid. This error should be thrown by providers when they cannot
649
678
  * process a prompt.
650
679
  */
651
680
  declare class InvalidPromptError extends AISDKError {
652
- private readonly [symbol$9];
681
+ private readonly [symbol$a];
653
682
  readonly prompt: unknown;
654
683
  constructor({ prompt, message, cause, }: {
655
684
  prompt: unknown;
@@ -659,13 +688,13 @@ declare class InvalidPromptError extends AISDKError {
659
688
  static isInstance(error: unknown): error is InvalidPromptError;
660
689
  }
661
690
 
662
- declare const symbol$8: unique symbol;
691
+ declare const symbol$9: unique symbol;
663
692
  /**
664
693
  * Server returned a response with invalid data content.
665
694
  * This should be thrown by providers when they cannot parse the response from the API.
666
695
  */
667
696
  declare class InvalidResponseDataError extends AISDKError {
668
- private readonly [symbol$8];
697
+ private readonly [symbol$9];
669
698
  readonly data: unknown;
670
699
  constructor({ data, message, }: {
671
700
  data: unknown;
@@ -674,9 +703,9 @@ declare class InvalidResponseDataError extends AISDKError {
674
703
  static isInstance(error: unknown): error is InvalidResponseDataError;
675
704
  }
676
705
 
677
- declare const symbol$7: unique symbol;
706
+ declare const symbol$8: unique symbol;
678
707
  declare class JSONParseError extends AISDKError {
679
- private readonly [symbol$7];
708
+ private readonly [symbol$8];
680
709
  readonly text: string;
681
710
  constructor({ text, cause }: {
682
711
  text: string;
@@ -685,39 +714,39 @@ declare class JSONParseError extends AISDKError {
685
714
  static isInstance(error: unknown): error is JSONParseError;
686
715
  }
687
716
 
688
- declare const symbol$6: unique symbol;
717
+ declare const symbol$7: unique symbol;
689
718
  declare class LoadAPIKeyError extends AISDKError {
690
- private readonly [symbol$6];
719
+ private readonly [symbol$7];
691
720
  constructor({ message }: {
692
721
  message: string;
693
722
  });
694
723
  static isInstance(error: unknown): error is LoadAPIKeyError;
695
724
  }
696
725
 
697
- declare const symbol$5: unique symbol;
726
+ declare const symbol$6: unique symbol;
698
727
  declare class LoadSettingError extends AISDKError {
699
- private readonly [symbol$5];
728
+ private readonly [symbol$6];
700
729
  constructor({ message }: {
701
730
  message: string;
702
731
  });
703
732
  static isInstance(error: unknown): error is LoadSettingError;
704
733
  }
705
734
 
706
- declare const symbol$4: unique symbol;
735
+ declare const symbol$5: unique symbol;
707
736
  /**
708
737
  * Thrown when the AI provider fails to generate any content.
709
738
  */
710
739
  declare class NoContentGeneratedError extends AISDKError {
711
- private readonly [symbol$4];
740
+ private readonly [symbol$5];
712
741
  constructor({ message, }?: {
713
742
  message?: string;
714
743
  });
715
744
  static isInstance(error: unknown): error is NoContentGeneratedError;
716
745
  }
717
746
 
718
- declare const symbol$3: unique symbol;
747
+ declare const symbol$4: unique symbol;
719
748
  declare class NoSuchModelError extends AISDKError {
720
- private readonly [symbol$3];
749
+ private readonly [symbol$4];
721
750
  readonly modelId: string;
722
751
  readonly modelType: 'languageModel' | 'embeddingModel' | 'imageModel' | 'transcriptionModel' | 'speechModel' | 'rerankingModel' | 'videoModel';
723
752
  constructor({ errorName, modelId, modelType, message, }: {
@@ -729,6 +758,23 @@ declare class NoSuchModelError extends AISDKError {
729
758
  static isInstance(error: unknown): error is NoSuchModelError;
730
759
  }
731
760
 
761
+ declare const symbol$3: unique symbol;
762
+ /**
763
+ * Thrown when a provider reference cannot be resolved because the specified
764
+ * provider is not found in the provider reference mapping.
765
+ */
766
+ declare class NoSuchProviderReferenceError extends AISDKError {
767
+ private readonly [symbol$3];
768
+ readonly provider: string;
769
+ readonly reference: SharedV4ProviderReference;
770
+ constructor({ provider, reference, message, }: {
771
+ provider: string;
772
+ reference: SharedV4ProviderReference;
773
+ message?: string;
774
+ });
775
+ static isInstance(error: unknown): error is NoSuchProviderReferenceError;
776
+ }
777
+
732
778
  declare const symbol$2: unique symbol;
733
779
  declare class TooManyEmbeddingValuesForCallError extends AISDKError {
734
780
  private readonly [symbol$2];
@@ -799,26 +845,75 @@ declare class UnsupportedFunctionalityError extends AISDKError {
799
845
  static isInstance(error: unknown): error is UnsupportedFunctionalityError;
800
846
  }
801
847
 
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;
848
+ /**
849
+ * Options for uploading a file via the files interface.
850
+ */
851
+ type FilesV4UploadFileCallOptions = {
852
+ /**
853
+ * The file data as raw bytes or a base64-encoded string.
854
+ */
855
+ data: Uint8Array | string;
856
+ /**
857
+ * The IANA media type of the file (e.g. `'application/pdf'`).
858
+ */
859
+ mediaType: string;
860
+ /**
861
+ * The filename of the file.
862
+ */
863
+ filename?: string;
864
+ /**
865
+ * Additional provider-specific options. They are passed through
866
+ * to the provider from the AI SDK and enable provider-specific
867
+ * functionality that can be fully encapsulated in the provider.
868
+ */
869
+ providerOptions?: SharedV4ProviderOptions;
870
+ };
805
871
 
806
872
  /**
807
- * Usage information for an image model call.
873
+ * Result of uploading a file via the files interface.
808
874
  */
809
- type ImageModelV4Usage = {
875
+ type FilesV4UploadFileResult = {
810
876
  /**
811
- * The number of input (prompt) tokens used.
877
+ * A provider reference mapping provider names to provider-specific file identifiers.
812
878
  */
813
- inputTokens: number | undefined;
879
+ providerReference: SharedV4ProviderReference;
814
880
  /**
815
- * The number of output tokens used, if reported by the provider.
881
+ * The IANA media type of the uploaded file, if available from the provider.
816
882
  */
817
- outputTokens: number | undefined;
883
+ mediaType?: string;
818
884
  /**
819
- * The total number of tokens as reported by the provider.
885
+ * The filename of the uploaded file, if available from the provider.
820
886
  */
821
- totalTokens: number | undefined;
887
+ filename?: string;
888
+ /**
889
+ * Additional provider-specific metadata. They are passed through
890
+ * to the provider from the AI SDK and enable provider-specific
891
+ * functionality that can be fully encapsulated in the provider.
892
+ */
893
+ providerMetadata?: SharedV4ProviderMetadata;
894
+ /**
895
+ * Warnings from the provider.
896
+ */
897
+ warnings: Array<SharedV4Warning>;
898
+ };
899
+
900
+ /**
901
+ * Specification for a file management interface that implements the files interface version 4.
902
+ */
903
+ type FilesV4 = {
904
+ /**
905
+ * The files interface must specify which files interface version it implements.
906
+ */
907
+ readonly specificationVersion: 'v4';
908
+ /**
909
+ * Provider ID.
910
+ */
911
+ readonly provider: string;
912
+ /**
913
+ * Uploads a file to the provider and returns a provider reference
914
+ * that can be used in subsequent API calls.
915
+ */
916
+ uploadFile(options: FilesV4UploadFileCallOptions): PromiseLike<FilesV4UploadFileResult>;
822
917
  };
823
918
 
824
919
  /**
@@ -920,9 +1015,88 @@ type ImageModelV4CallOptions = {
920
1015
  headers?: Record<string, string | undefined>;
921
1016
  };
922
1017
 
1018
+ declare function isJSONValue(value: unknown): value is JSONValue;
1019
+ declare function isJSONArray(value: unknown): value is JSONArray;
1020
+ declare function isJSONObject(value: unknown): value is JSONObject;
1021
+
1022
+ /**
1023
+ * Usage information for an image model call.
1024
+ */
1025
+ type ImageModelV4Usage = {
1026
+ /**
1027
+ * The number of input (prompt) tokens used.
1028
+ */
1029
+ inputTokens: number | undefined;
1030
+ /**
1031
+ * The number of output tokens used, if reported by the provider.
1032
+ */
1033
+ outputTokens: number | undefined;
1034
+ /**
1035
+ * The total number of tokens as reported by the provider.
1036
+ */
1037
+ totalTokens: number | undefined;
1038
+ };
1039
+
923
1040
  type ImageModelV4ProviderMetadata = Record<string, {
924
1041
  images: JSONArray;
925
1042
  } & JSONValue>;
1043
+ /**
1044
+ * The result of an image model doGenerate call.
1045
+ */
1046
+ type ImageModelV4Result = {
1047
+ /**
1048
+ * Generated images as base64 encoded strings or binary data.
1049
+ * The images should be returned without any unnecessary conversion.
1050
+ * If the API returns base64 encoded strings, the images should be returned
1051
+ * as base64 encoded strings. If the API returns binary data, the images should
1052
+ * be returned as binary data.
1053
+ */
1054
+ images: Array<string> | Array<Uint8Array>;
1055
+ /**
1056
+ * Warnings for the call, e.g. unsupported features.
1057
+ */
1058
+ warnings: Array<SharedV4Warning>;
1059
+ /**
1060
+ * Additional provider-specific metadata. They are passed through
1061
+ * from the provider to the AI SDK and enable provider-specific
1062
+ * results that can be fully encapsulated in the provider.
1063
+ *
1064
+ * The outer record is keyed by the provider name, and the inner
1065
+ * record is provider-specific metadata. It always includes an
1066
+ * `images` key with image-specific metadata
1067
+ *
1068
+ * ```ts
1069
+ * {
1070
+ * "openai": {
1071
+ * "images": ["revisedPrompt": "Revised prompt here."]
1072
+ * }
1073
+ * }
1074
+ * ```
1075
+ */
1076
+ providerMetadata?: ImageModelV4ProviderMetadata;
1077
+ /**
1078
+ * Response information for telemetry and debugging purposes.
1079
+ */
1080
+ response: {
1081
+ /**
1082
+ * Timestamp for the start of the generated response.
1083
+ */
1084
+ timestamp: Date;
1085
+ /**
1086
+ * The ID of the response model that was used to generate the response.
1087
+ */
1088
+ modelId: string;
1089
+ /**
1090
+ * Response headers.
1091
+ */
1092
+ headers: Record<string, string> | undefined;
1093
+ };
1094
+ /**
1095
+ * Optional token usage for the image generation call (if the provider reports it).
1096
+ */
1097
+ usage?: ImageModelV4Usage;
1098
+ };
1099
+
926
1100
  type GetMaxImagesPerCallFunction$2 = (options: {
927
1101
  modelId: string;
928
1102
  }) => PromiseLike<number | undefined> | number | undefined;
@@ -956,59 +1130,7 @@ type ImageModelV4 = {
956
1130
  /**
957
1131
  * Generates an array of images.
958
1132
  */
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
- }>;
1133
+ doGenerate(options: ImageModelV4CallOptions): PromiseLike<ImageModelV4Result>;
1012
1134
  };
1013
1135
 
1014
1136
  /**
@@ -1556,7 +1678,7 @@ type LanguageModelV4Message = ({
1556
1678
  content: Array<LanguageModelV4TextPart | LanguageModelV4FilePart>;
1557
1679
  } | {
1558
1680
  role: 'assistant';
1559
- content: Array<LanguageModelV4TextPart | LanguageModelV4FilePart | LanguageModelV4ReasoningPart | LanguageModelV4ToolCallPart | LanguageModelV4ToolResultPart>;
1681
+ content: Array<LanguageModelV4TextPart | LanguageModelV4FilePart | LanguageModelV4CustomPart | LanguageModelV4ReasoningPart | LanguageModelV4ReasoningFilePart | LanguageModelV4ToolCallPart | LanguageModelV4ToolResultPart>;
1560
1682
  } | {
1561
1683
  role: 'tool';
1562
1684
  content: Array<LanguageModelV4ToolResultPart | LanguageModelV4ToolApprovalResponsePart>;
@@ -1601,23 +1723,17 @@ interface LanguageModelV4ReasoningPart {
1601
1723
  providerOptions?: SharedV4ProviderOptions;
1602
1724
  }
1603
1725
  /**
1604
- * File content part of a prompt. It contains a file.
1726
+ * Reasoning file content part of a prompt. It contains a file generated as part of reasoning.
1605
1727
  */
1606
- interface LanguageModelV4FilePart {
1607
- type: 'file';
1608
- /**
1609
- * Optional filename of the file.
1610
- */
1611
- filename?: string;
1728
+ interface LanguageModelV4ReasoningFilePart {
1729
+ type: 'reasoning-file';
1612
1730
  /**
1613
- * File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
1731
+ * File data. Can be a Uint8Array or base64 encoded data as a string.
1614
1732
  */
1615
1733
  data: LanguageModelV4DataContent;
1616
1734
  /**
1617
1735
  * IANA media type of the file.
1618
1736
  *
1619
- * Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
1620
- *
1621
1737
  * @see https://www.iana.org/assignments/media-types/media-types.xhtml
1622
1738
  */
1623
1739
  mediaType: string;
@@ -1629,27 +1745,73 @@ interface LanguageModelV4FilePart {
1629
1745
  providerOptions?: SharedV4ProviderOptions;
1630
1746
  }
1631
1747
  /**
1632
- * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
1748
+ * Provider-specific content part of a prompt. It contains no standardized
1749
+ * payload beyond provider-specific options.
1633
1750
  */
1634
- interface LanguageModelV4ToolCallPart {
1635
- type: 'tool-call';
1636
- /**
1637
- * ID of the tool call. This ID is used to match the tool call with the tool result.
1638
- */
1639
- toolCallId: string;
1640
- /**
1641
- * Name of the tool that is being called.
1642
- */
1643
- toolName: string;
1644
- /**
1645
- * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
1646
- */
1647
- input: unknown;
1751
+ interface LanguageModelV4CustomPart {
1752
+ type: 'custom';
1648
1753
  /**
1649
- * Whether the tool call will be executed by the provider.
1650
- * If this flag is not set or is false, the tool call will be executed by the client.
1754
+ * The kind of custom content, in the format `{provider}.{provider-type}`.
1651
1755
  */
1652
- providerExecuted?: boolean;
1756
+ kind: `${string}.${string}`;
1757
+ /**
1758
+ * Additional provider-specific options. They are passed through
1759
+ * to the provider from the AI SDK and enable provider-specific
1760
+ * functionality that can be fully encapsulated in the provider.
1761
+ */
1762
+ providerOptions?: SharedV4ProviderOptions;
1763
+ }
1764
+ /**
1765
+ * File content part of a prompt. It contains a file.
1766
+ */
1767
+ interface LanguageModelV4FilePart {
1768
+ type: 'file';
1769
+ /**
1770
+ * Optional filename of the file.
1771
+ */
1772
+ filename?: string;
1773
+ /**
1774
+ * File data. Can be a Uint8Array, base64 encoded data as a string, a URL,
1775
+ * or a provider reference mapping provider names to provider-specific file IDs.
1776
+ */
1777
+ data: LanguageModelV4DataContent | SharedV4ProviderReference;
1778
+ /**
1779
+ * IANA media type of the file.
1780
+ *
1781
+ * Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
1782
+ *
1783
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
1784
+ */
1785
+ mediaType: string;
1786
+ /**
1787
+ * Additional provider-specific options. They are passed through
1788
+ * to the provider from the AI SDK and enable provider-specific
1789
+ * functionality that can be fully encapsulated in the provider.
1790
+ */
1791
+ providerOptions?: SharedV4ProviderOptions;
1792
+ }
1793
+ /**
1794
+ * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
1795
+ */
1796
+ interface LanguageModelV4ToolCallPart {
1797
+ type: 'tool-call';
1798
+ /**
1799
+ * ID of the tool call. This ID is used to match the tool call with the tool result.
1800
+ */
1801
+ toolCallId: string;
1802
+ /**
1803
+ * Name of the tool that is being called.
1804
+ */
1805
+ toolName: string;
1806
+ /**
1807
+ * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
1808
+ */
1809
+ input: unknown;
1810
+ /**
1811
+ * Whether the tool call will be executed by the provider.
1812
+ * If this flag is not set or is false, the tool call will be executed by the client.
1813
+ */
1814
+ providerExecuted?: boolean;
1653
1815
  /**
1654
1816
  * Additional provider-specific options. They are passed through
1655
1817
  * to the provider from the AI SDK and enable provider-specific
@@ -1795,16 +1957,12 @@ type LanguageModelV4ToolResultOutput = {
1795
1957
  */
1796
1958
  providerOptions?: SharedV4ProviderOptions;
1797
1959
  } | {
1798
- type: 'file-id';
1960
+ type: 'file-reference';
1799
1961
  /**
1800
- * ID of the file.
1801
- *
1802
- * If you use multiple providers, you need to
1803
- * specify the provider specific ids using
1804
- * the Record option. The key is the provider
1805
- * name, e.g. 'openai' or 'anthropic'.
1962
+ * Provider-specific references for the file.
1963
+ * The key is the provider name, e.g. 'openai' or 'anthropic'.
1806
1964
  */
1807
- fileId: string | Record<string, string>;
1965
+ providerReference: SharedV4ProviderReference;
1808
1966
  /**
1809
1967
  * Provider-specific options.
1810
1968
  */
@@ -1842,18 +2000,14 @@ type LanguageModelV4ToolResultOutput = {
1842
2000
  providerOptions?: SharedV4ProviderOptions;
1843
2001
  } | {
1844
2002
  /**
1845
- * Images that are referenced using a provider file id.
2003
+ * Images that are referenced using a provider reference.
1846
2004
  */
1847
- type: 'image-file-id';
2005
+ type: 'image-file-reference';
1848
2006
  /**
1849
- * Image that is referenced using a provider file id.
1850
- *
1851
- * If you use multiple providers, you need to
1852
- * specify the provider specific ids using
1853
- * the Record option. The key is the provider
1854
- * name, e.g. 'openai' or 'anthropic'.
2007
+ * Provider-specific references for the image file.
2008
+ * The key is the provider name, e.g. 'openai' or 'anthropic'.
1855
2009
  */
1856
- fileId: string | Record<string, string>;
2010
+ providerReference: SharedV4ProviderReference;
1857
2011
  /**
1858
2012
  * Provider-specific options.
1859
2013
  */
@@ -2001,6 +2155,11 @@ type LanguageModelV4CallOptions = {
2001
2155
  * Only applicable for HTTP-based providers.
2002
2156
  */
2003
2157
  headers?: Record<string, string | undefined>;
2158
+ /**
2159
+ * Reasoning effort level for the model. Controls how much reasoning
2160
+ * the model performs before generating a response. Defaults to 'provider-default'.
2161
+ */
2162
+ reasoning?: 'provider-default' | 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
2004
2163
  /**
2005
2164
  * Additional provider-specific options. They are passed through
2006
2165
  * to the provider from the AI SDK and enable provider-specific
@@ -2009,6 +2168,24 @@ type LanguageModelV4CallOptions = {
2009
2168
  providerOptions?: SharedV4ProviderOptions;
2010
2169
  };
2011
2170
 
2171
+ /**
2172
+ * A provider-specific content block that does not map to another standardized
2173
+ * content part type.
2174
+ */
2175
+ type LanguageModelV4CustomContent = {
2176
+ type: 'custom';
2177
+ /**
2178
+ * The kind of custom content, in the format `{provider}.{provider-type}`.
2179
+ */
2180
+ kind: `${string}.${string}`;
2181
+ /**
2182
+ * Additional provider-specific options. They are passed through
2183
+ * to the provider from the AI SDK and enable provider-specific
2184
+ * functionality that can be fully encapsulated in the provider.
2185
+ */
2186
+ providerMetadata?: SharedV4ProviderMetadata;
2187
+ };
2188
+
2012
2189
  /**
2013
2190
  * A file that has been generated by the model.
2014
2191
  * Generated files as base64 encoded strings or binary data.
@@ -2049,6 +2226,34 @@ type LanguageModelV4Reasoning = {
2049
2226
  providerMetadata?: SharedV4ProviderMetadata;
2050
2227
  };
2051
2228
 
2229
+ /**
2230
+ * A file that has been generated by the model as part of reasoning.
2231
+ * Generated files as base64 encoded strings or binary data.
2232
+ * The files should be returned without any unnecessary conversion.
2233
+ */
2234
+ type LanguageModelV4ReasoningFile = {
2235
+ type: 'reasoning-file';
2236
+ /**
2237
+ * The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
2238
+ *
2239
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
2240
+ */
2241
+ mediaType: string;
2242
+ /**
2243
+ * Generated file data as base64 encoded strings or binary data.
2244
+ *
2245
+ * The file data should be returned without any unnecessary conversion.
2246
+ * If the API returns base64 encoded strings, the file data should be returned
2247
+ * as base64 encoded strings. If the API returns binary data, the file data should
2248
+ * be returned as binary data.
2249
+ */
2250
+ data: string | Uint8Array;
2251
+ /**
2252
+ * Optional provider-specific metadata for the reasoning file part.
2253
+ */
2254
+ providerMetadata?: SharedV4ProviderMetadata;
2255
+ };
2256
+
2052
2257
  /**
2053
2258
  * A source that has been used as input to generate the response.
2054
2259
  */
@@ -2213,7 +2418,7 @@ type LanguageModelV4ToolResult = {
2213
2418
  providerMetadata?: SharedV4ProviderMetadata;
2214
2419
  };
2215
2420
 
2216
- type LanguageModelV4Content = LanguageModelV4Text | LanguageModelV4Reasoning | LanguageModelV4File | LanguageModelV4ToolApprovalRequest | LanguageModelV4Source | LanguageModelV4ToolCall | LanguageModelV4ToolResult;
2421
+ type LanguageModelV4Content = LanguageModelV4Text | LanguageModelV4Reasoning | LanguageModelV4CustomContent | LanguageModelV4ReasoningFile | LanguageModelV4File | LanguageModelV4ToolApprovalRequest | LanguageModelV4Source | LanguageModelV4ToolCall | LanguageModelV4ToolResult;
2217
2422
 
2218
2423
  /**
2219
2424
  * Reason why a language model finished generating a response.
@@ -2401,7 +2606,7 @@ type LanguageModelV4StreamPart = {
2401
2606
  type: 'tool-input-end';
2402
2607
  id: string;
2403
2608
  providerMetadata?: SharedV4ProviderMetadata;
2404
- } | LanguageModelV4ToolApprovalRequest | LanguageModelV4ToolCall | LanguageModelV4ToolResult | LanguageModelV4File | LanguageModelV4Source | {
2609
+ } | LanguageModelV4ToolApprovalRequest | LanguageModelV4ToolCall | LanguageModelV4ToolResult | LanguageModelV4CustomContent | LanguageModelV4File | LanguageModelV4ReasoningFile | LanguageModelV4Source | {
2405
2610
  type: 'stream-start';
2406
2611
  warnings: Array<SharedV4Warning>;
2407
2612
  } | ({
@@ -4662,6 +4867,61 @@ type RerankingModelV4CallOptions = {
4662
4867
  headers?: SharedV4Headers;
4663
4868
  };
4664
4869
 
4870
+ /**
4871
+ * The result of a reranking model doRerank call.
4872
+ */
4873
+ type RerankingModelV4Result = {
4874
+ /**
4875
+ * Ordered list of reranked documents (via index before reranking).
4876
+ * The documents are sorted by the descending order of relevance scores.
4877
+ */
4878
+ ranking: Array<{
4879
+ /**
4880
+ * The index of the document in the original list of documents before reranking.
4881
+ */
4882
+ index: number;
4883
+ /**
4884
+ * The relevance score of the document after reranking.
4885
+ */
4886
+ relevanceScore: number;
4887
+ }>;
4888
+ /**
4889
+ * Additional provider-specific metadata. They are passed through
4890
+ * to the provider from the AI SDK and enable provider-specific
4891
+ * functionality that can be fully encapsulated in the provider.
4892
+ */
4893
+ providerMetadata?: SharedV4ProviderMetadata;
4894
+ /**
4895
+ * Warnings for the call, e.g. unsupported settings.
4896
+ */
4897
+ warnings?: Array<SharedV4Warning>;
4898
+ /**
4899
+ * Optional response information for debugging purposes.
4900
+ */
4901
+ response?: {
4902
+ /**
4903
+ * ID for the generated response, if the provider sends one.
4904
+ */
4905
+ id?: string;
4906
+ /**
4907
+ * Timestamp for the start of the generated response, if the provider sends one.
4908
+ */
4909
+ timestamp?: Date;
4910
+ /**
4911
+ * The ID of the response model that was used to generate the response, if the provider sends one.
4912
+ */
4913
+ modelId?: string;
4914
+ /**
4915
+ * Response headers.
4916
+ */
4917
+ headers?: SharedV4Headers;
4918
+ /**
4919
+ * Response body.
4920
+ */
4921
+ body?: unknown;
4922
+ };
4923
+ };
4924
+
4665
4925
  /**
4666
4926
  * Specification for a reranking model that implements the reranking model interface version 3.
4667
4927
  */
@@ -4681,57 +4941,7 @@ type RerankingModelV4 = {
4681
4941
  /**
4682
4942
  * Reranking a list of documents using the query.
4683
4943
  */
4684
- doRerank(options: RerankingModelV4CallOptions): PromiseLike<{
4685
- /**
4686
- * Ordered list of reranked documents (via index before reranking).
4687
- * The documents are sorted by the descending order of relevance scores.
4688
- */
4689
- ranking: Array<{
4690
- /**
4691
- * The index of the document in the original list of documents before reranking.
4692
- */
4693
- index: number;
4694
- /**
4695
- * The relevance score of the document after reranking.
4696
- */
4697
- relevanceScore: number;
4698
- }>;
4699
- /**
4700
- * Additional provider-specific metadata. They are passed through
4701
- * to the provider from the AI SDK and enable provider-specific
4702
- * functionality that can be fully encapsulated in the provider.
4703
- */
4704
- providerMetadata?: SharedV4ProviderMetadata;
4705
- /**
4706
- * Warnings for the call, e.g. unsupported settings.
4707
- */
4708
- warnings?: Array<SharedV4Warning>;
4709
- /**
4710
- * Optional response information for debugging purposes.
4711
- */
4712
- response?: {
4713
- /**
4714
- * ID for the generated response, if the provider sends one.
4715
- */
4716
- id?: string;
4717
- /**
4718
- * Timestamp for the start of the generated response, if the provider sends one.
4719
- */
4720
- timestamp?: Date;
4721
- /**
4722
- * The ID of the response model that was used to generate the response, if the provider sends one.
4723
- */
4724
- modelId?: string;
4725
- /**
4726
- * Response headers.
4727
- */
4728
- headers?: SharedV4Headers;
4729
- /**
4730
- * Response body.
4731
- */
4732
- body?: unknown;
4733
- };
4734
- }>;
4944
+ doRerank(options: RerankingModelV4CallOptions): PromiseLike<RerankingModelV4Result>;
4735
4945
  };
4736
4946
 
4737
4947
  type SpeechModelV4ProviderOptions = Record<string, JSONObject>;
@@ -4786,6 +4996,60 @@ type SpeechModelV4CallOptions = {
4786
4996
  headers?: Record<string, string | undefined>;
4787
4997
  };
4788
4998
 
4999
+ /**
5000
+ * The result of a speech model doGenerate call.
5001
+ */
5002
+ type SpeechModelV4Result = {
5003
+ /**
5004
+ * Generated audio as an ArrayBuffer.
5005
+ * The audio should be returned without any unnecessary conversion.
5006
+ * If the API returns base64 encoded strings, the audio should be returned
5007
+ * as base64 encoded strings. If the API returns binary data, the audio
5008
+ * should be returned as binary data.
5009
+ */
5010
+ audio: string | Uint8Array;
5011
+ /**
5012
+ * Warnings for the call, e.g. unsupported settings.
5013
+ */
5014
+ warnings: Array<SharedV4Warning>;
5015
+ /**
5016
+ * Optional request information for telemetry and debugging purposes.
5017
+ */
5018
+ request?: {
5019
+ /**
5020
+ * Response body (available only for providers that use HTTP requests).
5021
+ */
5022
+ body?: unknown;
5023
+ };
5024
+ /**
5025
+ * Response information for telemetry and debugging purposes.
5026
+ */
5027
+ response: {
5028
+ /**
5029
+ * Timestamp for the start of the generated response.
5030
+ */
5031
+ timestamp: Date;
5032
+ /**
5033
+ * The ID of the response model that was used to generate the response.
5034
+ */
5035
+ modelId: string;
5036
+ /**
5037
+ * Response headers.
5038
+ */
5039
+ headers?: SharedV2Headers;
5040
+ /**
5041
+ * Response body.
5042
+ */
5043
+ body?: unknown;
5044
+ };
5045
+ /**
5046
+ * Additional provider-specific metadata. They are passed through
5047
+ * from the provider to the AI SDK and enable provider-specific
5048
+ * results that can be fully encapsulated in the provider.
5049
+ */
5050
+ providerMetadata?: Record<string, JSONObject>;
5051
+ };
5052
+
4789
5053
  /**
4790
5054
  * Speech model specification version 3.
4791
5055
  */
@@ -4809,56 +5073,7 @@ type SpeechModelV4 = {
4809
5073
  /**
4810
5074
  * Generates speech audio from text.
4811
5075
  */
4812
- doGenerate(options: SpeechModelV4CallOptions): PromiseLike<{
4813
- /**
4814
- * Generated audio as an ArrayBuffer.
4815
- * The audio should be returned without any unnecessary conversion.
4816
- * If the API returns base64 encoded strings, the audio should be returned
4817
- * as base64 encoded strings. If the API returns binary data, the audio
4818
- * should be returned as binary data.
4819
- */
4820
- audio: string | Uint8Array;
4821
- /**
4822
- * Warnings for the call, e.g. unsupported settings.
4823
- */
4824
- warnings: Array<SharedV4Warning>;
4825
- /**
4826
- * Optional request information for telemetry and debugging purposes.
4827
- */
4828
- request?: {
4829
- /**
4830
- * Response body (available only for providers that use HTTP requests).
4831
- */
4832
- body?: unknown;
4833
- };
4834
- /**
4835
- * Response information for telemetry and debugging purposes.
4836
- */
4837
- response: {
4838
- /**
4839
- * Timestamp for the start of the generated response.
4840
- */
4841
- timestamp: Date;
4842
- /**
4843
- * The ID of the response model that was used to generate the response.
4844
- */
4845
- modelId: string;
4846
- /**
4847
- * Response headers.
4848
- */
4849
- headers?: SharedV2Headers;
4850
- /**
4851
- * Response body.
4852
- */
4853
- body?: unknown;
4854
- };
4855
- /**
4856
- * Additional provider-specific metadata. They are passed through
4857
- * from the provider to the AI SDK and enable provider-specific
4858
- * results that can be fully encapsulated in the provider.
4859
- */
4860
- providerMetadata?: Record<string, JSONObject>;
4861
- }>;
5076
+ doGenerate(options: SpeechModelV4CallOptions): PromiseLike<SpeechModelV4Result>;
4862
5077
  };
4863
5078
 
4864
5079
  type TranscriptionModelV4ProviderOptions = Record<string, JSONObject>;
@@ -4901,105 +5116,188 @@ type TranscriptionModelV4CallOptions = {
4901
5116
  };
4902
5117
 
4903
5118
  /**
4904
- * Transcription model specification version 3.
5119
+ * The result of a transcription model doGenerate call.
4905
5120
  */
4906
- type TranscriptionModelV4 = {
4907
- /**
4908
- * The transcription model must specify which transcription model interface
4909
- * version it implements. This will allow us to evolve the transcription
4910
- * model interface and retain backwards compatibility. The different
4911
- * implementation versions can be handled as a discriminated union
4912
- * on our side.
4913
- */
4914
- readonly specificationVersion: 'v4';
5121
+ type TranscriptionModelV4Result = {
4915
5122
  /**
4916
- * Name of the provider for logging purposes.
5123
+ * The complete transcribed text from the audio.
4917
5124
  */
4918
- readonly provider: string;
4919
- /**
4920
- * Provider-specific model ID for logging purposes.
4921
- */
4922
- readonly modelId: string;
5125
+ text: string;
4923
5126
  /**
4924
- * Generates a transcript.
5127
+ * Array of transcript segments with timing information.
5128
+ * Each segment represents a portion of the transcribed text with start and end times.
4925
5129
  */
4926
- doGenerate(options: TranscriptionModelV4CallOptions): PromiseLike<{
5130
+ segments: Array<{
4927
5131
  /**
4928
- * The complete transcribed text from the audio.
5132
+ * The text content of this segment.
4929
5133
  */
4930
5134
  text: string;
4931
5135
  /**
4932
- * Array of transcript segments with timing information.
4933
- * Each segment represents a portion of the transcribed text with start and end times.
5136
+ * The start time of this segment in seconds.
4934
5137
  */
4935
- segments: Array<{
4936
- /**
4937
- * The text content of this segment.
4938
- */
4939
- text: string;
4940
- /**
4941
- * The start time of this segment in seconds.
4942
- */
4943
- startSecond: number;
4944
- /**
4945
- * The end time of this segment in seconds.
4946
- */
4947
- endSecond: number;
4948
- }>;
5138
+ startSecond: number;
4949
5139
  /**
4950
- * The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
4951
- * May be undefined if the language couldn't be detected.
5140
+ * The end time of this segment in seconds.
4952
5141
  */
4953
- language: string | undefined;
5142
+ endSecond: number;
5143
+ }>;
5144
+ /**
5145
+ * The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
5146
+ * May be undefined if the language couldn't be detected.
5147
+ */
5148
+ language: string | undefined;
5149
+ /**
5150
+ * The total duration of the audio file in seconds.
5151
+ * May be undefined if the duration couldn't be determined.
5152
+ */
5153
+ durationInSeconds: number | undefined;
5154
+ /**
5155
+ * Warnings for the call, e.g. unsupported settings.
5156
+ */
5157
+ warnings: Array<SharedV4Warning>;
5158
+ /**
5159
+ * Optional request information for telemetry and debugging purposes.
5160
+ */
5161
+ request?: {
4954
5162
  /**
4955
- * The total duration of the audio file in seconds.
4956
- * May be undefined if the duration couldn't be determined.
5163
+ * Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
5164
+ * Non-HTTP(s) providers should not set this.
4957
5165
  */
4958
- durationInSeconds: number | undefined;
5166
+ body?: string;
5167
+ };
5168
+ /**
5169
+ * Response information for telemetry and debugging purposes.
5170
+ */
5171
+ response: {
4959
5172
  /**
4960
- * Warnings for the call, e.g. unsupported settings.
5173
+ * Timestamp for the start of the generated response.
4961
5174
  */
4962
- warnings: Array<SharedV4Warning>;
5175
+ timestamp: Date;
4963
5176
  /**
4964
- * Optional request information for telemetry and debugging purposes.
5177
+ * The ID of the response model that was used to generate the response.
4965
5178
  */
4966
- request?: {
4967
- /**
4968
- * Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
4969
- * Non-HTTP(s) providers should not set this.
4970
- */
4971
- body?: string;
4972
- };
5179
+ modelId: string;
4973
5180
  /**
4974
- * Response information for telemetry and debugging purposes.
5181
+ * Response headers.
4975
5182
  */
4976
- response: {
4977
- /**
4978
- * Timestamp for the start of the generated response.
4979
- */
4980
- timestamp: Date;
4981
- /**
4982
- * The ID of the response model that was used to generate the response.
4983
- */
4984
- modelId: string;
4985
- /**
4986
- * Response headers.
4987
- */
4988
- headers?: SharedV4Headers;
4989
- /**
4990
- * Response body.
4991
- */
4992
- body?: unknown;
4993
- };
5183
+ headers?: SharedV4Headers;
4994
5184
  /**
4995
- * Additional provider-specific metadata. They are passed through
4996
- * from the provider to the AI SDK and enable provider-specific
4997
- * results that can be fully encapsulated in the provider.
5185
+ * Response body.
4998
5186
  */
4999
- providerMetadata?: Record<string, JSONObject>;
5000
- }>;
5187
+ body?: unknown;
5188
+ };
5189
+ /**
5190
+ * Additional provider-specific metadata. They are passed through
5191
+ * from the provider to the AI SDK and enable provider-specific
5192
+ * results that can be fully encapsulated in the provider.
5193
+ */
5194
+ providerMetadata?: Record<string, JSONObject>;
5001
5195
  };
5002
5196
 
5197
+ /**
5198
+ * Transcription model specification version 3.
5199
+ */
5200
+ type TranscriptionModelV4 = {
5201
+ /**
5202
+ * The transcription model must specify which transcription model interface
5203
+ * version it implements. This will allow us to evolve the transcription
5204
+ * model interface and retain backwards compatibility. The different
5205
+ * implementation versions can be handled as a discriminated union
5206
+ * on our side.
5207
+ */
5208
+ readonly specificationVersion: 'v4';
5209
+ /**
5210
+ * Name of the provider for logging purposes.
5211
+ */
5212
+ readonly provider: string;
5213
+ /**
5214
+ * Provider-specific model ID for logging purposes.
5215
+ */
5216
+ readonly modelId: string;
5217
+ /**
5218
+ * Generates a transcript.
5219
+ */
5220
+ doGenerate(options: TranscriptionModelV4CallOptions): PromiseLike<TranscriptionModelV4Result>;
5221
+ };
5222
+
5223
+ interface SkillsV4File {
5224
+ /**
5225
+ * The path of the file relative to the skill root.
5226
+ */
5227
+ path: string;
5228
+ /**
5229
+ * The content of the file, either as a base64 string or binary data.
5230
+ */
5231
+ content: string | Uint8Array;
5232
+ }
5233
+ interface SkillsV4UploadSkillCallOptions {
5234
+ /**
5235
+ * The files that make up the skill.
5236
+ */
5237
+ files: SkillsV4File[];
5238
+ /**
5239
+ * Optional human-readable title for the skill.
5240
+ */
5241
+ displayTitle?: string;
5242
+ /**
5243
+ * Additional provider-specific options.
5244
+ */
5245
+ providerOptions?: SharedV4ProviderOptions;
5246
+ }
5247
+
5248
+ interface SkillsV4UploadSkillResult {
5249
+ /**
5250
+ * A provider reference mapping provider names to provider-specific skill identifiers.
5251
+ */
5252
+ providerReference: SharedV4ProviderReference;
5253
+ /**
5254
+ * Optional human-readable title for the uploaded skill.
5255
+ */
5256
+ displayTitle?: string;
5257
+ /**
5258
+ * Optional name of the uploaded skill.
5259
+ */
5260
+ name?: string;
5261
+ /**
5262
+ * Optional description of what the uploaded skill does.
5263
+ */
5264
+ description?: string;
5265
+ /**
5266
+ * Optional latest version identifier of the uploaded skill.
5267
+ */
5268
+ latestVersion?: string;
5269
+ /**
5270
+ * Additional provider-specific metadata.
5271
+ */
5272
+ providerMetadata?: SharedV4ProviderMetadata;
5273
+ /**
5274
+ * Warnings for the call, e.g. unsupported settings.
5275
+ */
5276
+ warnings: SharedV4Warning[];
5277
+ }
5278
+
5279
+ /**
5280
+ * Skills specification version 4.
5281
+ */
5282
+ interface SkillsV4 {
5283
+ /**
5284
+ * The skills implementation must specify which skills interface
5285
+ * version it implements. This will allow us to evolve the skills
5286
+ * interface and retain backwards compatibility. The different
5287
+ * implementation versions can be handled as a discriminated union
5288
+ * on our side.
5289
+ */
5290
+ readonly specificationVersion: 'v4';
5291
+ /**
5292
+ * Name of the provider for logging purposes.
5293
+ */
5294
+ readonly provider: string;
5295
+ /**
5296
+ * Uploads a new skill from the given files.
5297
+ */
5298
+ uploadSkill(params: SkillsV4UploadSkillCallOptions): PromiseLike<SkillsV4UploadSkillResult>;
5299
+ }
5300
+
5003
5301
  /**
5004
5302
  * Provider for language, text embedding, and image generation models.
5005
5303
  */
@@ -5065,6 +5363,18 @@ interface ProviderV4 {
5065
5363
  * @throws {NoSuchModelError} If no such model exists.
5066
5364
  */
5067
5365
  rerankingModel?(modelId: string): RerankingModelV4;
5366
+ /**
5367
+ * Returns the files interface for uploading files to the provider.
5368
+ * The returned interface can be passed to the `uploadFile` function.
5369
+ *
5370
+ * @returns {FilesV4} The files interface for this provider.
5371
+ */
5372
+ files?(): FilesV4;
5373
+ /**
5374
+ * Returns the skills interface for uploading skills to the provider.
5375
+ * The returned interface can be passed to the `uploadSkill` function.
5376
+ */
5377
+ skills?(): SkillsV4;
5068
5378
  }
5069
5379
 
5070
5380
  type RerankingModelV3CallOptions = {
@@ -5970,9 +6280,6 @@ type VideoModelV4CallOptions = {
5970
6280
  headers?: Record<string, string | undefined>;
5971
6281
  };
5972
6282
 
5973
- type GetMaxVideosPerCallFunction$1 = (options: {
5974
- modelId: string;
5975
- }) => PromiseLike<number | undefined> | number | undefined;
5976
6283
  /**
5977
6284
  * Generated video data. Can be a URL, base64-encoded string, or binary data.
5978
6285
  */
@@ -5998,6 +6305,65 @@ type VideoModelV4VideoData = {
5998
6305
  data: Uint8Array;
5999
6306
  mediaType: string;
6000
6307
  };
6308
+ /**
6309
+ * The result of a video model doGenerate call.
6310
+ */
6311
+ type VideoModelV4Result = {
6312
+ /**
6313
+ * Generated videos as URLs, base64 strings, or binary data.
6314
+ *
6315
+ * Most providers return URLs to video files (MP4, WebM) due to large file sizes.
6316
+ * Use the discriminated union to indicate the type of video data being returned.
6317
+ */
6318
+ videos: Array<VideoModelV4VideoData>;
6319
+ /**
6320
+ * Warnings for the call, e.g. unsupported features.
6321
+ */
6322
+ warnings: Array<SharedV4Warning>;
6323
+ /**
6324
+ * Additional provider-specific metadata. They are passed through
6325
+ * from the provider to the AI SDK and enable provider-specific
6326
+ * results that can be fully encapsulated in the provider.
6327
+ *
6328
+ * The outer record is keyed by the provider name, and the inner
6329
+ * record is provider-specific metadata.
6330
+ *
6331
+ * ```ts
6332
+ * {
6333
+ * "fal": {
6334
+ * "videos": [{
6335
+ * "duration": 5.0,
6336
+ * "fps": 24,
6337
+ * "width": 1280,
6338
+ * "height": 720
6339
+ * }]
6340
+ * }
6341
+ * }
6342
+ * ```
6343
+ */
6344
+ providerMetadata?: SharedV4ProviderMetadata;
6345
+ /**
6346
+ * Response information for telemetry and debugging purposes.
6347
+ */
6348
+ response: {
6349
+ /**
6350
+ * Timestamp for the start of the generated response.
6351
+ */
6352
+ timestamp: Date;
6353
+ /**
6354
+ * The ID of the response model that was used to generate the response.
6355
+ */
6356
+ modelId: string;
6357
+ /**
6358
+ * Response headers.
6359
+ */
6360
+ headers: Record<string, string> | undefined;
6361
+ };
6362
+ };
6363
+
6364
+ type GetMaxVideosPerCallFunction$1 = (options: {
6365
+ modelId: string;
6366
+ }) => PromiseLike<number | undefined> | number | undefined;
6001
6367
  /**
6002
6368
  * Video generation model specification version 3.
6003
6369
  */
@@ -6031,58 +6397,7 @@ type VideoModelV4 = {
6031
6397
  /**
6032
6398
  * Generates an array of videos.
6033
6399
  */
6034
- doGenerate(options: VideoModelV4CallOptions): PromiseLike<{
6035
- /**
6036
- * Generated videos as URLs, base64 strings, or binary data.
6037
- *
6038
- * Most providers return URLs to video files (MP4, WebM) due to large file sizes.
6039
- * Use the discriminated union to indicate the type of video data being returned.
6040
- */
6041
- videos: Array<VideoModelV4VideoData>;
6042
- /**
6043
- * Warnings for the call, e.g. unsupported features.
6044
- */
6045
- warnings: Array<SharedV4Warning>;
6046
- /**
6047
- * Additional provider-specific metadata. They are passed through
6048
- * from the provider to the AI SDK and enable provider-specific
6049
- * results that can be fully encapsulated in the provider.
6050
- *
6051
- * The outer record is keyed by the provider name, and the inner
6052
- * record is provider-specific metadata.
6053
- *
6054
- * ```ts
6055
- * {
6056
- * "fal": {
6057
- * "videos": [{
6058
- * "duration": 5.0,
6059
- * "fps": 24,
6060
- * "width": 1280,
6061
- * "height": 720
6062
- * }]
6063
- * }
6064
- * }
6065
- * ```
6066
- */
6067
- providerMetadata?: SharedV4ProviderMetadata;
6068
- /**
6069
- * Response information for telemetry and debugging purposes.
6070
- */
6071
- response: {
6072
- /**
6073
- * Timestamp for the start of the generated response.
6074
- */
6075
- timestamp: Date;
6076
- /**
6077
- * The ID of the response model that was used to generate the response.
6078
- */
6079
- modelId: string;
6080
- /**
6081
- * Response headers.
6082
- */
6083
- headers: Record<string, string> | undefined;
6084
- };
6085
- }>;
6400
+ doGenerate(options: VideoModelV4CallOptions): PromiseLike<VideoModelV4Result>;
6086
6401
  };
6087
6402
 
6088
6403
  /**
@@ -6301,4 +6616,4 @@ type VideoModelV3 = {
6301
6616
  }>;
6302
6617
  };
6303
6618
 
6304
- 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 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 };
6619
+ 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 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 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, 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 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 };