@mastra/client-js 0.0.0-studio-deploy-20260404182525 → 0.0.0-studio-cli-20260504022012

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 (42) hide show
  1. package/CHANGELOG.md +917 -3
  2. package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +466 -1764
  3. package/dist/client.d.ts +46 -3
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/docs/SKILL.md +3 -1
  6. package/dist/docs/assets/SOURCE_MAP.json +7 -2
  7. package/dist/docs/references/docs-editor-overview.md +290 -0
  8. package/dist/docs/references/docs-server-mastra-client.md +2 -2
  9. package/dist/docs/references/reference-ai-sdk-to-ai-sdk-messages.md +95 -0
  10. package/dist/docs/references/reference-ai-sdk-to-ai-sdk-stream.md +15 -0
  11. package/dist/docs/references/reference-client-js-agents.md +166 -0
  12. package/dist/docs/references/reference-client-js-conversations.md +1 -1
  13. package/dist/docs/references/reference-client-js-mastra-client.md +23 -0
  14. package/dist/docs/references/reference-client-js-observability.md +2 -2
  15. package/dist/docs/references/reference-client-js-responses.md +1 -1
  16. package/dist/docs/references/reference-client-js-workflows.md +62 -1
  17. package/dist/index.cjs +660 -35
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +2 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +657 -35
  22. package/dist/index.js.map +1 -1
  23. package/dist/resources/a2a.d.ts +56 -10
  24. package/dist/resources/a2a.d.ts.map +1 -1
  25. package/dist/resources/agent.d.ts +69 -0
  26. package/dist/resources/agent.d.ts.map +1 -1
  27. package/dist/resources/channels.d.ts +63 -0
  28. package/dist/resources/channels.d.ts.map +1 -0
  29. package/dist/resources/index.d.ts +1 -0
  30. package/dist/resources/index.d.ts.map +1 -1
  31. package/dist/resources/memory-thread.d.ts.map +1 -1
  32. package/dist/resources/observability.d.ts +18 -1
  33. package/dist/resources/observability.d.ts.map +1 -1
  34. package/dist/resources/run.d.ts +26 -2
  35. package/dist/resources/run.d.ts.map +1 -1
  36. package/dist/resources/vector.d.ts +5 -5
  37. package/dist/resources/vector.d.ts.map +1 -1
  38. package/dist/types.d.ts +115 -6
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/utils/process-a2a-stream.d.ts +4 -0
  41. package/dist/utils/process-a2a-stream.d.ts.map +1 -0
  42. package/package.json +12 -12
@@ -116,61 +116,61 @@ declare namespace _ai_sdk_provider {
116
116
  JSONSchema7Definition,
117
117
  AISDKError,
118
118
  APICallError,
119
- EmbeddingModelV2_2 as EmbeddingModelV2,
120
- EmbeddingModelV2Embedding_2 as EmbeddingModelV2Embedding,
119
+ EmbeddingModelV2,
120
+ EmbeddingModelV2Embedding,
121
121
  EmptyResponseBodyError,
122
- ImageModelV2_2 as ImageModelV2,
123
- ImageModelV2CallOptions_2 as ImageModelV2CallOptions,
124
- ImageModelV2CallWarning_2 as ImageModelV2CallWarning,
125
- ImageModelV2ProviderMetadata_2 as ImageModelV2ProviderMetadata,
122
+ ImageModelV2,
123
+ ImageModelV2CallOptions,
124
+ ImageModelV2CallWarning,
125
+ ImageModelV2ProviderMetadata,
126
126
  InvalidArgumentError_2 as InvalidArgumentError,
127
127
  InvalidPromptError,
128
128
  InvalidResponseDataError,
129
- JSONArray_2 as JSONArray,
130
- JSONObject_2 as JSONObject,
129
+ JSONArray,
130
+ JSONObject,
131
131
  JSONParseError,
132
- JSONValue_3 as JSONValue,
133
- LanguageModelV2_2 as LanguageModelV2,
134
- LanguageModelV2CallOptions_2 as LanguageModelV2CallOptions,
135
- LanguageModelV2CallWarning_2 as LanguageModelV2CallWarning,
136
- LanguageModelV2Content_2 as LanguageModelV2Content,
137
- LanguageModelV2DataContent_2 as LanguageModelV2DataContent,
138
- LanguageModelV2File_2 as LanguageModelV2File,
139
- LanguageModelV2FilePart_2 as LanguageModelV2FilePart,
140
- LanguageModelV2FinishReason_2 as LanguageModelV2FinishReason,
141
- LanguageModelV2FunctionTool_2 as LanguageModelV2FunctionTool,
142
- LanguageModelV2Message_2 as LanguageModelV2Message,
132
+ JSONValue_2 as JSONValue,
133
+ LanguageModelV2,
134
+ LanguageModelV2CallOptions,
135
+ LanguageModelV2CallWarning,
136
+ LanguageModelV2Content,
137
+ LanguageModelV2DataContent,
138
+ LanguageModelV2File,
139
+ LanguageModelV2FilePart,
140
+ LanguageModelV2FinishReason,
141
+ LanguageModelV2FunctionTool,
142
+ LanguageModelV2Message,
143
143
  LanguageModelV2Middleware,
144
- LanguageModelV2Prompt_2 as LanguageModelV2Prompt,
145
- LanguageModelV2ProviderDefinedTool_2 as LanguageModelV2ProviderDefinedTool,
146
- LanguageModelV2Reasoning_2 as LanguageModelV2Reasoning,
147
- LanguageModelV2ReasoningPart_2 as LanguageModelV2ReasoningPart,
148
- LanguageModelV2ResponseMetadata_2 as LanguageModelV2ResponseMetadata,
149
- LanguageModelV2Source_2 as LanguageModelV2Source,
150
- LanguageModelV2StreamPart_2 as LanguageModelV2StreamPart,
151
- LanguageModelV2Text_2 as LanguageModelV2Text,
152
- LanguageModelV2TextPart_2 as LanguageModelV2TextPart,
153
- LanguageModelV2ToolCall_2 as LanguageModelV2ToolCall,
154
- LanguageModelV2ToolCallPart_2 as LanguageModelV2ToolCallPart,
155
- LanguageModelV2ToolChoice_2 as LanguageModelV2ToolChoice,
156
- LanguageModelV2ToolResultOutput_2 as LanguageModelV2ToolResultOutput,
157
- LanguageModelV2ToolResultPart_2 as LanguageModelV2ToolResultPart,
158
- LanguageModelV2Usage_2 as LanguageModelV2Usage,
144
+ LanguageModelV2Prompt,
145
+ LanguageModelV2ProviderDefinedTool,
146
+ LanguageModelV2Reasoning,
147
+ LanguageModelV2ReasoningPart,
148
+ LanguageModelV2ResponseMetadata,
149
+ LanguageModelV2Source,
150
+ LanguageModelV2StreamPart,
151
+ LanguageModelV2Text,
152
+ LanguageModelV2TextPart,
153
+ LanguageModelV2ToolCall,
154
+ LanguageModelV2ToolCallPart,
155
+ LanguageModelV2ToolChoice,
156
+ LanguageModelV2ToolResultOutput,
157
+ LanguageModelV2ToolResultPart,
158
+ LanguageModelV2Usage,
159
159
  LoadAPIKeyError,
160
160
  LoadSettingError,
161
161
  NoContentGeneratedError,
162
162
  NoSuchModelError,
163
- ProviderV2_2 as ProviderV2,
164
- SharedV2Headers_2 as SharedV2Headers,
165
- SharedV2ProviderMetadata_2 as SharedV2ProviderMetadata,
166
- SharedV2ProviderOptions_2 as SharedV2ProviderOptions,
167
- SpeechModelV2_2 as SpeechModelV2,
168
- SpeechModelV2CallOptions_2 as SpeechModelV2CallOptions,
169
- SpeechModelV2CallWarning_2 as SpeechModelV2CallWarning,
163
+ ProviderV2,
164
+ SharedV2Headers,
165
+ SharedV2ProviderMetadata,
166
+ SharedV2ProviderOptions,
167
+ SpeechModelV2,
168
+ SpeechModelV2CallOptions,
169
+ SpeechModelV2CallWarning,
170
170
  TooManyEmbeddingValuesForCallError,
171
- TranscriptionModelV2_2 as TranscriptionModelV2,
172
- TranscriptionModelV2CallOptions_2 as TranscriptionModelV2CallOptions,
173
- TranscriptionModelV2CallWarning_2 as TranscriptionModelV2CallWarning,
171
+ TranscriptionModelV2,
172
+ TranscriptionModelV2CallOptions,
173
+ TranscriptionModelV2CallWarning,
174
174
  TypeValidationError,
175
175
  UnsupportedFunctionalityError,
176
176
  getErrorMessage_2 as getErrorMessage,
@@ -186,8 +186,10 @@ declare namespace _ai_sdk_provider_utils {
186
186
  EventSourceParserStream,
187
187
  AssistantContent,
188
188
  AssistantModelMessage,
189
+ DEFAULT_MAX_DOWNLOAD_SIZE,
189
190
  DataContent,
190
191
  DelayedPromise,
192
+ DownloadError_2 as DownloadError,
191
193
  FetchFunction,
192
194
  FilePart,
193
195
  FlexibleSchema,
@@ -268,12 +270,14 @@ declare namespace _ai_sdk_provider_utils {
268
270
  postFormDataToApi,
269
271
  postJsonToApi,
270
272
  postToApi,
273
+ readResponseWithSizeLimit,
271
274
  removeUndefinedEntries,
272
275
  resolve,
273
276
  safeParseJSON,
274
277
  safeValidateTypes,
275
278
  standardSchemaValidator,
276
279
  tool,
280
+ validateDownloadUrl,
277
281
  validateTypes,
278
282
  validator,
279
283
  withUserAgentSuffix,
@@ -290,38 +294,6 @@ declare namespace _ai_sdk_provider_utils {
290
294
  * @extends Error
291
295
  */
292
296
  export declare class AISDKError extends Error {
293
- private readonly [symbol$d_2];
294
- /**
295
- * The underlying cause of the error, if any.
296
- */
297
- readonly cause?: unknown;
298
- /**
299
- * Creates an AI SDK Error.
300
- *
301
- * @param {Object} params - The parameters for creating the error.
302
- * @param {string} params.name - The name of the error.
303
- * @param {string} params.message - The error message.
304
- * @param {unknown} [params.cause] - The underlying cause of the error.
305
- */
306
- constructor({ name, message, cause, }: {
307
- name: string;
308
- message: string;
309
- cause?: unknown;
310
- });
311
- /**
312
- * Checks if the given error is an AI SDK Error.
313
- * @param {unknown} error - The error to check.
314
- * @returns {boolean} True if the error is an AI SDK Error, false otherwise.
315
- */
316
- static isInstance(error: unknown): error is AISDKError;
317
- protected static hasMarker(error: unknown, marker: string): boolean;
318
- }
319
-
320
- /**
321
- * Custom error class for AI SDK related errors.
322
- * @extends Error
323
- */
324
- declare class AISDKError_2 extends Error {
325
297
  private readonly [symbol$d];
326
298
  /**
327
299
  * The underlying cause of the error, if any.
@@ -345,35 +317,11 @@ declare class AISDKError_2 extends Error {
345
317
  * @param {unknown} error - The error to check.
346
318
  * @returns {boolean} True if the error is an AI SDK Error, false otherwise.
347
319
  */
348
- static isInstance(error: unknown): error is AISDKError_2;
320
+ static isInstance(error: unknown): error is AISDKError;
349
321
  protected static hasMarker(error: unknown, marker: string): boolean;
350
322
  }
351
323
 
352
324
  export declare class APICallError extends AISDKError {
353
- private readonly [symbol$c_2];
354
- readonly url: string;
355
- readonly requestBodyValues: unknown;
356
- readonly statusCode?: number;
357
- readonly responseHeaders?: Record<string, string>;
358
- readonly responseBody?: string;
359
- readonly isRetryable: boolean;
360
- readonly data?: unknown;
361
- constructor({ message, url, requestBodyValues, statusCode, responseHeaders, responseBody, cause, isRetryable, // server error
362
- data, }: {
363
- message: string;
364
- url: string;
365
- requestBodyValues: unknown;
366
- statusCode?: number;
367
- responseHeaders?: Record<string, string>;
368
- responseBody?: string;
369
- cause?: unknown;
370
- isRetryable?: boolean;
371
- data?: unknown;
372
- });
373
- static isInstance(error: unknown): error is APICallError;
374
- }
375
-
376
- declare class APICallError_2 extends AISDKError_2 {
377
325
  private readonly [symbol$c];
378
326
  readonly url: string;
379
327
  readonly requestBodyValues: unknown;
@@ -394,7 +342,7 @@ declare class APICallError_2 extends AISDKError_2 {
394
342
  isRetryable?: boolean;
395
343
  data?: unknown;
396
344
  });
397
- static isInstance(error: unknown): error is APICallError_2;
345
+ static isInstance(error: unknown): error is APICallError;
398
346
  }
399
347
 
400
348
  export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
@@ -435,6 +383,8 @@ export declare type AsyncIterableStream<T> = AsyncIterable<T> & ReadableStream<T
435
383
  * Attributes is a map from string to attribute values.
436
384
  *
437
385
  * Note: only the own enumerable keys are counted as valid attribute keys.
386
+ *
387
+ * @since 1.3.0
438
388
  */
439
389
  declare interface Attributes {
440
390
  [attributeKey: string]: AttributeValue | undefined;
@@ -444,6 +394,8 @@ declare interface Attributes {
444
394
  * Attribute values may be any non-nullish primitive value except an object.
445
395
  *
446
396
  * null or undefined attribute values are invalid and will result in undefined behavior.
397
+ *
398
+ * @since 1.3.0
447
399
  */
448
400
  declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
449
401
 
@@ -538,7 +490,7 @@ export declare type CallSettings = {
538
490
  Warning from the model provider for this call. The call will proceed, but e.g.
539
491
  some settings might not be supported, which can lead to suboptimal results.
540
492
  */
541
- export declare type CallWarning = LanguageModelV2CallWarning_2;
493
+ export declare type CallWarning = LanguageModelV2CallWarning;
542
494
 
543
495
  export declare interface ChatInit<UI_MESSAGE extends UIMessage> {
544
496
  /**
@@ -778,6 +730,9 @@ export declare type ContentPart<TOOLS extends ToolSet> = {
778
730
  providerMetadata?: ProviderMetadata;
779
731
  });
780
732
 
733
+ /**
734
+ * @since 1.0.0
735
+ */
781
736
  declare interface Context {
782
737
  /**
783
738
  * Get a value from the context.
@@ -952,7 +907,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
952
907
  errorSchema: FlexibleValidator<T>;
953
908
  errorToMessage: (error: T) => string;
954
909
  isRetryable?: (response: Response, error?: T) => boolean;
955
- }) => ResponseHandler<APICallError_2>;
910
+ }) => ResponseHandler<APICallError>;
956
911
 
957
912
  declare const createJsonResponseHandler: <T>(responseSchema: FlexibleValidator<T>) => ResponseHandler<T>;
958
913
 
@@ -983,12 +938,12 @@ declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT,
983
938
  * @param options.languageModelMiddleware - Optional middleware to be applied to all language models from the registry. When multiple middlewares are provided, the first middleware will transform the input first, and the last middleware will be wrapped directly around the model.
984
939
  * @returns A new ProviderRegistryProvider instance that provides access to all registered providers with optional middleware applied to language models.
985
940
  */
986
- export declare function createProviderRegistry<PROVIDERS extends Record<string, ProviderV2_2>, SEPARATOR extends string = ':'>(providers: PROVIDERS, { separator, languageModelMiddleware, }?: {
941
+ export declare function createProviderRegistry<PROVIDERS extends Record<string, ProviderV2>, SEPARATOR extends string = ':'>(providers: PROVIDERS, { separator, languageModelMiddleware, }?: {
987
942
  separator?: SEPARATOR;
988
943
  languageModelMiddleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
989
944
  }): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
990
945
 
991
- declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError_2>;
946
+ declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
992
947
 
993
948
  export declare function createTextStreamResponse({ status, statusText, headers, textStream, }: ResponseInit & {
994
949
  textStream: ReadableStream<string>;
@@ -1031,19 +986,19 @@ export declare function createUIMessageStreamResponse({ status, statusText, head
1031
986
  *
1032
987
  * @throws {NoSuchModelError} Throws when a requested model is not found and no fallback provider is available.
1033
988
  */
1034
- export declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV2_2>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV2_2<string>>, IMAGE_MODELS extends Record<string, ImageModelV2_2>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV2_2>, SPEECH_MODELS extends Record<string, SpeechModelV2_2>>({ languageModels, textEmbeddingModels, imageModels, transcriptionModels, speechModels, fallbackProvider, }: {
989
+ export declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV2>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV2<string>>, IMAGE_MODELS extends Record<string, ImageModelV2>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV2>, SPEECH_MODELS extends Record<string, SpeechModelV2>>({ languageModels, textEmbeddingModels, imageModels, transcriptionModels, speechModels, fallbackProvider, }: {
1035
990
  languageModels?: LANGUAGE_MODELS;
1036
991
  textEmbeddingModels?: EMBEDDING_MODELS;
1037
992
  imageModels?: IMAGE_MODELS;
1038
993
  transcriptionModels?: TRANSCRIPTION_MODELS;
1039
994
  speechModels?: SPEECH_MODELS;
1040
- fallbackProvider?: ProviderV2_2;
1041
- }): ProviderV2_2 & {
1042
- languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV2_2;
1043
- textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>): EmbeddingModelV2_2<string>;
1044
- imageModel(modelId: ExtractModelId<IMAGE_MODELS>): ImageModelV2_2;
1045
- transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>): TranscriptionModelV2_2;
1046
- speechModel(modelId: ExtractModelId<SPEECH_MODELS>): SpeechModelV2_2;
995
+ fallbackProvider?: ProviderV2;
996
+ }): ProviderV2 & {
997
+ languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV2;
998
+ textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>): EmbeddingModelV2<string>;
999
+ imageModel(modelId: ExtractModelId<IMAGE_MODELS>): ImageModelV2;
1000
+ transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>): TranscriptionModelV2;
1001
+ speechModel(modelId: ExtractModelId<SPEECH_MODELS>): SpeechModelV2;
1047
1002
  };
1048
1003
 
1049
1004
  /**
@@ -1079,6 +1034,19 @@ export declare type DeepPartial<T> = T extends z3.ZodTypeAny ? DeepPartialIntern
1079
1034
 
1080
1035
  declare type DeepPartialInternal<T> = T extends null | undefined | string | number | boolean | symbol | bigint | void | Date | RegExp | ((...arguments_: any[]) => unknown) | (new (...arguments_: any[]) => unknown) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMap<KeyType, ValueType> : T extends Set<infer ItemType> ? PartialSet<ItemType> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMap<KeyType, ValueType> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySet<ItemType> : T extends object ? T extends ReadonlyArray<infer ItemType> ? ItemType[] extends T ? readonly ItemType[] extends T ? ReadonlyArray<DeepPartialInternal<ItemType | undefined>> : Array<DeepPartialInternal<ItemType | undefined>> : PartialObject<T> : PartialObject<T> : unknown;
1081
1036
 
1037
+ /**
1038
+ * Default maximum download size: 2 GiB.
1039
+ *
1040
+ * `fetch().arrayBuffer()` has ~2x peak memory overhead (undici buffers the
1041
+ * body internally, then creates the JS ArrayBuffer), so very large downloads
1042
+ * risk exceeding the default V8 heap limit on 64-bit systems and terminating
1043
+ * the process with an out-of-memory error.
1044
+ *
1045
+ * Setting this limit converts an unrecoverable OOM crash into a catchable
1046
+ * `DownloadError`.
1047
+ */
1048
+ declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
1049
+
1082
1050
  export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
1083
1051
  constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
1084
1052
  protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
@@ -1089,19 +1057,19 @@ export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends
1089
1057
  */
1090
1058
  export declare function defaultSettingsMiddleware({ settings, }: {
1091
1059
  settings: Partial<{
1092
- maxOutputTokens?: LanguageModelV2CallOptions_2['maxOutputTokens'];
1093
- temperature?: LanguageModelV2CallOptions_2['temperature'];
1094
- stopSequences?: LanguageModelV2CallOptions_2['stopSequences'];
1095
- topP?: LanguageModelV2CallOptions_2['topP'];
1096
- topK?: LanguageModelV2CallOptions_2['topK'];
1097
- presencePenalty?: LanguageModelV2CallOptions_2['presencePenalty'];
1098
- frequencyPenalty?: LanguageModelV2CallOptions_2['frequencyPenalty'];
1099
- responseFormat?: LanguageModelV2CallOptions_2['responseFormat'];
1100
- seed?: LanguageModelV2CallOptions_2['seed'];
1101
- tools?: LanguageModelV2CallOptions_2['tools'];
1102
- toolChoice?: LanguageModelV2CallOptions_2['toolChoice'];
1103
- headers?: LanguageModelV2CallOptions_2['headers'];
1104
- providerOptions?: LanguageModelV2CallOptions_2['providerOptions'];
1060
+ maxOutputTokens?: LanguageModelV2CallOptions['maxOutputTokens'];
1061
+ temperature?: LanguageModelV2CallOptions['temperature'];
1062
+ stopSequences?: LanguageModelV2CallOptions['stopSequences'];
1063
+ topP?: LanguageModelV2CallOptions['topP'];
1064
+ topK?: LanguageModelV2CallOptions['topK'];
1065
+ presencePenalty?: LanguageModelV2CallOptions['presencePenalty'];
1066
+ frequencyPenalty?: LanguageModelV2CallOptions['frequencyPenalty'];
1067
+ responseFormat?: LanguageModelV2CallOptions['responseFormat'];
1068
+ seed?: LanguageModelV2CallOptions['seed'];
1069
+ tools?: LanguageModelV2CallOptions['tools'];
1070
+ toolChoice?: LanguageModelV2CallOptions['toolChoice'];
1071
+ headers?: LanguageModelV2CallOptions['headers'];
1072
+ providerOptions?: LanguageModelV2CallOptions['providerOptions'];
1105
1073
  }>;
1106
1074
  }): LanguageModelMiddleware;
1107
1075
 
@@ -1149,6 +1117,21 @@ export declare class DownloadError extends AISDKError {
1149
1117
  static isInstance(error: unknown): error is DownloadError;
1150
1118
  }
1151
1119
 
1120
+ declare class DownloadError_2 extends AISDKError {
1121
+ private readonly [symbol];
1122
+ readonly url: string;
1123
+ readonly statusCode?: number;
1124
+ readonly statusText?: string;
1125
+ constructor({ url, statusCode, statusText, cause, message, }: {
1126
+ url: string;
1127
+ statusCode?: number;
1128
+ statusText?: string;
1129
+ message?: string;
1130
+ cause?: unknown;
1131
+ });
1132
+ static isInstance(error: unknown): error is DownloadError_2;
1133
+ }
1134
+
1152
1135
  /**
1153
1136
  Helper function for defining a dynamic tool.
1154
1137
  */
@@ -1296,12 +1279,12 @@ export declare function embed<VALUE = string>({ model: modelArg, value, provider
1296
1279
  /**
1297
1280
  Embedding.
1298
1281
  */
1299
- export declare type Embedding = EmbeddingModelV2Embedding_2;
1282
+ export declare type Embedding = EmbeddingModelV2Embedding;
1300
1283
 
1301
1284
  /**
1302
1285
  Embedding model that is used by the AI SDK Core functions.
1303
1286
  */
1304
- export declare type EmbeddingModel<VALUE = string> = string | EmbeddingModelV2_2<VALUE>;
1287
+ export declare type EmbeddingModel<VALUE = string> = string | EmbeddingModelV2<VALUE>;
1305
1288
 
1306
1289
  /**
1307
1290
  Represents the number of tokens used in an embedding.
@@ -1407,112 +1390,12 @@ declare type EmbeddingModelV2<VALUE> = {
1407
1390
  }>;
1408
1391
  };
1409
1392
 
1410
- /**
1411
- Specification for an embedding model that implements the embedding model
1412
- interface version 1.
1413
-
1414
- VALUE is the type of the values that the model can embed.
1415
- This will allow us to go beyond text embeddings in the future,
1416
- e.g. to support image embeddings
1417
- */
1418
- declare type EmbeddingModelV2_2<VALUE> = {
1419
- /**
1420
- The embedding model must specify which embedding model interface
1421
- version it implements. This will allow us to evolve the embedding
1422
- model interface and retain backwards compatibility. The different
1423
- implementation versions can be handled as a discriminated union
1424
- on our side.
1425
- */
1426
- readonly specificationVersion: 'v2';
1427
- /**
1428
- Name of the provider for logging purposes.
1429
- */
1430
- readonly provider: string;
1431
- /**
1432
- Provider-specific model ID for logging purposes.
1433
- */
1434
- readonly modelId: string;
1435
- /**
1436
- Limit of how many embeddings can be generated in a single API call.
1437
-
1438
- Use Infinity for models that do not have a limit.
1439
- */
1440
- readonly maxEmbeddingsPerCall: PromiseLike<number | undefined> | number | undefined;
1441
- /**
1442
- True if the model can handle multiple embedding calls in parallel.
1443
- */
1444
- readonly supportsParallelCalls: PromiseLike<boolean> | boolean;
1445
- /**
1446
- Generates a list of embeddings for the given input text.
1447
-
1448
- Naming: "do" prefix to prevent accidental direct usage of the method
1449
- by the user.
1450
- */
1451
- doEmbed(options: {
1452
- /**
1453
- List of values to embed.
1454
- */
1455
- values: Array<VALUE>;
1456
- /**
1457
- Abort signal for cancelling the operation.
1458
- */
1459
- abortSignal?: AbortSignal;
1460
- /**
1461
- Additional provider-specific options. They are passed through
1462
- to the provider from the AI SDK and enable provider-specific
1463
- functionality that can be fully encapsulated in the provider.
1464
- */
1465
- providerOptions?: SharedV2ProviderOptions_2;
1466
- /**
1467
- Additional HTTP headers to be sent with the request.
1468
- Only applicable for HTTP-based providers.
1469
- */
1470
- headers?: Record<string, string | undefined>;
1471
- }): PromiseLike<{
1472
- /**
1473
- Generated embeddings. They are in the same order as the input values.
1474
- */
1475
- embeddings: Array<EmbeddingModelV2Embedding_2>;
1476
- /**
1477
- Token usage. We only have input tokens for embeddings.
1478
- */
1479
- usage?: {
1480
- tokens: number;
1481
- };
1482
- /**
1483
- Additional provider-specific metadata. They are passed through
1484
- from the provider to the AI SDK and enable provider-specific
1485
- results that can be fully encapsulated in the provider.
1486
- */
1487
- providerMetadata?: SharedV2ProviderMetadata_2;
1488
- /**
1489
- Optional response information for debugging purposes.
1490
- */
1491
- response?: {
1492
- /**
1493
- Response headers.
1494
- */
1495
- headers?: SharedV2Headers_2;
1496
- /**
1497
- The response body.
1498
- */
1499
- body?: unknown;
1500
- };
1501
- }>;
1502
- };
1503
-
1504
1393
  /**
1505
1394
  An embedding is a vector, i.e. an array of numbers.
1506
1395
  It is e.g. used to represent a text as a vector of word embeddings.
1507
1396
  */
1508
1397
  declare type EmbeddingModelV2Embedding = Array<number>;
1509
1398
 
1510
- /**
1511
- An embedding is a vector, i.e. an array of numbers.
1512
- It is e.g. used to represent a text as a vector of word embeddings.
1513
- */
1514
- declare type EmbeddingModelV2Embedding_2 = Array<number>;
1515
-
1516
1399
  /**
1517
1400
  Embed several values using an embedding model. The type of the value is defined
1518
1401
  by the embedding model.
@@ -1705,6 +1588,8 @@ declare class EventSourceParserStream extends TransformStream<string, EventSourc
1705
1588
  * Defines Exception.
1706
1589
  *
1707
1590
  * string or an object with one of (message or name or code) and optional stack
1591
+ *
1592
+ * @since 1.0.0
1708
1593
  */
1709
1594
  declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
1710
1595
 
@@ -2013,7 +1898,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
2013
1898
  /**
2014
1899
  The speech model to use.
2015
1900
  */
2016
- model: SpeechModelV2_2;
1901
+ model: SpeechModelV2;
2017
1902
  /**
2018
1903
  The text to convert to speech.
2019
1904
  */
@@ -2096,14 +1981,14 @@ export declare interface Experimental_SpeechResult {
2096
1981
  /**
2097
1982
  Provider metadata from the provider.
2098
1983
  */
2099
- readonly providerMetadata: Record<string, Record<string, JSONValue_3>>;
1984
+ readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
2100
1985
  }
2101
1986
 
2102
1987
  export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
2103
1988
  /**
2104
1989
  The transcription model to use.
2105
1990
  */
2106
- model: TranscriptionModelV2_2;
1991
+ model: TranscriptionModelV2;
2107
1992
  /**
2108
1993
  The audio data to transcribe.
2109
1994
  */
@@ -2201,10 +2086,10 @@ export declare interface Experimental_TranscriptionResult {
2201
2086
  /**
2202
2087
  Provider metadata from the provider.
2203
2088
  */
2204
- readonly providerMetadata: Record<string, Record<string, JSONValue_3>>;
2089
+ readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
2205
2090
  }
2206
2091
 
2207
- export declare type Experimental_Warning = LanguageModelV2CallWarning_2 | ImageModelV2CallWarning_2 | SpeechModelV2CallWarning_2 | TranscriptionModelV2CallWarning_2;
2092
+ export declare type Experimental_Warning = LanguageModelV2CallWarning | ImageModelV2CallWarning | SpeechModelV2CallWarning | TranscriptionModelV2CallWarning;
2208
2093
 
2209
2094
  declare type ExtractLiteralUnion<T> = T extends string ? string extends T ? never : T : never;
2210
2095
 
@@ -2306,7 +2191,7 @@ export declare type FileUIPart = {
2306
2191
  - `error`: model stopped because of an error
2307
2192
  - `other`: model stopped for other reasons
2308
2193
  */
2309
- export declare type FinishReason = LanguageModelV2FinishReason_2;
2194
+ export declare type FinishReason = LanguageModelV2FinishReason;
2310
2195
 
2311
2196
  declare type FlexibleSchema<SCHEMA> = z4.core.$ZodType<SCHEMA, any> | z3.Schema<SCHEMA, z3.ZodTypeDef, any> | Schema<SCHEMA> | LazySchema<SCHEMA>;
2312
2197
 
@@ -2321,13 +2206,57 @@ declare interface GatewayCreditsResponse {
2321
2206
  totalUsed: string;
2322
2207
  }
2323
2208
 
2324
- declare type GatewayEmbeddingModelId = 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | 'voyage/voyage-code-2' | (string & {});
2209
+ declare type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
2325
2210
 
2326
2211
  declare interface GatewayFetchMetadataResponse {
2327
2212
  models: GatewayLanguageModelEntry[];
2328
2213
  }
2329
2214
 
2330
- declare type GatewayImageModelId = 'google/imagen-4.0-generate' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | (string & {});
2215
+ declare interface GatewayGenerationInfo {
2216
+ /** The generation ID */
2217
+ id: string;
2218
+ /** Total cost in USD */
2219
+ totalCost: number;
2220
+ /** Upstream inference cost in USD (BYOK only) */
2221
+ upstreamInferenceCost: number;
2222
+ /** Usage cost in USD (same as totalCost) */
2223
+ usage: number;
2224
+ /** ISO 8601 timestamp when the generation was created */
2225
+ createdAt: string;
2226
+ /** Model identifier */
2227
+ model: string;
2228
+ /** Whether BYOK credentials were used */
2229
+ isByok: boolean;
2230
+ /** Provider that served this generation */
2231
+ providerName: string;
2232
+ /** Whether streaming was used */
2233
+ streamed: boolean;
2234
+ /** Finish reason (e.g. 'stop') */
2235
+ finishReason: string;
2236
+ /** Time to first token in milliseconds */
2237
+ latency: number;
2238
+ /** Total generation time in milliseconds */
2239
+ generationTime: number;
2240
+ /** Number of prompt tokens */
2241
+ promptTokens: number;
2242
+ /** Number of completion tokens */
2243
+ completionTokens: number;
2244
+ /** Reasoning tokens used */
2245
+ reasoningTokens: number;
2246
+ /** Cached tokens used */
2247
+ cachedTokens: number;
2248
+ /** Cache creation input tokens */
2249
+ cacheCreationTokens: number;
2250
+ /** Billable web search calls */
2251
+ billableWebSearchCalls: number;
2252
+ }
2253
+
2254
+ declare interface GatewayGenerationInfoParams {
2255
+ /** The generation ID to look up (format: gen_<ulid>) */
2256
+ id: string;
2257
+ }
2258
+
2259
+ declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'prodia/flux-fast-schnell' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'xai/grok-imagine-image' | 'xai/grok-imagine-image-pro' | (string & {});
2331
2260
 
2332
2261
  declare interface GatewayLanguageModelEntry {
2333
2262
  /**
@@ -2373,12 +2302,12 @@ declare interface GatewayLanguageModelEntry {
2373
2302
  /**
2374
2303
  * Optional field to differentiate between model types.
2375
2304
  */
2376
- modelType?: 'language' | 'embedding' | 'image' | null;
2305
+ modelType?: KnownModelType | null;
2377
2306
  }
2378
2307
 
2379
2308
  declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
2380
2309
 
2381
- export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.5-sonnet-20240620' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2-exp' | 'deepseek/deepseek-v3.2-exp-thinking' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-image-preview' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-lite-preview-09-2025' | 'google/gemini-2.5-flash-preview-09-2025' | 'google/gemini-2.5-pro' | 'google/gemini-3-pro-preview' | 'google/gemini-3-pro-image' | 'google/gemini-3-flash' | 'inception/mercury-coder-small' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'mistral/codestral' | 'mistral/devstral-small' | 'mistral/magistral-medium' | 'mistral/magistral-medium-2506' | 'mistral/magistral-small' | 'mistral/magistral-small-2506' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large' | 'mistral/mistral-medium' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat-latest' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning' | 'perplexity/sonar-reasoning-pro' | 'prime-intellect/intellect-3' | 'vercel/v0-1.0-md' | 'vercel/v0-1.5-md' | 'xai/grok-2-vision' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-code-fast-1' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flashx' | (string & {});
2310
+ export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'prime-intellect/intellect-3' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5v-turbo' | (string & {});
2382
2311
 
2383
2312
  declare interface GatewayProvider extends ProviderV2 {
2384
2313
  (modelId: GatewayModelId): LanguageModelV2;
@@ -2394,6 +2323,16 @@ declare interface GatewayProvider extends ProviderV2 {
2394
2323
  Returns credit information for the authenticated user.
2395
2324
  */
2396
2325
  getCredits(): Promise<GatewayCreditsResponse>;
2326
+ /**
2327
+ * Returns a spend report with cost, token, and request count data,
2328
+ * aggregated by the specified dimension.
2329
+ */
2330
+ getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
2331
+ /**
2332
+ * Returns detailed information about a specific generation by its ID,
2333
+ * including cost, token usage, latency, and provider details.
2334
+ */
2335
+ getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
2397
2336
  /**
2398
2337
  Creates a model for generating text embeddings.
2399
2338
  */
@@ -2432,6 +2371,64 @@ declare interface GatewayProviderSettings {
2432
2371
  metadataCacheRefreshMillis?: number;
2433
2372
  }
2434
2373
 
2374
+ declare interface GatewaySpendReportParams {
2375
+ /** Start date in YYYY-MM-DD format (inclusive) */
2376
+ startDate: string;
2377
+ /** End date in YYYY-MM-DD format (inclusive) */
2378
+ endDate: string;
2379
+ /** Primary aggregation dimension. Defaults to 'day'. */
2380
+ groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
2381
+ /** Time granularity when groupBy is 'day'. */
2382
+ datePart?: 'day' | 'hour';
2383
+ /** Filter to a specific user's spend. */
2384
+ userId?: string;
2385
+ /** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
2386
+ model?: string;
2387
+ /** Filter to a specific provider (e.g. 'anthropic'). */
2388
+ provider?: string;
2389
+ /** Filter to BYOK or system credentials. */
2390
+ credentialType?: 'byok' | 'system';
2391
+ /** Filter to requests with these tags. */
2392
+ tags?: string[];
2393
+ }
2394
+
2395
+ declare interface GatewaySpendReportResponse {
2396
+ results: GatewaySpendReportRow[];
2397
+ }
2398
+
2399
+ declare interface GatewaySpendReportRow {
2400
+ /** Date string (present when groupBy is 'day') */
2401
+ day?: string;
2402
+ /** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
2403
+ hour?: string;
2404
+ /** User identifier (present when groupBy is 'user') */
2405
+ user?: string;
2406
+ /** Model identifier (present when groupBy is 'model') */
2407
+ model?: string;
2408
+ /** Tag value (present when groupBy is 'tag') */
2409
+ tag?: string;
2410
+ /** Provider name (present when groupBy is 'provider') */
2411
+ provider?: string;
2412
+ /** Credential type (present when groupBy is 'credential_type') */
2413
+ credentialType?: 'byok' | 'system';
2414
+ /** Total cost in USD */
2415
+ totalCost: number;
2416
+ /** Market cost in USD */
2417
+ marketCost?: number;
2418
+ /** Number of input tokens */
2419
+ inputTokens?: number;
2420
+ /** Number of output tokens */
2421
+ outputTokens?: number;
2422
+ /** Number of cached input tokens */
2423
+ cachedInputTokens?: number;
2424
+ /** Number of cache creation input tokens */
2425
+ cacheCreationInputTokens?: number;
2426
+ /** Number of reasoning tokens */
2427
+ reasoningTokens?: number;
2428
+ /** Number of requests */
2429
+ requestCount?: number;
2430
+ }
2431
+
2435
2432
  /**
2436
2433
  * Gateway-specific provider-defined tools.
2437
2434
  */
@@ -2557,7 +2554,7 @@ export declare const generateId: IdGenerator;
2557
2554
  @returns
2558
2555
  A result object that contains the generated object, the finish reason, the token usage, and additional information.
2559
2556
  */
2560
- export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue_3>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<CallSettings, 'stopSequences'> & Prompt & (OUTPUT extends 'enum' ? {
2557
+ export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue_2>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<CallSettings, 'stopSequences'> & Prompt & (OUTPUT extends 'enum' ? {
2561
2558
  /**
2562
2559
  The enum values that the model should use.
2563
2560
  */
@@ -2935,10 +2932,6 @@ declare type GetMaxImagesPerCallFunction = (options: {
2935
2932
  modelId: string;
2936
2933
  }) => PromiseLike<number | undefined> | number | undefined;
2937
2934
 
2938
- declare type GetMaxImagesPerCallFunction_2 = (options: {
2939
- modelId: string;
2940
- }) => PromiseLike<number | undefined> | number | undefined;
2941
-
2942
2935
  declare const getOriginalFetch: () => typeof fetch;
2943
2936
 
2944
2937
  declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
@@ -2973,6 +2966,8 @@ export declare function hasToolCall(toolName: string): StopCondition<any>;
2973
2966
  * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
2974
2967
  * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
2975
2968
  * This is represented in HrTime format as [1609504210, 150000000].
2969
+ *
2970
+ * @since 1.0.0
2976
2971
  */
2977
2972
  declare type HrTime = [number, number];
2978
2973
 
@@ -3059,18 +3054,18 @@ export declare type IdGenerator = () => string;
3059
3054
  /**
3060
3055
  Image model that is used by the AI SDK Core functions.
3061
3056
  */
3062
- export declare type ImageModel = string | ImageModelV2_2;
3057
+ export declare type ImageModel = string | ImageModelV2;
3063
3058
 
3064
3059
  /**
3065
3060
  Warning from the model provider for this call. The call will proceed, but e.g.
3066
3061
  some settings might not be supported, which can lead to suboptimal results.
3067
3062
  */
3068
- export declare type ImageModelCallWarning = ImageModelV2CallWarning_2;
3063
+ export declare type ImageModelCallWarning = ImageModelV2CallWarning;
3069
3064
 
3070
3065
  /**
3071
3066
  Metadata from the model provider for this call
3072
3067
  */
3073
- export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata_2;
3068
+ export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata;
3074
3069
 
3075
3070
  export declare type ImageModelResponseMetadata = {
3076
3071
  /**
@@ -3168,116 +3163,35 @@ declare type ImageModelV2 = {
3168
3163
  }>;
3169
3164
  };
3170
3165
 
3171
- /**
3172
- Image generation model specification version 2.
3173
- */
3174
- declare type ImageModelV2_2 = {
3166
+ declare type ImageModelV2CallOptions = {
3175
3167
  /**
3176
- The image model must specify which image model interface
3177
- version it implements. This will allow us to evolve the image
3178
- model interface and retain backwards compatibility. The different
3179
- implementation versions can be handled as a discriminated union
3180
- on our side.
3168
+ Prompt for the image generation.
3181
3169
  */
3182
- readonly specificationVersion: 'v2';
3170
+ prompt: string;
3183
3171
  /**
3184
- Name of the provider for logging purposes.
3172
+ Number of images to generate.
3185
3173
  */
3186
- readonly provider: string;
3174
+ n: number;
3187
3175
  /**
3188
- Provider-specific model ID for logging purposes.
3176
+ Size of the images to generate.
3177
+ Must have the format `{width}x{height}`.
3178
+ `undefined` will use the provider's default size.
3189
3179
  */
3190
- readonly modelId: string;
3180
+ size: `${number}x${number}` | undefined;
3191
3181
  /**
3192
- Limit of how many images can be generated in a single API call.
3193
- Can be set to a number for a fixed limit, to undefined to use
3194
- the global limit, or a function that returns a number or undefined,
3195
- optionally as a promise.
3182
+ Aspect ratio of the images to generate.
3183
+ Must have the format `{width}:{height}`.
3184
+ `undefined` will use the provider's default aspect ratio.
3196
3185
  */
3197
- readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction_2;
3186
+ aspectRatio: `${number}:${number}` | undefined;
3198
3187
  /**
3199
- Generates an array of images.
3188
+ Seed for the image generation.
3189
+ `undefined` will use the provider's default seed.
3200
3190
  */
3201
- doGenerate(options: ImageModelV2CallOptions_2): PromiseLike<{
3202
- /**
3203
- Generated images as base64 encoded strings or binary data.
3204
- The images should be returned without any unnecessary conversion.
3205
- If the API returns base64 encoded strings, the images should be returned
3206
- as base64 encoded strings. If the API returns binary data, the images should
3207
- be returned as binary data.
3208
- */
3209
- images: Array<string> | Array<Uint8Array>;
3210
- /**
3211
- Warnings for the call, e.g. unsupported settings.
3212
- */
3213
- warnings: Array<ImageModelV2CallWarning_2>;
3214
- /**
3215
- Additional provider-specific metadata. They are passed through
3216
- from the provider to the AI SDK and enable provider-specific
3217
- results that can be fully encapsulated in the provider.
3218
-
3219
- The outer record is keyed by the provider name, and the inner
3220
- record is provider-specific metadata. It always includes an
3221
- `images` key with image-specific metadata
3222
-
3223
- ```ts
3224
- {
3225
- "openai": {
3226
- "images": ["revisedPrompt": "Revised prompt here."]
3227
- }
3228
- }
3229
- ```
3230
- */
3231
- providerMetadata?: ImageModelV2ProviderMetadata_2;
3232
- /**
3233
- Response information for telemetry and debugging purposes.
3234
- */
3235
- response: {
3236
- /**
3237
- Timestamp for the start of the generated response.
3238
- */
3239
- timestamp: Date;
3240
- /**
3241
- The ID of the response model that was used to generate the response.
3242
- */
3243
- modelId: string;
3244
- /**
3245
- Response headers.
3246
- */
3247
- headers: Record<string, string> | undefined;
3248
- };
3249
- }>;
3250
- };
3251
-
3252
- declare type ImageModelV2CallOptions = {
3253
- /**
3254
- Prompt for the image generation.
3255
- */
3256
- prompt: string;
3257
- /**
3258
- Number of images to generate.
3259
- */
3260
- n: number;
3261
- /**
3262
- Size of the images to generate.
3263
- Must have the format `{width}x{height}`.
3264
- `undefined` will use the provider's default size.
3265
- */
3266
- size: `${number}x${number}` | undefined;
3267
- /**
3268
- Aspect ratio of the images to generate.
3269
- Must have the format `{width}:{height}`.
3270
- `undefined` will use the provider's default aspect ratio.
3271
- */
3272
- aspectRatio: `${number}:${number}` | undefined;
3273
- /**
3274
- Seed for the image generation.
3275
- `undefined` will use the provider's default seed.
3276
- */
3277
- seed: number | undefined;
3278
- /**
3279
- Additional provider-specific options that are passed through to the provider
3280
- as body parameters.
3191
+ seed: number | undefined;
3192
+ /**
3193
+ Additional provider-specific options that are passed through to the provider
3194
+ as body parameters.
3281
3195
 
3282
3196
  The outer record is keyed by the provider name, and the inner
3283
3197
  record is keyed by the provider-specific metadata key.
@@ -3301,58 +3215,6 @@ declare type ImageModelV2CallOptions = {
3301
3215
  headers?: Record<string, string | undefined>;
3302
3216
  };
3303
3217
 
3304
- declare type ImageModelV2CallOptions_2 = {
3305
- /**
3306
- Prompt for the image generation.
3307
- */
3308
- prompt: string;
3309
- /**
3310
- Number of images to generate.
3311
- */
3312
- n: number;
3313
- /**
3314
- Size of the images to generate.
3315
- Must have the format `{width}x{height}`.
3316
- `undefined` will use the provider's default size.
3317
- */
3318
- size: `${number}x${number}` | undefined;
3319
- /**
3320
- Aspect ratio of the images to generate.
3321
- Must have the format `{width}:{height}`.
3322
- `undefined` will use the provider's default aspect ratio.
3323
- */
3324
- aspectRatio: `${number}:${number}` | undefined;
3325
- /**
3326
- Seed for the image generation.
3327
- `undefined` will use the provider's default seed.
3328
- */
3329
- seed: number | undefined;
3330
- /**
3331
- Additional provider-specific options that are passed through to the provider
3332
- as body parameters.
3333
-
3334
- The outer record is keyed by the provider name, and the inner
3335
- record is keyed by the provider-specific metadata key.
3336
- ```ts
3337
- {
3338
- "openai": {
3339
- "style": "vivid"
3340
- }
3341
- }
3342
- ```
3343
- */
3344
- providerOptions: SharedV2ProviderOptions_2;
3345
- /**
3346
- Abort signal for cancelling the operation.
3347
- */
3348
- abortSignal?: AbortSignal;
3349
- /**
3350
- Additional HTTP headers to be sent with the request.
3351
- Only applicable for HTTP-based providers.
3352
- */
3353
- headers?: Record<string, string | undefined>;
3354
- };
3355
-
3356
3218
  /**
3357
3219
  Warning from the model provider for this call. The call will proceed, but e.g.
3358
3220
  some settings might not be supported, which can lead to suboptimal results.
@@ -3366,27 +3228,10 @@ declare type ImageModelV2CallWarning = {
3366
3228
  message: string;
3367
3229
  };
3368
3230
 
3369
- /**
3370
- Warning from the model provider for this call. The call will proceed, but e.g.
3371
- some settings might not be supported, which can lead to suboptimal results.
3372
- */
3373
- declare type ImageModelV2CallWarning_2 = {
3374
- type: 'unsupported-setting';
3375
- setting: keyof ImageModelV2CallOptions_2;
3376
- details?: string;
3377
- } | {
3378
- type: 'other';
3379
- message: string;
3380
- };
3381
-
3382
3231
  declare type ImageModelV2ProviderMetadata = Record<string, {
3383
3232
  images: JSONArray;
3384
3233
  } & JSONValue_2>;
3385
3234
 
3386
- declare type ImageModelV2ProviderMetadata_2 = Record<string, {
3387
- images: JSONArray_2;
3388
- } & JSONValue_3>;
3389
-
3390
3235
  /**
3391
3236
  Image content part of a prompt. It contains an image.
3392
3237
  */
@@ -3474,7 +3319,7 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
3474
3319
  }): LanguageModelV2Prompt;
3475
3320
 
3476
3321
  export declare class InvalidArgumentError extends AISDKError {
3477
- private readonly [symbol$c_3];
3322
+ private readonly [symbol$c_2];
3478
3323
  readonly parameter: string;
3479
3324
  readonly value: unknown;
3480
3325
  constructor({ parameter, value, message, }: {
@@ -3593,11 +3438,11 @@ export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
3593
3438
  */
3594
3439
  export declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is FileUIPart;
3595
3440
 
3596
- declare function isJSONArray(value: unknown): value is JSONArray_2;
3441
+ declare function isJSONArray(value: unknown): value is JSONArray;
3597
3442
 
3598
- declare function isJSONObject(value: unknown): value is JSONObject_2;
3443
+ declare function isJSONObject(value: unknown): value is JSONObject;
3599
3444
 
3600
- declare function isJSONValue(value: unknown): value is JSONValue_3;
3445
+ declare function isJSONValue(value: unknown): value is JSONValue_2;
3601
3446
 
3602
3447
  declare function isParsableJson(input: string): boolean;
3603
3448
 
@@ -3638,34 +3483,18 @@ declare type Job = () => Promise<void>;
3638
3483
 
3639
3484
  declare type JSONArray = JSONValue_2[];
3640
3485
 
3641
- declare type JSONArray_2 = JSONValue_3[];
3642
-
3643
3486
  declare type JSONObject = {
3644
3487
  [key: string]: JSONValue_2;
3645
3488
  };
3646
3489
 
3647
- declare type JSONObject_2 = {
3648
- [key: string]: JSONValue_3;
3649
- };
3650
-
3651
3490
  export declare class JSONParseError extends AISDKError {
3652
- private readonly [symbol$7_2];
3653
- readonly text: string;
3654
- constructor({ text, cause }: {
3655
- text: string;
3656
- cause: unknown;
3657
- });
3658
- static isInstance(error: unknown): error is JSONParseError;
3659
- }
3660
-
3661
- declare class JSONParseError_2 extends AISDKError_2 {
3662
3491
  private readonly [symbol$7];
3663
3492
  readonly text: string;
3664
3493
  constructor({ text, cause }: {
3665
3494
  text: string;
3666
3495
  cause: unknown;
3667
3496
  });
3668
- static isInstance(error: unknown): error is JSONParseError_2;
3497
+ static isInstance(error: unknown): error is JSONParseError;
3669
3498
  }
3670
3499
 
3671
3500
  /**
@@ -3841,7 +3670,7 @@ export declare class JsonToSseTransformStream extends TransformStream<unknown, s
3841
3670
  constructor();
3842
3671
  }
3843
3672
 
3844
- export declare type JSONValue = JSONValue_3;
3673
+ export declare type JSONValue = JSONValue_2;
3845
3674
 
3846
3675
  /**
3847
3676
  A JSON value can be a string, number, boolean, object, array, or null.
@@ -3849,16 +3678,14 @@ export declare type JSONValue = JSONValue_3;
3849
3678
  */
3850
3679
  declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
3851
3680
 
3852
- /**
3853
- A JSON value can be a string, number, boolean, object, array, or null.
3854
- JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
3855
- */
3856
- declare type JSONValue_3 = null | string | number | boolean | JSONObject_2 | JSONArray_2;
3681
+ declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language"];
3682
+
3683
+ declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
3857
3684
 
3858
3685
  /**
3859
3686
  Language model that is used by the AI SDK Core functions.
3860
3687
  */
3861
- export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2_2;
3688
+ export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2;
3862
3689
 
3863
3690
  export declare type LanguageModelMiddleware = LanguageModelV2Middleware;
3864
3691
 
@@ -3891,7 +3718,7 @@ export declare type LanguageModelResponseMetadata = {
3891
3718
  /**
3892
3719
  Represents the number of tokens used in a prompt and completion.
3893
3720
  */
3894
- export declare type LanguageModelUsage = LanguageModelV2Usage_2;
3721
+ export declare type LanguageModelUsage = LanguageModelV2Usage;
3895
3722
 
3896
3723
  /**
3897
3724
  Specification for a language model that implements the language model interface version 2.
@@ -4005,118 +3832,6 @@ declare type LanguageModelV2 = {
4005
3832
  }>;
4006
3833
  };
4007
3834
 
4008
- /**
4009
- Specification for a language model that implements the language model interface version 2.
4010
- */
4011
- declare type LanguageModelV2_2 = {
4012
- /**
4013
- The language model must specify which language model interface version it implements.
4014
- */
4015
- readonly specificationVersion: 'v2';
4016
- /**
4017
- Name of the provider for logging purposes.
4018
- */
4019
- readonly provider: string;
4020
- /**
4021
- Provider-specific model ID for logging purposes.
4022
- */
4023
- readonly modelId: string;
4024
- /**
4025
- Supported URL patterns by media type for the provider.
4026
-
4027
- The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`).
4028
- and the values are arrays of regular expressions that match the URL paths.
4029
-
4030
- The matching should be against lower-case URLs.
4031
-
4032
- Matched URLs are supported natively by the model and are not downloaded.
4033
-
4034
- @returns A map of supported URL patterns by media type (as a promise or a plain object).
4035
- */
4036
- supportedUrls: PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
4037
- /**
4038
- Generates a language model output (non-streaming).
4039
-
4040
- Naming: "do" prefix to prevent accidental direct usage of the method
4041
- by the user.
4042
- */
4043
- doGenerate(options: LanguageModelV2CallOptions_2): PromiseLike<{
4044
- /**
4045
- Ordered content that the model has generated.
4046
- */
4047
- content: Array<LanguageModelV2Content_2>;
4048
- /**
4049
- Finish reason.
4050
- */
4051
- finishReason: LanguageModelV2FinishReason_2;
4052
- /**
4053
- Usage information.
4054
- */
4055
- usage: LanguageModelV2Usage_2;
4056
- /**
4057
- Additional provider-specific metadata. They are passed through
4058
- from the provider to the AI SDK and enable provider-specific
4059
- results that can be fully encapsulated in the provider.
4060
- */
4061
- providerMetadata?: SharedV2ProviderMetadata_2;
4062
- /**
4063
- Optional request information for telemetry and debugging purposes.
4064
- */
4065
- request?: {
4066
- /**
4067
- Request HTTP body that was sent to the provider API.
4068
- */
4069
- body?: unknown;
4070
- };
4071
- /**
4072
- Optional response information for telemetry and debugging purposes.
4073
- */
4074
- response?: LanguageModelV2ResponseMetadata_2 & {
4075
- /**
4076
- Response headers.
4077
- */
4078
- headers?: SharedV2Headers_2;
4079
- /**
4080
- Response HTTP body.
4081
- */
4082
- body?: unknown;
4083
- };
4084
- /**
4085
- Warnings for the call, e.g. unsupported settings.
4086
- */
4087
- warnings: Array<LanguageModelV2CallWarning_2>;
4088
- }>;
4089
- /**
4090
- Generates a language model output (streaming).
4091
-
4092
- Naming: "do" prefix to prevent accidental direct usage of the method
4093
- by the user.
4094
- *
4095
- @return A stream of higher-level language model output parts.
4096
- */
4097
- doStream(options: LanguageModelV2CallOptions_2): PromiseLike<{
4098
- stream: ReadableStream<LanguageModelV2StreamPart_2>;
4099
- /**
4100
- Optional request information for telemetry and debugging purposes.
4101
- */
4102
- request?: {
4103
- /**
4104
- Request HTTP body that was sent to the provider API.
4105
- */
4106
- body?: unknown;
4107
- };
4108
- /**
4109
- Optional response data.
4110
- */
4111
- response?: {
4112
- /**
4113
- Response headers.
4114
- */
4115
- headers?: SharedV2Headers_2;
4116
- };
4117
- }>;
4118
- };
4119
-
4120
3835
  declare type LanguageModelV2CallOptions = {
4121
3836
  /**
4122
3837
  A language mode prompt is a standardized prompt type.
@@ -4218,155 +3933,30 @@ declare type LanguageModelV2CallOptions = {
4218
3933
  providerOptions?: SharedV2ProviderOptions;
4219
3934
  };
4220
3935
 
4221
- declare type LanguageModelV2CallOptions_2 = {
4222
- /**
4223
- A language mode prompt is a standardized prompt type.
4224
-
4225
- Note: This is **not** the user-facing prompt. The AI SDK methods will map the
4226
- user-facing prompt types such as chat or instruction prompts to this format.
4227
- That approach allows us to evolve the user facing prompts without breaking
4228
- the language model interface.
4229
- */
4230
- prompt: LanguageModelV2Prompt_2;
4231
- /**
4232
- Maximum number of tokens to generate.
4233
- */
4234
- maxOutputTokens?: number;
4235
- /**
4236
- Temperature setting. The range depends on the provider and model.
4237
- */
4238
- temperature?: number;
4239
- /**
4240
- Stop sequences.
4241
- If set, the model will stop generating text when one of the stop sequences is generated.
4242
- Providers may have limits on the number of stop sequences.
4243
- */
4244
- stopSequences?: string[];
4245
- /**
4246
- Nucleus sampling.
4247
- */
4248
- topP?: number;
4249
- /**
4250
- Only sample from the top K options for each subsequent token.
4251
-
4252
- Used to remove "long tail" low probability responses.
4253
- Recommended for advanced use cases only. You usually only need to use temperature.
4254
- */
4255
- topK?: number;
4256
- /**
4257
- Presence penalty setting. It affects the likelihood of the model to
4258
- repeat information that is already in the prompt.
4259
- */
4260
- presencePenalty?: number;
4261
- /**
4262
- Frequency penalty setting. It affects the likelihood of the model
4263
- to repeatedly use the same words or phrases.
4264
- */
4265
- frequencyPenalty?: number;
4266
- /**
4267
- Response format. The output can either be text or JSON. Default is text.
4268
-
4269
- If JSON is selected, a schema can optionally be provided to guide the LLM.
4270
- */
4271
- responseFormat?: {
4272
- type: 'text';
4273
- } | {
4274
- type: 'json';
4275
- /**
4276
- * JSON schema that the generated output should conform to.
4277
- */
4278
- schema?: JSONSchema7;
4279
- /**
4280
- * Name of output that should be generated. Used by some providers for additional LLM guidance.
4281
- */
4282
- name?: string;
4283
- /**
4284
- * Description of the output that should be generated. Used by some providers for additional LLM guidance.
4285
- */
4286
- description?: string;
4287
- };
4288
- /**
4289
- The seed (integer) to use for random sampling. If set and supported
4290
- by the model, calls will generate deterministic results.
4291
- */
4292
- seed?: number;
4293
- /**
4294
- The tools that are available for the model.
4295
- */
4296
- tools?: Array<LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2>;
4297
- /**
4298
- Specifies how the tool should be selected. Defaults to 'auto'.
4299
- */
4300
- toolChoice?: LanguageModelV2ToolChoice_2;
4301
- /**
4302
- Include raw chunks in the stream. Only applicable for streaming calls.
4303
- */
4304
- includeRawChunks?: boolean;
4305
- /**
4306
- Abort signal for cancelling the operation.
4307
- */
4308
- abortSignal?: AbortSignal;
4309
- /**
4310
- Additional HTTP headers to be sent with the request.
4311
- Only applicable for HTTP-based providers.
4312
- */
4313
- headers?: Record<string, string | undefined>;
4314
- /**
4315
- * Additional provider-specific options. They are passed through
4316
- * to the provider from the AI SDK and enable provider-specific
4317
- * functionality that can be fully encapsulated in the provider.
4318
- */
4319
- providerOptions?: SharedV2ProviderOptions_2;
4320
- };
4321
-
4322
- /**
4323
- Warning from the model provider for this call. The call will proceed, but e.g.
4324
- some settings might not be supported, which can lead to suboptimal results.
4325
- */
4326
- declare type LanguageModelV2CallWarning = {
4327
- type: 'unsupported-setting';
4328
- setting: Omit<keyof LanguageModelV2CallOptions, 'prompt'>;
4329
- details?: string;
4330
- } | {
4331
- type: 'unsupported-tool';
4332
- tool: LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool;
4333
- details?: string;
4334
- } | {
4335
- type: 'other';
4336
- message: string;
4337
- };
4338
-
4339
- /**
4340
- Warning from the model provider for this call. The call will proceed, but e.g.
4341
- some settings might not be supported, which can lead to suboptimal results.
4342
- */
4343
- declare type LanguageModelV2CallWarning_2 = {
4344
- type: 'unsupported-setting';
4345
- setting: Omit<keyof LanguageModelV2CallOptions_2, 'prompt'>;
4346
- details?: string;
4347
- } | {
4348
- type: 'unsupported-tool';
4349
- tool: LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2;
4350
- details?: string;
4351
- } | {
4352
- type: 'other';
4353
- message: string;
4354
- };
3936
+ /**
3937
+ Warning from the model provider for this call. The call will proceed, but e.g.
3938
+ some settings might not be supported, which can lead to suboptimal results.
3939
+ */
3940
+ declare type LanguageModelV2CallWarning = {
3941
+ type: 'unsupported-setting';
3942
+ setting: Omit<keyof LanguageModelV2CallOptions, 'prompt'>;
3943
+ details?: string;
3944
+ } | {
3945
+ type: 'unsupported-tool';
3946
+ tool: LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool;
3947
+ details?: string;
3948
+ } | {
3949
+ type: 'other';
3950
+ message: string;
3951
+ };
4355
3952
 
4356
3953
  declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
4357
3954
 
4358
- declare type LanguageModelV2Content_2 = LanguageModelV2Text_2 | LanguageModelV2Reasoning_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2;
4359
-
4360
3955
  /**
4361
3956
  Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
4362
3957
  */
4363
3958
  declare type LanguageModelV2DataContent = Uint8Array | string | URL;
4364
3959
 
4365
- /**
4366
- Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
4367
- */
4368
- declare type LanguageModelV2DataContent_2 = Uint8Array | string | URL;
4369
-
4370
3960
  /**
4371
3961
  A file that has been generated by the model.
4372
3962
  Generated files as base64 encoded strings or binary data.
@@ -4391,30 +3981,6 @@ declare type LanguageModelV2File = {
4391
3981
  data: string | Uint8Array;
4392
3982
  };
4393
3983
 
4394
- /**
4395
- A file that has been generated by the model.
4396
- Generated files as base64 encoded strings or binary data.
4397
- The files should be returned without any unnecessary conversion.
4398
- */
4399
- declare type LanguageModelV2File_2 = {
4400
- type: 'file';
4401
- /**
4402
- The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
4403
-
4404
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
4405
- */
4406
- mediaType: string;
4407
- /**
4408
- Generated file data as base64 encoded strings or binary data.
4409
-
4410
- The file data should be returned without any unnecessary conversion.
4411
- If the API returns base64 encoded strings, the file data should be returned
4412
- as base64 encoded strings. If the API returns binary data, the file data should
4413
- be returned as binary data.
4414
- */
4415
- data: string | Uint8Array;
4416
- };
4417
-
4418
3984
  /**
4419
3985
  File content part of a prompt. It contains a file.
4420
3986
  */
@@ -4444,35 +4010,6 @@ declare interface LanguageModelV2FilePart {
4444
4010
  providerOptions?: SharedV2ProviderOptions;
4445
4011
  }
4446
4012
 
4447
- /**
4448
- File content part of a prompt. It contains a file.
4449
- */
4450
- declare interface LanguageModelV2FilePart_2 {
4451
- type: 'file';
4452
- /**
4453
- * Optional filename of the file.
4454
- */
4455
- filename?: string;
4456
- /**
4457
- File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
4458
- */
4459
- data: LanguageModelV2DataContent_2;
4460
- /**
4461
- IANA media type of the file.
4462
-
4463
- Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
4464
-
4465
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
4466
- */
4467
- mediaType: string;
4468
- /**
4469
- * Additional provider-specific options. They are passed through
4470
- * to the provider from the AI SDK and enable provider-specific
4471
- * functionality that can be fully encapsulated in the provider.
4472
- */
4473
- providerOptions?: SharedV2ProviderOptions_2;
4474
- }
4475
-
4476
4013
  /**
4477
4014
  Reason why a language model finished generating a response.
4478
4015
 
@@ -4487,20 +4024,6 @@ declare interface LanguageModelV2FilePart_2 {
4487
4024
  */
4488
4025
  declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4489
4026
 
4490
- /**
4491
- Reason why a language model finished generating a response.
4492
-
4493
- Can be one of the following:
4494
- - `stop`: model generated stop sequence
4495
- - `length`: model generated maximum number of tokens
4496
- - `content-filter`: content filter violation stopped the model
4497
- - `tool-calls`: model triggered tool calls
4498
- - `error`: model stopped because of an error
4499
- - `other`: model stopped for other reasons
4500
- - `unknown`: the model has not transmitted a finish reason
4501
- */
4502
- declare type LanguageModelV2FinishReason_2 = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4503
-
4504
4027
  /**
4505
4028
  A tool has a name, a description, and a set of parameters.
4506
4029
 
@@ -4532,37 +4055,6 @@ declare type LanguageModelV2FunctionTool = {
4532
4055
  providerOptions?: SharedV2ProviderOptions;
4533
4056
  };
4534
4057
 
4535
- /**
4536
- A tool has a name, a description, and a set of parameters.
4537
-
4538
- Note: this is **not** the user-facing tool definition. The AI SDK methods will
4539
- map the user-facing tool definitions to this format.
4540
- */
4541
- declare type LanguageModelV2FunctionTool_2 = {
4542
- /**
4543
- The type of the tool (always 'function').
4544
- */
4545
- type: 'function';
4546
- /**
4547
- The name of the tool. Unique within this model call.
4548
- */
4549
- name: string;
4550
- /**
4551
- A description of the tool. The language model uses this to understand the
4552
- tool's purpose and to provide better completion suggestions.
4553
- */
4554
- description?: string;
4555
- /**
4556
- The parameters that the tool expects. The language model uses this to
4557
- understand the tool's input requirements and to provide matching suggestions.
4558
- */
4559
- inputSchema: JSONSchema7;
4560
- /**
4561
- The provider-specific options for the tool.
4562
- */
4563
- providerOptions?: SharedV2ProviderOptions_2;
4564
- };
4565
-
4566
4058
  declare type LanguageModelV2Message = ({
4567
4059
  role: 'system';
4568
4060
  content: string;
@@ -4584,27 +4076,6 @@ declare type LanguageModelV2Message = ({
4584
4076
  providerOptions?: SharedV2ProviderOptions;
4585
4077
  };
4586
4078
 
4587
- declare type LanguageModelV2Message_2 = ({
4588
- role: 'system';
4589
- content: string;
4590
- } | {
4591
- role: 'user';
4592
- content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2>;
4593
- } | {
4594
- role: 'assistant';
4595
- content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2 | LanguageModelV2ReasoningPart_2 | LanguageModelV2ToolCallPart_2 | LanguageModelV2ToolResultPart_2>;
4596
- } | {
4597
- role: 'tool';
4598
- content: Array<LanguageModelV2ToolResultPart_2>;
4599
- }) & {
4600
- /**
4601
- * Additional provider-specific options. They are passed through
4602
- * to the provider from the AI SDK and enable provider-specific
4603
- * functionality that can be fully encapsulated in the provider.
4604
- */
4605
- providerOptions?: SharedV2ProviderOptions_2;
4606
- };
4607
-
4608
4079
  /**
4609
4080
  * Experimental middleware for LanguageModelV2.
4610
4081
  * This type defines the structure for middleware that can be used to modify
@@ -4620,21 +4091,21 @@ declare type LanguageModelV2Middleware = {
4620
4091
  * @param options.model - The language model instance.
4621
4092
  */
4622
4093
  overrideProvider?: (options: {
4623
- model: LanguageModelV2_2;
4094
+ model: LanguageModelV2;
4624
4095
  }) => string;
4625
4096
  /**
4626
4097
  * Override the model ID if desired.
4627
4098
  * @param options.model - The language model instance.
4628
4099
  */
4629
4100
  overrideModelId?: (options: {
4630
- model: LanguageModelV2_2;
4101
+ model: LanguageModelV2;
4631
4102
  }) => string;
4632
4103
  /**
4633
4104
  * Override the supported URLs if desired.
4634
4105
  * @param options.model - The language model instance.
4635
4106
  */
4636
4107
  overrideSupportedUrls?: (options: {
4637
- model: LanguageModelV2_2;
4108
+ model: LanguageModelV2;
4638
4109
  }) => PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
4639
4110
  /**
4640
4111
  * Transforms the parameters before they are passed to the language model.
@@ -4645,9 +4116,9 @@ declare type LanguageModelV2Middleware = {
4645
4116
  */
4646
4117
  transformParams?: (options: {
4647
4118
  type: 'generate' | 'stream';
4648
- params: LanguageModelV2CallOptions_2;
4649
- model: LanguageModelV2_2;
4650
- }) => PromiseLike<LanguageModelV2CallOptions_2>;
4119
+ params: LanguageModelV2CallOptions;
4120
+ model: LanguageModelV2;
4121
+ }) => PromiseLike<LanguageModelV2CallOptions>;
4651
4122
  /**
4652
4123
  * Wraps the generate operation of the language model.
4653
4124
  * @param options - Object containing the generate function, parameters, and model.
@@ -4659,11 +4130,11 @@ declare type LanguageModelV2Middleware = {
4659
4130
  * @returns A promise that resolves to the result of the generate operation.
4660
4131
  */
4661
4132
  wrapGenerate?: (options: {
4662
- doGenerate: () => ReturnType<LanguageModelV2_2['doGenerate']>;
4663
- doStream: () => ReturnType<LanguageModelV2_2['doStream']>;
4664
- params: LanguageModelV2CallOptions_2;
4665
- model: LanguageModelV2_2;
4666
- }) => Promise<Awaited<ReturnType<LanguageModelV2_2['doGenerate']>>>;
4133
+ doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
4134
+ doStream: () => ReturnType<LanguageModelV2['doStream']>;
4135
+ params: LanguageModelV2CallOptions;
4136
+ model: LanguageModelV2;
4137
+ }) => Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
4667
4138
  /**
4668
4139
  * Wraps the stream operation of the language model.
4669
4140
  *
@@ -4676,11 +4147,11 @@ declare type LanguageModelV2Middleware = {
4676
4147
  * @returns A promise that resolves to the result of the stream operation.
4677
4148
  */
4678
4149
  wrapStream?: (options: {
4679
- doGenerate: () => ReturnType<LanguageModelV2_2['doGenerate']>;
4680
- doStream: () => ReturnType<LanguageModelV2_2['doStream']>;
4681
- params: LanguageModelV2CallOptions_2;
4682
- model: LanguageModelV2_2;
4683
- }) => PromiseLike<Awaited<ReturnType<LanguageModelV2_2['doStream']>>>;
4150
+ doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
4151
+ doStream: () => ReturnType<LanguageModelV2['doStream']>;
4152
+ params: LanguageModelV2CallOptions;
4153
+ model: LanguageModelV2;
4154
+ }) => PromiseLike<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
4684
4155
  };
4685
4156
 
4686
4157
  /**
@@ -4694,17 +4165,6 @@ declare type LanguageModelV2Middleware = {
4694
4165
  */
4695
4166
  declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
4696
4167
 
4697
- /**
4698
- A prompt is a list of messages.
4699
-
4700
- Note: Not all models and prompt formats support multi-modal inputs and
4701
- tool calls. The validation happens at runtime.
4702
-
4703
- Note: This is not a user-facing prompt. The AI SDK methods will map the
4704
- user-facing prompt types such as chat or instruction prompts to this format.
4705
- */
4706
- declare type LanguageModelV2Prompt_2 = Array<LanguageModelV2Message_2>;
4707
-
4708
4168
  /**
4709
4169
  The configuration of a tool that is defined by the provider.
4710
4170
  */
@@ -4727,28 +4187,6 @@ declare type LanguageModelV2ProviderDefinedTool = {
4727
4187
  args: Record<string, unknown>;
4728
4188
  };
4729
4189
 
4730
- /**
4731
- The configuration of a tool that is defined by the provider.
4732
- */
4733
- declare type LanguageModelV2ProviderDefinedTool_2 = {
4734
- /**
4735
- The type of the tool (always 'provider-defined').
4736
- */
4737
- type: 'provider-defined';
4738
- /**
4739
- The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`.
4740
- */
4741
- id: `${string}.${string}`;
4742
- /**
4743
- The name of the tool that the user must use in the tool set.
4744
- */
4745
- name: string;
4746
- /**
4747
- The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
4748
- */
4749
- args: Record<string, unknown>;
4750
- };
4751
-
4752
4190
  /**
4753
4191
  Reasoning that the model has generated.
4754
4192
  */
@@ -4761,18 +4199,6 @@ declare type LanguageModelV2Reasoning = {
4761
4199
  providerMetadata?: SharedV2ProviderMetadata;
4762
4200
  };
4763
4201
 
4764
- /**
4765
- Reasoning that the model has generated.
4766
- */
4767
- declare type LanguageModelV2Reasoning_2 = {
4768
- type: 'reasoning';
4769
- text: string;
4770
- /**
4771
- * Optional provider-specific metadata for the reasoning part.
4772
- */
4773
- providerMetadata?: SharedV2ProviderMetadata_2;
4774
- };
4775
-
4776
4202
  /**
4777
4203
  Reasoning content part of a prompt. It contains a string of reasoning text.
4778
4204
  */
@@ -4781,119 +4207,34 @@ declare interface LanguageModelV2ReasoningPart {
4781
4207
  /**
4782
4208
  The reasoning text.
4783
4209
  */
4784
- text: string;
4785
- /**
4786
- * Additional provider-specific options. They are passed through
4787
- * to the provider from the AI SDK and enable provider-specific
4788
- * functionality that can be fully encapsulated in the provider.
4789
- */
4790
- providerOptions?: SharedV2ProviderOptions;
4791
- }
4792
-
4793
- /**
4794
- Reasoning content part of a prompt. It contains a string of reasoning text.
4795
- */
4796
- declare interface LanguageModelV2ReasoningPart_2 {
4797
- type: 'reasoning';
4798
- /**
4799
- The reasoning text.
4800
- */
4801
- text: string;
4802
- /**
4803
- * Additional provider-specific options. They are passed through
4804
- * to the provider from the AI SDK and enable provider-specific
4805
- * functionality that can be fully encapsulated in the provider.
4806
- */
4807
- providerOptions?: SharedV2ProviderOptions_2;
4808
- }
4809
-
4810
- declare interface LanguageModelV2ResponseMetadata {
4811
- /**
4812
- ID for the generated response, if the provider sends one.
4813
- */
4814
- id?: string;
4815
- /**
4816
- Timestamp for the start of the generated response, if the provider sends one.
4817
- */
4818
- timestamp?: Date;
4819
- /**
4820
- The ID of the response model that was used to generate the response, if the provider sends one.
4821
- */
4822
- modelId?: string;
4823
- }
4824
-
4825
- declare interface LanguageModelV2ResponseMetadata_2 {
4826
- /**
4827
- ID for the generated response, if the provider sends one.
4828
- */
4829
- id?: string;
4830
- /**
4831
- Timestamp for the start of the generated response, if the provider sends one.
4832
- */
4833
- timestamp?: Date;
4834
- /**
4835
- The ID of the response model that was used to generate the response, if the provider sends one.
4836
- */
4837
- modelId?: string;
4838
- }
4839
-
4840
- /**
4841
- A source that has been used as input to generate the response.
4842
- */
4843
- declare type LanguageModelV2Source = {
4844
- type: 'source';
4845
- /**
4846
- * The type of source - URL sources reference web content.
4847
- */
4848
- sourceType: 'url';
4849
- /**
4850
- * The ID of the source.
4851
- */
4852
- id: string;
4853
- /**
4854
- * The URL of the source.
4855
- */
4856
- url: string;
4857
- /**
4858
- * The title of the source.
4859
- */
4860
- title?: string;
4861
- /**
4862
- * Additional provider metadata for the source.
4863
- */
4864
- providerMetadata?: SharedV2ProviderMetadata;
4865
- } | {
4866
- type: 'source';
4867
- /**
4868
- * The type of source - document sources reference files/documents.
4869
- */
4870
- sourceType: 'document';
4871
- /**
4872
- * The ID of the source.
4873
- */
4874
- id: string;
4210
+ text: string;
4875
4211
  /**
4876
- * IANA media type of the document (e.g., 'application/pdf').
4212
+ * Additional provider-specific options. They are passed through
4213
+ * to the provider from the AI SDK and enable provider-specific
4214
+ * functionality that can be fully encapsulated in the provider.
4877
4215
  */
4878
- mediaType: string;
4216
+ providerOptions?: SharedV2ProviderOptions;
4217
+ }
4218
+
4219
+ declare interface LanguageModelV2ResponseMetadata {
4879
4220
  /**
4880
- * The title of the document.
4221
+ ID for the generated response, if the provider sends one.
4881
4222
  */
4882
- title: string;
4223
+ id?: string;
4883
4224
  /**
4884
- * Optional filename of the document.
4225
+ Timestamp for the start of the generated response, if the provider sends one.
4885
4226
  */
4886
- filename?: string;
4227
+ timestamp?: Date;
4887
4228
  /**
4888
- * Additional provider metadata for the source.
4229
+ The ID of the response model that was used to generate the response, if the provider sends one.
4889
4230
  */
4890
- providerMetadata?: SharedV2ProviderMetadata;
4891
- };
4231
+ modelId?: string;
4232
+ }
4892
4233
 
4893
4234
  /**
4894
4235
  A source that has been used as input to generate the response.
4895
4236
  */
4896
- declare type LanguageModelV2Source_2 = {
4237
+ declare type LanguageModelV2Source = {
4897
4238
  type: 'source';
4898
4239
  /**
4899
4240
  * The type of source - URL sources reference web content.
@@ -4914,7 +4255,7 @@ declare type LanguageModelV2Source_2 = {
4914
4255
  /**
4915
4256
  * Additional provider metadata for the source.
4916
4257
  */
4917
- providerMetadata?: SharedV2ProviderMetadata_2;
4258
+ providerMetadata?: SharedV2ProviderMetadata;
4918
4259
  } | {
4919
4260
  type: 'source';
4920
4261
  /**
@@ -4940,7 +4281,7 @@ declare type LanguageModelV2Source_2 = {
4940
4281
  /**
4941
4282
  * Additional provider metadata for the source.
4942
4283
  */
4943
- providerMetadata?: SharedV2ProviderMetadata_2;
4284
+ providerMetadata?: SharedV2ProviderMetadata;
4944
4285
  };
4945
4286
 
4946
4287
  declare type LanguageModelV2StreamPart = {
@@ -5002,65 +4343,6 @@ declare type LanguageModelV2StreamPart = {
5002
4343
  error: unknown;
5003
4344
  };
5004
4345
 
5005
- declare type LanguageModelV2StreamPart_2 = {
5006
- type: 'text-start';
5007
- providerMetadata?: SharedV2ProviderMetadata_2;
5008
- id: string;
5009
- } | {
5010
- type: 'text-delta';
5011
- id: string;
5012
- providerMetadata?: SharedV2ProviderMetadata_2;
5013
- delta: string;
5014
- } | {
5015
- type: 'text-end';
5016
- providerMetadata?: SharedV2ProviderMetadata_2;
5017
- id: string;
5018
- } | {
5019
- type: 'reasoning-start';
5020
- providerMetadata?: SharedV2ProviderMetadata_2;
5021
- id: string;
5022
- } | {
5023
- type: 'reasoning-delta';
5024
- id: string;
5025
- providerMetadata?: SharedV2ProviderMetadata_2;
5026
- delta: string;
5027
- } | {
5028
- type: 'reasoning-end';
5029
- id: string;
5030
- providerMetadata?: SharedV2ProviderMetadata_2;
5031
- } | {
5032
- type: 'tool-input-start';
5033
- id: string;
5034
- toolName: string;
5035
- providerMetadata?: SharedV2ProviderMetadata_2;
5036
- providerExecuted?: boolean;
5037
- } | {
5038
- type: 'tool-input-delta';
5039
- id: string;
5040
- delta: string;
5041
- providerMetadata?: SharedV2ProviderMetadata_2;
5042
- } | {
5043
- type: 'tool-input-end';
5044
- id: string;
5045
- providerMetadata?: SharedV2ProviderMetadata_2;
5046
- } | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | {
5047
- type: 'stream-start';
5048
- warnings: Array<LanguageModelV2CallWarning_2>;
5049
- } | ({
5050
- type: 'response-metadata';
5051
- } & LanguageModelV2ResponseMetadata_2) | {
5052
- type: 'finish';
5053
- usage: LanguageModelV2Usage_2;
5054
- finishReason: LanguageModelV2FinishReason_2;
5055
- providerMetadata?: SharedV2ProviderMetadata_2;
5056
- } | {
5057
- type: 'raw';
5058
- rawValue: unknown;
5059
- } | {
5060
- type: 'error';
5061
- error: unknown;
5062
- };
5063
-
5064
4346
  /**
5065
4347
  Text that the model has generated.
5066
4348
  */
@@ -5073,18 +4355,6 @@ declare type LanguageModelV2Text = {
5073
4355
  providerMetadata?: SharedV2ProviderMetadata;
5074
4356
  };
5075
4357
 
5076
- /**
5077
- Text that the model has generated.
5078
- */
5079
- declare type LanguageModelV2Text_2 = {
5080
- type: 'text';
5081
- /**
5082
- The text content.
5083
- */
5084
- text: string;
5085
- providerMetadata?: SharedV2ProviderMetadata_2;
5086
- };
5087
-
5088
4358
  /**
5089
4359
  Text content part of a prompt. It contains a string of text.
5090
4360
  */
@@ -5102,23 +4372,6 @@ declare interface LanguageModelV2TextPart {
5102
4372
  providerOptions?: SharedV2ProviderOptions;
5103
4373
  }
5104
4374
 
5105
- /**
5106
- Text content part of a prompt. It contains a string of text.
5107
- */
5108
- declare interface LanguageModelV2TextPart_2 {
5109
- type: 'text';
5110
- /**
5111
- The text content.
5112
- */
5113
- text: string;
5114
- /**
5115
- * Additional provider-specific options. They are passed through
5116
- * to the provider from the AI SDK and enable provider-specific
5117
- * functionality that can be fully encapsulated in the provider.
5118
- */
5119
- providerOptions?: SharedV2ProviderOptions_2;
5120
- }
5121
-
5122
4375
  /**
5123
4376
  * Tool calls that the model has generated.
5124
4377
  */
@@ -5148,29 +4401,6 @@ declare type LanguageModelV2ToolCall = {
5148
4401
  providerMetadata?: SharedV2ProviderMetadata;
5149
4402
  };
5150
4403
 
5151
- /**
5152
- Tool calls that the model has generated.
5153
- */
5154
- declare type LanguageModelV2ToolCall_2 = {
5155
- type: 'tool-call';
5156
- toolCallId: string;
5157
- toolName: string;
5158
- /**
5159
- Stringified JSON object with the tool call arguments. Must match the
5160
- parameters schema of the tool.
5161
- */
5162
- input: string;
5163
- /**
5164
- * Whether the tool call will be executed by the provider.
5165
- * If this flag is not set or is false, the tool call will be executed by the client.
5166
- */
5167
- providerExecuted?: boolean;
5168
- /**
5169
- * Additional provider-specific metadata for the tool call.
5170
- */
5171
- providerMetadata?: SharedV2ProviderMetadata_2;
5172
- };
5173
-
5174
4404
  /**
5175
4405
  Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
5176
4406
  */
@@ -5201,36 +4431,6 @@ declare interface LanguageModelV2ToolCallPart {
5201
4431
  providerOptions?: SharedV2ProviderOptions;
5202
4432
  }
5203
4433
 
5204
- /**
5205
- Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
5206
- */
5207
- declare interface LanguageModelV2ToolCallPart_2 {
5208
- type: 'tool-call';
5209
- /**
5210
- ID of the tool call. This ID is used to match the tool call with the tool result.
5211
- */
5212
- toolCallId: string;
5213
- /**
5214
- Name of the tool that is being called.
5215
- */
5216
- toolName: string;
5217
- /**
5218
- Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
5219
- */
5220
- input: unknown;
5221
- /**
5222
- * Whether the tool call will be executed by the provider.
5223
- * If this flag is not set or is false, the tool call will be executed by the client.
5224
- */
5225
- providerExecuted?: boolean;
5226
- /**
5227
- * Additional provider-specific options. They are passed through
5228
- * to the provider from the AI SDK and enable provider-specific
5229
- * functionality that can be fully encapsulated in the provider.
5230
- */
5231
- providerOptions?: SharedV2ProviderOptions_2;
5232
- }
5233
-
5234
4434
  declare type LanguageModelV2ToolChoice = {
5235
4435
  type: 'auto';
5236
4436
  } | {
@@ -5242,17 +4442,6 @@ declare type LanguageModelV2ToolChoice = {
5242
4442
  toolName: string;
5243
4443
  };
5244
4444
 
5245
- declare type LanguageModelV2ToolChoice_2 = {
5246
- type: 'auto';
5247
- } | {
5248
- type: 'none';
5249
- } | {
5250
- type: 'required';
5251
- } | {
5252
- type: 'tool';
5253
- toolName: string;
5254
- };
5255
-
5256
4445
  /**
5257
4446
  Result of a tool call that has been executed by the provider.
5258
4447
  */
@@ -5286,39 +4475,6 @@ declare type LanguageModelV2ToolResult = {
5286
4475
  providerMetadata?: SharedV2ProviderMetadata;
5287
4476
  };
5288
4477
 
5289
- /**
5290
- Result of a tool call that has been executed by the provider.
5291
- */
5292
- declare type LanguageModelV2ToolResult_2 = {
5293
- type: 'tool-result';
5294
- /**
5295
- * The ID of the tool call that this result is associated with.
5296
- */
5297
- toolCallId: string;
5298
- /**
5299
- * Name of the tool that generated this result.
5300
- */
5301
- toolName: string;
5302
- /**
5303
- * Result of the tool call. This is a JSON-serializable object.
5304
- */
5305
- result: unknown;
5306
- /**
5307
- * Optional flag if the result is an error or an error message.
5308
- */
5309
- isError?: boolean;
5310
- /**
5311
- * Whether the tool result was generated by the provider.
5312
- * If this flag is set to true, the tool result was generated by the provider.
5313
- * If this flag is not set or is false, the tool result was generated by the client.
5314
- */
5315
- providerExecuted?: boolean;
5316
- /**
5317
- * Additional provider-specific metadata for the tool result.
5318
- */
5319
- providerMetadata?: SharedV2ProviderMetadata_2;
5320
- };
5321
-
5322
4478
  declare type LanguageModelV2ToolResultOutput = {
5323
4479
  type: 'text';
5324
4480
  value: string;
@@ -5334,88 +4490,29 @@ declare type LanguageModelV2ToolResultOutput = {
5334
4490
  } | {
5335
4491
  type: 'content';
5336
4492
  value: Array<{
5337
- type: 'text';
5338
- /**
5339
- Text content.
5340
- */
5341
- text: string;
5342
- } | {
5343
- type: 'media';
5344
- /**
5345
- Base-64 encoded media data.
5346
- */
5347
- data: string;
5348
- /**
5349
- IANA media type.
5350
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
5351
- */
5352
- mediaType: string;
5353
- }>;
5354
- };
5355
-
5356
- declare type LanguageModelV2ToolResultOutput_2 = {
5357
- type: 'text';
5358
- value: string;
5359
- } | {
5360
- type: 'json';
5361
- value: JSONValue_3;
5362
- } | {
5363
- type: 'error-text';
5364
- value: string;
5365
- } | {
5366
- type: 'error-json';
5367
- value: JSONValue_3;
5368
- } | {
5369
- type: 'content';
5370
- value: Array<{
5371
- type: 'text';
5372
- /**
5373
- Text content.
5374
- */
5375
- text: string;
5376
- } | {
5377
- type: 'media';
5378
- /**
5379
- Base-64 encoded media data.
5380
- */
5381
- data: string;
5382
- /**
5383
- IANA media type.
5384
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
5385
- */
5386
- mediaType: string;
5387
- }>;
5388
- };
5389
-
5390
- /**
5391
- Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
5392
- */
5393
- declare interface LanguageModelV2ToolResultPart {
5394
- type: 'tool-result';
5395
- /**
5396
- ID of the tool call that this result is associated with.
5397
- */
5398
- toolCallId: string;
5399
- /**
5400
- Name of the tool that generated this result.
5401
- */
5402
- toolName: string;
5403
- /**
5404
- Result of the tool call.
5405
- */
5406
- output: LanguageModelV2ToolResultOutput;
5407
- /**
5408
- * Additional provider-specific options. They are passed through
5409
- * to the provider from the AI SDK and enable provider-specific
5410
- * functionality that can be fully encapsulated in the provider.
5411
- */
5412
- providerOptions?: SharedV2ProviderOptions;
5413
- }
4493
+ type: 'text';
4494
+ /**
4495
+ Text content.
4496
+ */
4497
+ text: string;
4498
+ } | {
4499
+ type: 'media';
4500
+ /**
4501
+ Base-64 encoded media data.
4502
+ */
4503
+ data: string;
4504
+ /**
4505
+ IANA media type.
4506
+ @see https://www.iana.org/assignments/media-types/media-types.xhtml
4507
+ */
4508
+ mediaType: string;
4509
+ }>;
4510
+ };
5414
4511
 
5415
4512
  /**
5416
4513
  Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
5417
4514
  */
5418
- declare interface LanguageModelV2ToolResultPart_2 {
4515
+ declare interface LanguageModelV2ToolResultPart {
5419
4516
  type: 'tool-result';
5420
4517
  /**
5421
4518
  ID of the tool call that this result is associated with.
@@ -5428,13 +4525,13 @@ declare interface LanguageModelV2ToolResultPart_2 {
5428
4525
  /**
5429
4526
  Result of the tool call.
5430
4527
  */
5431
- output: LanguageModelV2ToolResultOutput_2;
4528
+ output: LanguageModelV2ToolResultOutput;
5432
4529
  /**
5433
4530
  * Additional provider-specific options. They are passed through
5434
4531
  * to the provider from the AI SDK and enable provider-specific
5435
4532
  * functionality that can be fully encapsulated in the provider.
5436
4533
  */
5437
- providerOptions?: SharedV2ProviderOptions_2;
4534
+ providerOptions?: SharedV2ProviderOptions;
5438
4535
  }
5439
4536
 
5440
4537
  /**
@@ -5468,37 +4565,6 @@ declare type LanguageModelV2Usage = {
5468
4565
  cachedInputTokens?: number | undefined;
5469
4566
  };
5470
4567
 
5471
- /**
5472
- Usage information for a language model call.
5473
-
5474
- If your API return additional usage information, you can add it to the
5475
- provider metadata under your provider's key.
5476
- */
5477
- declare type LanguageModelV2Usage_2 = {
5478
- /**
5479
- The number of input (prompt) tokens used.
5480
- */
5481
- inputTokens: number | undefined;
5482
- /**
5483
- The number of output (completion) tokens used.
5484
- */
5485
- outputTokens: number | undefined;
5486
- /**
5487
- The total number of tokens as reported by the provider.
5488
- This number might be different from the sum of `inputTokens` and `outputTokens`
5489
- and e.g. include reasoning tokens or other overhead.
5490
- */
5491
- totalTokens: number | undefined;
5492
- /**
5493
- The number of reasoning tokens used.
5494
- */
5495
- reasoningTokens?: number | undefined;
5496
- /**
5497
- The number of cached input tokens.
5498
- */
5499
- cachedInputTokens?: number | undefined;
5500
- };
5501
-
5502
4568
  /**
5503
4569
  Check if the message is an assistant message with completed tool calls.
5504
4570
  The last step of the message must have at least one tool invocation and
@@ -5546,6 +4612,8 @@ declare function lazyValidator<OBJECT>(createValidator: () => Validator<OBJECT>)
5546
4612
  * However, it is desirable to associate incoming SpanContext to new trace
5547
4613
  * initiated on service provider side so two traces (from Client and from
5548
4614
  * Service Provider) can be correlated.
4615
+ *
4616
+ * @since 1.0.0
5549
4617
  */
5550
4618
  declare interface Link {
5551
4619
  /** The {@link SpanContext} of a linked span. */
@@ -5725,7 +4793,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
5725
4793
  Thrown when no output type is specified and output-related methods are called.
5726
4794
  */
5727
4795
  export declare class NoOutputSpecifiedError extends AISDKError {
5728
- private readonly [symbol$7_3];
4796
+ private readonly [symbol$7_2];
5729
4797
  constructor({ message }?: {
5730
4798
  message?: string;
5731
4799
  });
@@ -5765,7 +4833,7 @@ export declare class NoSuchModelError extends AISDKError {
5765
4833
  }
5766
4834
 
5767
4835
  export declare class NoSuchProviderError extends NoSuchModelError {
5768
- private readonly [symbol_2];
4836
+ private readonly [symbol_3];
5769
4837
  readonly providerId: string;
5770
4838
  readonly availableProviders: string[];
5771
4839
  constructor({ modelId, modelType, providerId, availableProviders, message, }: {
@@ -5779,7 +4847,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
5779
4847
  }
5780
4848
 
5781
4849
  export declare class NoSuchToolError extends AISDKError {
5782
- private readonly [symbol$d_3];
4850
+ private readonly [symbol$d_2];
5783
4851
  readonly toolName: string;
5784
4852
  readonly availableTools: string[] | undefined;
5785
4853
  constructor({ toolName, availableTools, message, }: {
@@ -5817,7 +4885,7 @@ export declare namespace Output {
5817
4885
 
5818
4886
  declare interface Output_2<OUTPUT, PARTIAL> {
5819
4887
  readonly type: 'object' | 'text';
5820
- responseFormat: LanguageModelV2CallOptions_2['responseFormat'];
4888
+ responseFormat: LanguageModelV2CallOptions['responseFormat'];
5821
4889
  parsePartial(options: {
5822
4890
  text: string;
5823
4891
  }): Promise<{
@@ -6007,7 +5075,7 @@ export declare function parseJsonEventStream<T>({ stream, schema, }: {
6007
5075
  }): ReadableStream<ParseResult<T>>;
6008
5076
 
6009
5077
  export declare function parsePartialJson(jsonText: string | undefined): Promise<{
6010
- value: JSONValue_3 | undefined;
5078
+ value: JSONValue_2 | undefined;
6011
5079
  state: 'undefined-input' | 'successful-parse' | 'repaired-parse' | 'failed-parse';
6012
5080
  }>;
6013
5081
 
@@ -6023,7 +5091,7 @@ declare type ParseResult<T> = {
6023
5091
  rawValue: unknown;
6024
5092
  } | {
6025
5093
  success: false;
6026
- error: JSONParseError_2 | TypeValidationError_2;
5094
+ error: JSONParseError | TypeValidationError;
6027
5095
  rawValue: unknown;
6028
5096
  };
6029
5097
 
@@ -6187,7 +5255,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
6187
5255
  url: string;
6188
5256
  headers?: Record<string, string | undefined>;
6189
5257
  formData: FormData;
6190
- failedResponseHandler: ResponseHandler<APICallError_2>;
5258
+ failedResponseHandler: ResponseHandler<APICallError>;
6191
5259
  successfulResponseHandler: ResponseHandler<T>;
6192
5260
  abortSignal?: AbortSignal;
6193
5261
  fetch?: FetchFunction;
@@ -6201,7 +5269,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
6201
5269
  url: string;
6202
5270
  headers?: Record<string, string | undefined>;
6203
5271
  body: unknown;
6204
- failedResponseHandler: ResponseHandler<APICallError_2>;
5272
+ failedResponseHandler: ResponseHandler<APICallError>;
6205
5273
  successfulResponseHandler: ResponseHandler<T>;
6206
5274
  abortSignal?: AbortSignal;
6207
5275
  fetch?: FetchFunction;
@@ -6390,7 +5458,7 @@ declare type ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS exte
6390
5458
  This is needed to enable provider-specific functionality that can be
6391
5459
  fully encapsulated in the provider.
6392
5460
  */
6393
- export declare type ProviderMetadata = SharedV2ProviderMetadata_2;
5461
+ export declare type ProviderMetadata = SharedV2ProviderMetadata;
6394
5462
 
6395
5463
  /**
6396
5464
  Additional provider-specific options.
@@ -6400,17 +5468,17 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata_2;
6400
5468
  */
6401
5469
  declare type ProviderOptions = SharedV2ProviderOptions;
6402
5470
 
6403
- export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2_2> = Record<string, ProviderV2_2>, SEPARATOR extends string = ':'> {
6404
- languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2_2;
6405
- languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): LanguageModelV2_2;
6406
- textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never): EmbeddingModelV2_2<string>;
6407
- textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): EmbeddingModelV2_2<string>;
6408
- imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never): ImageModelV2_2;
6409
- imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): ImageModelV2_2;
6410
- transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never): TranscriptionModelV2_2;
6411
- transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): TranscriptionModelV2_2;
6412
- speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never): SpeechModelV2_2;
6413
- speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): SpeechModelV2_2;
5471
+ export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
5472
+ languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
5473
+ languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): LanguageModelV2;
5474
+ textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never): EmbeddingModelV2<string>;
5475
+ textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): EmbeddingModelV2<string>;
5476
+ imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never): ImageModelV2;
5477
+ imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): ImageModelV2;
5478
+ transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never): TranscriptionModelV2;
5479
+ transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): TranscriptionModelV2;
5480
+ speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never): SpeechModelV2;
5481
+ speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): SpeechModelV2;
6414
5482
  }
6415
5483
 
6416
5484
  /**
@@ -6468,61 +5536,6 @@ declare interface ProviderV2 {
6468
5536
  speechModel?(modelId: string): SpeechModelV2;
6469
5537
  }
6470
5538
 
6471
- /**
6472
- * Provider for language, text embedding, and image generation models.
6473
- */
6474
- declare interface ProviderV2_2 {
6475
- /**
6476
- Returns the language model with the given id.
6477
- The model id is then passed to the provider function to get the model.
6478
-
6479
- @param {string} modelId - The id of the model to return.
6480
-
6481
- @returns {LanguageModel} The language model associated with the id
6482
-
6483
- @throws {NoSuchModelError} If no such model exists.
6484
- */
6485
- languageModel(modelId: string): LanguageModelV2_2;
6486
- /**
6487
- Returns the text embedding model with the given id.
6488
- The model id is then passed to the provider function to get the model.
6489
-
6490
- @param {string} modelId - The id of the model to return.
6491
-
6492
- @returns {LanguageModel} The language model associated with the id
6493
-
6494
- @throws {NoSuchModelError} If no such model exists.
6495
- */
6496
- textEmbeddingModel(modelId: string): EmbeddingModelV2_2<string>;
6497
- /**
6498
- Returns the image model with the given id.
6499
- The model id is then passed to the provider function to get the model.
6500
-
6501
- @param {string} modelId - The id of the model to return.
6502
-
6503
- @returns {ImageModel} The image model associated with the id
6504
- */
6505
- imageModel(modelId: string): ImageModelV2_2;
6506
- /**
6507
- Returns the transcription model with the given id.
6508
- The model id is then passed to the provider function to get the model.
6509
-
6510
- @param {string} modelId - The id of the model to return.
6511
-
6512
- @returns {TranscriptionModel} The transcription model associated with the id
6513
- */
6514
- transcriptionModel?(modelId: string): TranscriptionModelV2_2;
6515
- /**
6516
- Returns the speech model with the given id.
6517
- The model id is then passed to the provider function to get the model.
6518
-
6519
- @param {string} modelId - The id of the model to return.
6520
-
6521
- @returns {SpeechModel} The speech model associated with the id
6522
- */
6523
- speechModel?(modelId: string): SpeechModelV2_2;
6524
- }
6525
-
6526
5539
  /**
6527
5540
  * Prunes model messages from a list of model messages.
6528
5541
  *
@@ -6543,6 +5556,25 @@ export declare function pruneMessages({ messages, reasoning, toolCalls, emptyMes
6543
5556
  emptyMessages?: 'keep' | 'remove';
6544
5557
  }): ModelMessage[];
6545
5558
 
5559
+ /**
5560
+ * Reads a fetch Response body with a size limit to prevent memory exhaustion.
5561
+ *
5562
+ * Checks the Content-Length header for early rejection, then reads the body
5563
+ * incrementally via ReadableStream and aborts with a DownloadError when the
5564
+ * limit is exceeded.
5565
+ *
5566
+ * @param response - The fetch Response to read.
5567
+ * @param url - The URL being downloaded (used in error messages).
5568
+ * @param maxBytes - Maximum allowed bytes. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.
5569
+ * @returns A Uint8Array containing the response body.
5570
+ * @throws DownloadError if the response exceeds maxBytes.
5571
+ */
5572
+ declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
5573
+ response: Response;
5574
+ url: string;
5575
+ maxBytes?: number;
5576
+ }): Promise<Uint8Array>;
5577
+
6546
5578
  /**
6547
5579
  * Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
6548
5580
  *
@@ -6657,7 +5689,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
6657
5689
  declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
6658
5690
 
6659
5691
  export declare class RetryError extends AISDKError {
6660
- private readonly [symbol$1_3];
5692
+ private readonly [symbol$1_2];
6661
5693
  readonly reason: RetryErrorReason;
6662
5694
  readonly lastError: unknown;
6663
5695
  readonly errors: Array<unknown>;
@@ -6713,7 +5745,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
6713
5745
  rawValue: unknown;
6714
5746
  } | {
6715
5747
  success: false;
6716
- error: TypeValidationError_2;
5748
+ error: TypeValidationError;
6717
5749
  rawValue: unknown;
6718
5750
  }>;
6719
5751
 
@@ -6770,8 +5802,6 @@ export declare class SerialJobExecutor {
6770
5802
 
6771
5803
  declare type SharedV2Headers = Record<string, string>;
6772
5804
 
6773
- declare type SharedV2Headers_2 = Record<string, string>;
6774
-
6775
5805
  /**
6776
5806
  * Additional provider-specific metadata.
6777
5807
  * Metadata are additional outputs from the provider.
@@ -6795,29 +5825,6 @@ declare type SharedV2Headers_2 = Record<string, string>;
6795
5825
  */
6796
5826
  declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
6797
5827
 
6798
- /**
6799
- * Additional provider-specific metadata.
6800
- * Metadata are additional outputs from the provider.
6801
- * They are passed through to the provider from the AI SDK
6802
- * and enable provider-specific functionality
6803
- * that can be fully encapsulated in the provider.
6804
- *
6805
- * This enables us to quickly ship provider-specific functionality
6806
- * without affecting the core AI SDK.
6807
- *
6808
- * The outer record is keyed by the provider name, and the inner
6809
- * record is keyed by the provider-specific metadata key.
6810
- *
6811
- * ```ts
6812
- * {
6813
- * "anthropic": {
6814
- * "cacheControl": { "type": "ephemeral" }
6815
- * }
6816
- * }
6817
- * ```
6818
- */
6819
- declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValue_3>>;
6820
-
6821
5828
  /**
6822
5829
  * Additional provider-specific options.
6823
5830
  * Options are additional input to the provider.
@@ -6841,29 +5848,6 @@ declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValu
6841
5848
  */
6842
5849
  declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
6843
5850
 
6844
- /**
6845
- * Additional provider-specific options.
6846
- * Options are additional input to the provider.
6847
- * They are passed through to the provider from the AI SDK
6848
- * and enable provider-specific functionality
6849
- * that can be fully encapsulated in the provider.
6850
- *
6851
- * This enables us to quickly ship provider-specific functionality
6852
- * without affecting the core AI SDK.
6853
- *
6854
- * The outer record is keyed by the provider name, and the inner
6855
- * record is keyed by the provider-specific metadata key.
6856
- *
6857
- * ```ts
6858
- * {
6859
- * "anthropic": {
6860
- * "cacheControl": { "type": "ephemeral" }
6861
- * }
6862
- * }
6863
- * ```
6864
- */
6865
- declare type SharedV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
6866
-
6867
5851
  /**
6868
5852
  * Creates a ReadableStream that emits the provided values with an optional delay between each value.
6869
5853
  *
@@ -6943,7 +5927,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
6943
5927
  file: GeneratedFile;
6944
5928
  } | {
6945
5929
  type: 'stream-start';
6946
- warnings: LanguageModelV2CallWarning_2[];
5930
+ warnings: LanguageModelV2CallWarning[];
6947
5931
  } | {
6948
5932
  type: 'response-metadata';
6949
5933
  id?: string;
@@ -6986,7 +5970,7 @@ export declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunkin
6986
5970
  /**
6987
5971
  A source that has been used as input to generate the response.
6988
5972
  */
6989
- declare type Source = LanguageModelV2Source_2;
5973
+ declare type Source = LanguageModelV2Source;
6990
5974
 
6991
5975
  /**
6992
5976
  * A document source part of a message.
@@ -7019,6 +6003,8 @@ export declare type SourceUrlUIPart = {
7019
6003
  * may have children.
7020
6004
  *
7021
6005
  * Spans are created by the {@link Tracer.startSpan} method.
6006
+ *
6007
+ * @since 1.0.0
7022
6008
  */
7023
6009
  declare interface Span {
7024
6010
  /**
@@ -7078,11 +6064,21 @@ declare interface Span {
7078
6064
  */
7079
6065
  addLinks(links: Link[]): this;
7080
6066
  /**
7081
- * Sets a status to the span. If used, this will override the default Span
7082
- * status. Default is {@link SpanStatusCode.UNSET}. SetStatus overrides the value
7083
- * of previous calls to SetStatus on the Span.
6067
+ * Sets the status of the span.
7084
6068
  *
7085
- * @param status the SpanStatus to set.
6069
+ * By default, a span has status {@link SpanStatusCode.UNSET}.
6070
+ * Calling this method overrides that default.
6071
+ *
6072
+ * The status codes have a total order: `OK > ERROR > UNSET`.
6073
+ *
6074
+ * - Once {@link SpanStatusCode.OK} is set, any further attempts to change
6075
+ * the status are ignored.
6076
+ * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.
6077
+ *
6078
+ * The `message` field is only used when {@link SpanStatusCode.ERROR} is set.
6079
+ * For all other status codes, `message` is ignored.
6080
+ *
6081
+ * @param status The {@link SpanStatus} to set.
7086
6082
  */
7087
6083
  setStatus(status: SpanStatus): this;
7088
6084
  /**
@@ -7127,17 +6123,21 @@ declare interface Span {
7127
6123
 
7128
6124
  /**
7129
6125
  * @deprecated please use {@link Attributes}
6126
+ * @since 1.0.0
7130
6127
  */
7131
6128
  declare type SpanAttributes = Attributes;
7132
6129
 
7133
6130
  /**
7134
6131
  * @deprecated please use {@link AttributeValue}
6132
+ * @since 1.0.0
7135
6133
  */
7136
6134
  declare type SpanAttributeValue = AttributeValue;
7137
6135
 
7138
6136
  /**
7139
6137
  * A SpanContext represents the portion of a {@link Span} which must be
7140
6138
  * serialized and propagated along side of a {@link Baggage}.
6139
+ *
6140
+ * @since 1.0.0
7141
6141
  */
7142
6142
  declare interface SpanContext {
7143
6143
  /**
@@ -7187,6 +6187,9 @@ declare interface SpanContext {
7187
6187
  traceState?: TraceState;
7188
6188
  }
7189
6189
 
6190
+ /**
6191
+ * @since 1.0.0
6192
+ */
7190
6193
  declare enum SpanKind {
7191
6194
  /** Default value. Indicates that the span is used internally. */
7192
6195
  INTERNAL = 0,
@@ -7216,6 +6219,8 @@ declare enum SpanKind {
7216
6219
 
7217
6220
  /**
7218
6221
  * Options needed for span creation
6222
+ *
6223
+ * @since 1.0.0
7219
6224
  */
7220
6225
  declare interface SpanOptions {
7221
6226
  /**
@@ -7224,7 +6229,7 @@ declare interface SpanOptions {
7224
6229
  */
7225
6230
  kind?: SpanKind;
7226
6231
  /** A span's attributes */
7227
- attributes?: SpanAttributes;
6232
+ attributes?: Attributes;
7228
6233
  /** {@link Link}s span to other spans */
7229
6234
  links?: Link[];
7230
6235
  /** A manually specified start time for the created `Span` object. */
@@ -7233,6 +6238,9 @@ declare interface SpanOptions {
7233
6238
  root?: boolean;
7234
6239
  }
7235
6240
 
6241
+ /**
6242
+ * @since 1.0.0
6243
+ */
7236
6244
  declare interface SpanStatus {
7237
6245
  /** The status code of this message. */
7238
6246
  code: SpanStatusCode;
@@ -7242,6 +6250,8 @@ declare interface SpanStatus {
7242
6250
 
7243
6251
  /**
7244
6252
  * An enumeration of status codes.
6253
+ *
6254
+ * @since 1.0.0
7245
6255
  */
7246
6256
  declare enum SpanStatusCode {
7247
6257
  /**
@@ -7262,7 +6272,7 @@ declare enum SpanStatusCode {
7262
6272
  /**
7263
6273
  Speech model that is used by the AI SDK Core functions.
7264
6274
  */
7265
- export declare type SpeechModel = SpeechModelV2_2;
6275
+ export declare type SpeechModel = SpeechModelV2;
7266
6276
 
7267
6277
  export declare type SpeechModelResponseMetadata = {
7268
6278
  /**
@@ -7272,96 +6282,21 @@ export declare type SpeechModelResponseMetadata = {
7272
6282
  /**
7273
6283
  The ID of the response model that was used to generate the response.
7274
6284
  */
7275
- modelId: string;
7276
- /**
7277
- Response headers.
7278
- */
7279
- headers?: Record<string, string>;
7280
- /**
7281
- Response body.
7282
- */
7283
- body?: unknown;
7284
- };
7285
-
7286
- /**
7287
- * Speech model specification version 2.
7288
- */
7289
- declare type SpeechModelV2 = {
7290
- /**
7291
- * The speech model must specify which speech model interface
7292
- * version it implements. This will allow us to evolve the speech
7293
- * model interface and retain backwards compatibility. The different
7294
- * implementation versions can be handled as a discriminated union
7295
- * on our side.
7296
- */
7297
- readonly specificationVersion: 'v2';
7298
- /**
7299
- * Name of the provider for logging purposes.
7300
- */
7301
- readonly provider: string;
7302
- /**
7303
- * Provider-specific model ID for logging purposes.
7304
- */
7305
- readonly modelId: string;
7306
- /**
7307
- * Generates speech audio from text.
7308
- */
7309
- doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
7310
- /**
7311
- * Generated audio as an ArrayBuffer.
7312
- * The audio should be returned without any unnecessary conversion.
7313
- * If the API returns base64 encoded strings, the audio should be returned
7314
- * as base64 encoded strings. If the API returns binary data, the audio
7315
- * should be returned as binary data.
7316
- */
7317
- audio: string | Uint8Array;
7318
- /**
7319
- * Warnings for the call, e.g. unsupported settings.
7320
- */
7321
- warnings: Array<SpeechModelV2CallWarning>;
7322
- /**
7323
- * Optional request information for telemetry and debugging purposes.
7324
- */
7325
- request?: {
7326
- /**
7327
- * Response body (available only for providers that use HTTP requests).
7328
- */
7329
- body?: unknown;
7330
- };
7331
- /**
7332
- * Response information for telemetry and debugging purposes.
7333
- */
7334
- response: {
7335
- /**
7336
- * Timestamp for the start of the generated response.
7337
- */
7338
- timestamp: Date;
7339
- /**
7340
- * The ID of the response model that was used to generate the response.
7341
- */
7342
- modelId: string;
7343
- /**
7344
- * Response headers.
7345
- */
7346
- headers?: SharedV2Headers;
7347
- /**
7348
- * Response body.
7349
- */
7350
- body?: unknown;
7351
- };
7352
- /**
7353
- * Additional provider-specific metadata. They are passed through
7354
- * from the provider to the AI SDK and enable provider-specific
7355
- * results that can be fully encapsulated in the provider.
7356
- */
7357
- providerMetadata?: Record<string, Record<string, JSONValue_2>>;
7358
- }>;
6285
+ modelId: string;
6286
+ /**
6287
+ Response headers.
6288
+ */
6289
+ headers?: Record<string, string>;
6290
+ /**
6291
+ Response body.
6292
+ */
6293
+ body?: unknown;
7359
6294
  };
7360
6295
 
7361
6296
  /**
7362
6297
  * Speech model specification version 2.
7363
6298
  */
7364
- declare type SpeechModelV2_2 = {
6299
+ declare type SpeechModelV2 = {
7365
6300
  /**
7366
6301
  * The speech model must specify which speech model interface
7367
6302
  * version it implements. This will allow us to evolve the speech
@@ -7381,7 +6316,7 @@ declare type SpeechModelV2_2 = {
7381
6316
  /**
7382
6317
  * Generates speech audio from text.
7383
6318
  */
7384
- doGenerate(options: SpeechModelV2CallOptions_2): PromiseLike<{
6319
+ doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
7385
6320
  /**
7386
6321
  * Generated audio as an ArrayBuffer.
7387
6322
  * The audio should be returned without any unnecessary conversion.
@@ -7393,7 +6328,7 @@ declare type SpeechModelV2_2 = {
7393
6328
  /**
7394
6329
  * Warnings for the call, e.g. unsupported settings.
7395
6330
  */
7396
- warnings: Array<SpeechModelV2CallWarning_2>;
6331
+ warnings: Array<SpeechModelV2CallWarning>;
7397
6332
  /**
7398
6333
  * Optional request information for telemetry and debugging purposes.
7399
6334
  */
@@ -7418,7 +6353,7 @@ declare type SpeechModelV2_2 = {
7418
6353
  /**
7419
6354
  * Response headers.
7420
6355
  */
7421
- headers?: SharedV2Headers_2;
6356
+ headers?: SharedV2Headers;
7422
6357
  /**
7423
6358
  * Response body.
7424
6359
  */
@@ -7429,7 +6364,7 @@ declare type SpeechModelV2_2 = {
7429
6364
  * from the provider to the AI SDK and enable provider-specific
7430
6365
  * results that can be fully encapsulated in the provider.
7431
6366
  */
7432
- providerMetadata?: Record<string, Record<string, JSONValue_3>>;
6367
+ providerMetadata?: Record<string, Record<string, JSONValue_2>>;
7433
6368
  }>;
7434
6369
  };
7435
6370
 
@@ -7484,57 +6419,6 @@ declare type SpeechModelV2CallOptions = {
7484
6419
  headers?: Record<string, string | undefined>;
7485
6420
  };
7486
6421
 
7487
- declare type SpeechModelV2CallOptions_2 = {
7488
- /**
7489
- * Text to convert to speech.
7490
- */
7491
- text: string;
7492
- /**
7493
- * The voice to use for speech synthesis.
7494
- * This is provider-specific and may be a voice ID, name, or other identifier.
7495
- */
7496
- voice?: string;
7497
- /**
7498
- * The desired output format for the audio e.g. "mp3", "wav", etc.
7499
- */
7500
- outputFormat?: string;
7501
- /**
7502
- * Instructions for the speech generation e.g. "Speak in a slow and steady tone".
7503
- */
7504
- instructions?: string;
7505
- /**
7506
- * The speed of the speech generation.
7507
- */
7508
- speed?: number;
7509
- /**
7510
- * The language for speech generation. This should be an ISO 639-1 language code (e.g. "en", "es", "fr")
7511
- * or "auto" for automatic language detection. Provider support varies.
7512
- */
7513
- language?: string;
7514
- /**
7515
- * Additional provider-specific options that are passed through to the provider
7516
- * as body parameters.
7517
- *
7518
- * The outer record is keyed by the provider name, and the inner
7519
- * record is keyed by the provider-specific metadata key.
7520
- * ```ts
7521
- * {
7522
- * "openai": {}
7523
- * }
7524
- * ```
7525
- */
7526
- providerOptions?: SpeechModelV2ProviderOptions_2;
7527
- /**
7528
- * Abort signal for cancelling the operation.
7529
- */
7530
- abortSignal?: AbortSignal;
7531
- /**
7532
- * Additional HTTP headers to be sent with the request.
7533
- * Only applicable for HTTP-based providers.
7534
- */
7535
- headers?: Record<string, string | undefined>;
7536
- };
7537
-
7538
6422
  /**
7539
6423
  * Warning from the model provider for this call. The call will proceed, but e.g.
7540
6424
  * some settings might not be supported, which can lead to suboptimal results.
@@ -7548,28 +6432,13 @@ declare type SpeechModelV2CallWarning = {
7548
6432
  message: string;
7549
6433
  };
7550
6434
 
7551
- /**
7552
- * Warning from the model provider for this call. The call will proceed, but e.g.
7553
- * some settings might not be supported, which can lead to suboptimal results.
7554
- */
7555
- declare type SpeechModelV2CallWarning_2 = {
7556
- type: 'unsupported-setting';
7557
- setting: keyof SpeechModelV2CallOptions_2;
7558
- details?: string;
7559
- } | {
7560
- type: 'other';
7561
- message: string;
7562
- };
7563
-
7564
6435
  declare type SpeechModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
7565
6436
 
7566
- declare type SpeechModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
7567
-
7568
6437
  /**
7569
6438
  Warning from the model provider for this call. The call will proceed, but e.g.
7570
6439
  some settings might not be supported, which can lead to suboptimal results.
7571
6440
  */
7572
- export declare type SpeechWarning = SpeechModelV2CallWarning_2;
6441
+ export declare type SpeechWarning = SpeechModelV2CallWarning;
7573
6442
 
7574
6443
  /** The Standard JSON Schema interface. */
7575
6444
  declare interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
@@ -7902,7 +6771,7 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
7902
6771
  @returns
7903
6772
  A result object for accessing the partial object stream and additional information.
7904
6773
  */
7905
- export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue_3>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<CallSettings, 'stopSequences'> & Prompt & (OUTPUT extends 'enum' ? {
6774
+ export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue_2>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<CallSettings, 'stopSequences'> & Prompt & (OUTPUT extends 'enum' ? {
7906
6775
  /**
7907
6776
  The enum values that the model should use.
7908
6777
  */
@@ -8556,8 +7425,6 @@ declare const symbol$1: unique symbol;
8556
7425
 
8557
7426
  declare const symbol$1_2: unique symbol;
8558
7427
 
8559
- declare const symbol$1_3: unique symbol;
8560
-
8561
7428
  declare const symbol$2: unique symbol;
8562
7429
 
8563
7430
  declare const symbol$2_2: unique symbol;
@@ -8582,8 +7449,6 @@ declare const symbol$7: unique symbol;
8582
7449
 
8583
7450
  declare const symbol$7_2: unique symbol;
8584
7451
 
8585
- declare const symbol$7_3: unique symbol;
8586
-
8587
7452
  declare const symbol$8: unique symbol;
8588
7453
 
8589
7454
  declare const symbol$8_2: unique symbol;
@@ -8604,20 +7469,18 @@ declare const symbol$c: unique symbol;
8604
7469
 
8605
7470
  declare const symbol$c_2: unique symbol;
8606
7471
 
8607
- declare const symbol$c_3: unique symbol;
8608
-
8609
7472
  declare const symbol$d: unique symbol;
8610
7473
 
8611
7474
  declare const symbol$d_2: unique symbol;
8612
7475
 
8613
- declare const symbol$d_3: unique symbol;
8614
-
8615
7476
  declare const symbol$e: unique symbol;
8616
7477
 
8617
7478
  declare const symbol: unique symbol;
8618
7479
 
8619
7480
  declare const symbol_2: unique symbol;
8620
7481
 
7482
+ declare const symbol_3: unique symbol;
7483
+
8621
7484
  /**
8622
7485
  A system message. It can contain system information.
8623
7486
 
@@ -8798,6 +7661,8 @@ export declare type TextUIPart = {
8798
7661
  * Defines TimeInput.
8799
7662
  *
8800
7663
  * hrtime, epoch milliseconds, performance.now() or Date
7664
+ *
7665
+ * @since 1.0.0
8801
7666
  */
8802
7667
  declare type TimeInput = HrTime | number | Date;
8803
7668
 
@@ -9002,13 +7867,13 @@ export declare class ToolCallRepairError extends AISDKError {
9002
7867
  export declare type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
9003
7868
  system: string | undefined;
9004
7869
  messages: ModelMessage[];
9005
- toolCall: LanguageModelV2ToolCall_2;
7870
+ toolCall: LanguageModelV2ToolCall;
9006
7871
  tools: TOOLS;
9007
7872
  inputSchema: (options: {
9008
7873
  toolName: string;
9009
7874
  }) => JSONSchema7;
9010
7875
  error: NoSuchToolError | InvalidToolInputError;
9011
- }) => Promise<LanguageModelV2ToolCall_2 | null>;
7876
+ }) => Promise<LanguageModelV2ToolCall | null>;
9012
7877
 
9013
7878
  /**
9014
7879
  Tool choice for the generation. It supports the following settings:
@@ -9142,6 +8007,8 @@ export declare class TooManyEmbeddingValuesForCallError extends AISDKError {
9142
8007
 
9143
8008
  /**
9144
8009
  * Tracer provides an interface for creating {@link Span}s.
8010
+ *
8011
+ * @since 1.0.0
9145
8012
  */
9146
8013
  declare interface Tracer {
9147
8014
  /**
@@ -9208,6 +8075,9 @@ declare interface Tracer {
9208
8075
  startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
9209
8076
  }
9210
8077
 
8078
+ /**
8079
+ * @since 1.0.0
8080
+ */
9211
8081
  declare interface TraceState {
9212
8082
  /**
9213
8083
  * Create a new TraceState which inherits from this TraceState and has the
@@ -9249,7 +8119,7 @@ declare interface TraceState {
9249
8119
  /**
9250
8120
  Transcription model that is used by the AI SDK Core functions.
9251
8121
  */
9252
- export declare type TranscriptionModel = TranscriptionModelV2_2;
8122
+ export declare type TranscriptionModel = TranscriptionModelV2;
9253
8123
 
9254
8124
  export declare type TranscriptionModelResponseMetadata = {
9255
8125
  /**
@@ -9366,106 +8236,6 @@ declare type TranscriptionModelV2 = {
9366
8236
  }>;
9367
8237
  };
9368
8238
 
9369
- /**
9370
- Transcription model specification version 2.
9371
- */
9372
- declare type TranscriptionModelV2_2 = {
9373
- /**
9374
- The transcription model must specify which transcription model interface
9375
- version it implements. This will allow us to evolve the transcription
9376
- model interface and retain backwards compatibility. The different
9377
- implementation versions can be handled as a discriminated union
9378
- on our side.
9379
- */
9380
- readonly specificationVersion: 'v2';
9381
- /**
9382
- Name of the provider for logging purposes.
9383
- */
9384
- readonly provider: string;
9385
- /**
9386
- Provider-specific model ID for logging purposes.
9387
- */
9388
- readonly modelId: string;
9389
- /**
9390
- Generates a transcript.
9391
- */
9392
- doGenerate(options: TranscriptionModelV2CallOptions_2): PromiseLike<{
9393
- /**
9394
- * The complete transcribed text from the audio.
9395
- */
9396
- text: string;
9397
- /**
9398
- * Array of transcript segments with timing information.
9399
- * Each segment represents a portion of the transcribed text with start and end times.
9400
- */
9401
- segments: Array<{
9402
- /**
9403
- * The text content of this segment.
9404
- */
9405
- text: string;
9406
- /**
9407
- * The start time of this segment in seconds.
9408
- */
9409
- startSecond: number;
9410
- /**
9411
- * The end time of this segment in seconds.
9412
- */
9413
- endSecond: number;
9414
- }>;
9415
- /**
9416
- * The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
9417
- * May be undefined if the language couldn't be detected.
9418
- */
9419
- language: string | undefined;
9420
- /**
9421
- * The total duration of the audio file in seconds.
9422
- * May be undefined if the duration couldn't be determined.
9423
- */
9424
- durationInSeconds: number | undefined;
9425
- /**
9426
- Warnings for the call, e.g. unsupported settings.
9427
- */
9428
- warnings: Array<TranscriptionModelV2CallWarning_2>;
9429
- /**
9430
- Optional request information for telemetry and debugging purposes.
9431
- */
9432
- request?: {
9433
- /**
9434
- Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
9435
- Non-HTTP(s) providers should not set this.
9436
- */
9437
- body?: string;
9438
- };
9439
- /**
9440
- Response information for telemetry and debugging purposes.
9441
- */
9442
- response: {
9443
- /**
9444
- Timestamp for the start of the generated response.
9445
- */
9446
- timestamp: Date;
9447
- /**
9448
- The ID of the response model that was used to generate the response.
9449
- */
9450
- modelId: string;
9451
- /**
9452
- Response headers.
9453
- */
9454
- headers?: SharedV2Headers_2;
9455
- /**
9456
- Response body.
9457
- */
9458
- body?: unknown;
9459
- };
9460
- /**
9461
- Additional provider-specific metadata. They are passed through
9462
- from the provider to the AI SDK and enable provider-specific
9463
- results that can be fully encapsulated in the provider.
9464
- */
9465
- providerMetadata?: Record<string, Record<string, JSONValue_3>>;
9466
- }>;
9467
- };
9468
-
9469
8239
  declare type TranscriptionModelV2CallOptions = {
9470
8240
  /**
9471
8241
  Audio data to transcribe.
@@ -9504,44 +8274,6 @@ declare type TranscriptionModelV2CallOptions = {
9504
8274
  headers?: Record<string, string | undefined>;
9505
8275
  };
9506
8276
 
9507
- declare type TranscriptionModelV2CallOptions_2 = {
9508
- /**
9509
- Audio data to transcribe.
9510
- Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
9511
- */
9512
- audio: Uint8Array | string;
9513
- /**
9514
- The IANA media type of the audio data.
9515
-
9516
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
9517
- */
9518
- mediaType: string;
9519
- /**
9520
- Additional provider-specific options that are passed through to the provider
9521
- as body parameters.
9522
-
9523
- The outer record is keyed by the provider name, and the inner
9524
- record is keyed by the provider-specific metadata key.
9525
- ```ts
9526
- {
9527
- "openai": {
9528
- "timestampGranularities": ["word"]
9529
- }
9530
- }
9531
- ```
9532
- */
9533
- providerOptions?: TranscriptionModelV2ProviderOptions_2;
9534
- /**
9535
- Abort signal for cancelling the operation.
9536
- */
9537
- abortSignal?: AbortSignal;
9538
- /**
9539
- Additional HTTP headers to be sent with the request.
9540
- Only applicable for HTTP-based providers.
9541
- */
9542
- headers?: Record<string, string | undefined>;
9543
- };
9544
-
9545
8277
  /**
9546
8278
  Warning from the model provider for this call. The call will proceed, but e.g.
9547
8279
  some settings might not be supported, which can lead to suboptimal results.
@@ -9555,28 +8287,13 @@ declare type TranscriptionModelV2CallWarning = {
9555
8287
  message: string;
9556
8288
  };
9557
8289
 
9558
- /**
9559
- Warning from the model provider for this call. The call will proceed, but e.g.
9560
- some settings might not be supported, which can lead to suboptimal results.
9561
- */
9562
- declare type TranscriptionModelV2CallWarning_2 = {
9563
- type: 'unsupported-setting';
9564
- setting: keyof TranscriptionModelV2CallOptions_2;
9565
- details?: string;
9566
- } | {
9567
- type: 'other';
9568
- message: string;
9569
- };
9570
-
9571
8290
  declare type TranscriptionModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
9572
8291
 
9573
- declare type TranscriptionModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
9574
-
9575
8292
  /**
9576
8293
  Warning from the model provider for this call. The call will proceed, but e.g.
9577
8294
  some settings might not be supported, which can lead to suboptimal results.
9578
8295
  */
9579
- export declare type TranscriptionWarning = TranscriptionModelV2CallWarning_2;
8296
+ export declare type TranscriptionWarning = TranscriptionModelV2CallWarning;
9580
8297
 
9581
8298
  export declare type TypedToolCall<TOOLS extends ToolSet> = StaticToolCall<TOOLS> | DynamicToolCall;
9582
8299
 
@@ -9585,7 +8302,7 @@ export declare type TypedToolError<TOOLS extends ToolSet> = StaticToolError<TOOL
9585
8302
  export declare type TypedToolResult<TOOLS extends ToolSet> = StaticToolResult<TOOLS> | DynamicToolResult;
9586
8303
 
9587
8304
  export declare class TypeValidationError extends AISDKError {
9588
- private readonly [symbol$1_2];
8305
+ private readonly [symbol$1];
9589
8306
  readonly value: unknown;
9590
8307
  constructor({ value, cause }: {
9591
8308
  value: unknown;
@@ -9608,30 +8325,6 @@ export declare class TypeValidationError extends AISDKError {
9608
8325
  }): TypeValidationError;
9609
8326
  }
9610
8327
 
9611
- declare class TypeValidationError_2 extends AISDKError_2 {
9612
- private readonly [symbol$1];
9613
- readonly value: unknown;
9614
- constructor({ value, cause }: {
9615
- value: unknown;
9616
- cause: unknown;
9617
- });
9618
- static isInstance(error: unknown): error is TypeValidationError_2;
9619
- /**
9620
- * Wraps an error into a TypeValidationError.
9621
- * If the cause is already a TypeValidationError with the same value, it returns the cause.
9622
- * Otherwise, it creates a new TypeValidationError.
9623
- *
9624
- * @param {Object} params - The parameters for wrapping the error.
9625
- * @param {unknown} params.value - The value that failed validation.
9626
- * @param {unknown} params.cause - The original error or cause of the validation failure.
9627
- * @returns {TypeValidationError} A TypeValidationError instance.
9628
- */
9629
- static wrap({ value, cause, }: {
9630
- value: unknown;
9631
- cause: unknown;
9632
- }): TypeValidationError_2;
9633
- }
9634
-
9635
8328
  export declare const UI_MESSAGE_STREAM_HEADERS: {
9636
8329
  'content-type': string;
9637
8330
  'cache-control': string;
@@ -10054,7 +8747,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
10054
8747
  export declare type UITools = Record<string, UITool>;
10055
8748
 
10056
8749
  export declare class UnsupportedFunctionalityError extends AISDKError {
10057
- private readonly [symbol];
8750
+ private readonly [symbol_2];
10058
8751
  readonly functionality: string;
10059
8752
  constructor({ functionality, message, }: {
10060
8753
  functionality: string;
@@ -10160,6 +8853,15 @@ export declare type UserModelMessage = {
10160
8853
 
10161
8854
  export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
10162
8855
 
8856
+ /**
8857
+ * Validates that a URL is safe to download from, blocking private/internal addresses
8858
+ * to prevent SSRF attacks.
8859
+ *
8860
+ * @param url - The URL string to validate.
8861
+ * @throws DownloadError if the URL is unsafe.
8862
+ */
8863
+ declare function validateDownloadUrl(url: string): void;
8864
+
10163
8865
  /**
10164
8866
  * Validates the types of an unknown object using a schema and
10165
8867
  * return a strongly-typed object.
@@ -10295,11 +8997,11 @@ declare function withUserAgentSuffix(headers: HeadersInit | Record<string, strin
10295
8997
  * @returns A new LanguageModelV2 instance with middleware applied.
10296
8998
  */
10297
8999
  export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, modelId, providerId, }: {
10298
- model: LanguageModelV2_2;
9000
+ model: LanguageModelV2;
10299
9001
  middleware: LanguageModelMiddleware | LanguageModelMiddleware[];
10300
9002
  modelId?: string;
10301
9003
  providerId?: string;
10302
- }) => LanguageModelV2_2;
9004
+ }) => LanguageModelV2;
10303
9005
 
10304
9006
  /**
10305
9007
  * Wraps a ProviderV2 instance with middleware functionality.
@@ -10313,9 +9015,9 @@ export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, mod
10313
9015
  * @returns A new ProviderV2 instance with middleware applied to all language models.
10314
9016
  */
10315
9017
  export declare function wrapProvider({ provider, languageModelMiddleware, }: {
10316
- provider: ProviderV2_2;
9018
+ provider: ProviderV2;
10317
9019
  languageModelMiddleware: LanguageModelMiddleware | LanguageModelMiddleware[];
10318
- }): ProviderV2_2;
9020
+ }): ProviderV2;
10319
9021
 
10320
9022
  export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
10321
9023
  /**
@@ -10328,5 +9030,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
10328
9030
  }): Schema<OBJECT>;
10329
9031
 
10330
9032
  export { }
10331
- export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, FlexibleSchema as FlexibleSchema, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, JSONValue_2 as JSONValue_2, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding_2 as EmbeddingModelV2Embedding_2, ImageModelV2ProviderMetadata_2 as ImageModelV2ProviderMetadata_2, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason_2 as LanguageModelV2FinishReason_2, LanguageModelV2CallWarning_2 as LanguageModelV2CallWarning_2, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata_2 as SharedV2ProviderMetadata_2, LanguageModelV2Usage_2 as LanguageModelV2Usage_2, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall_2 as LanguageModelV2ToolCall_2, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, Output_2 as Output_2, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_3 as JSONValue_3, ImageModelV2CallWarning_2 as ImageModelV2CallWarning_2, SpeechModelV2CallWarning_2 as SpeechModelV2CallWarning_2, TranscriptionModelV2CallWarning_2 as TranscriptionModelV2CallWarning_2, LanguageModelV2CallOptions_2 as LanguageModelV2CallOptions_2, LanguageModelV2_2 as LanguageModelV2_2, EmbeddingModelV2_2 as EmbeddingModelV2_2, ImageModelV2_2 as ImageModelV2_2, TranscriptionModelV2_2 as TranscriptionModelV2_2, SpeechModelV2_2 as SpeechModelV2_2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2_2 as ProviderV2_2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction };
10332
- export { schemaSymbol, symbol$1, symbol$1_2, symbol$1_3, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$7_3, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$a_2, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$c_3, symbol$d, symbol$d_2, symbol$d_3, symbol$e, symbol, symbol_2, validatorSymbol };
9033
+ export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, FlexibleSchema as FlexibleSchema, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding as EmbeddingModelV2Embedding, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason as LanguageModelV2FinishReason, LanguageModelV2CallWarning as LanguageModelV2CallWarning, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata as SharedV2ProviderMetadata, LanguageModelV2Usage as LanguageModelV2Usage, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall as LanguageModelV2ToolCall, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, Output_2 as Output_2, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_2 as JSONValue_2, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, LanguageModelV2CallOptions as LanguageModelV2CallOptions, LanguageModelV2 as LanguageModelV2, EmbeddingModelV2 as EmbeddingModelV2, ImageModelV2 as ImageModelV2, TranscriptionModelV2 as TranscriptionModelV2, SpeechModelV2 as SpeechModelV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2 as ProviderV2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction };
9034
+ export { schemaSymbol, symbol$1, symbol$1_2, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$a_2, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol, symbol_2, symbol_3, validatorSymbol };