@mastra/client-js 1.15.0 → 1.15.1-alpha.2

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.
@@ -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>;
@@ -542,7 +490,7 @@ export declare type CallSettings = {
542
490
  Warning from the model provider for this call. The call will proceed, but e.g.
543
491
  some settings might not be supported, which can lead to suboptimal results.
544
492
  */
545
- export declare type CallWarning = LanguageModelV2CallWarning_2;
493
+ export declare type CallWarning = LanguageModelV2CallWarning;
546
494
 
547
495
  export declare interface ChatInit<UI_MESSAGE extends UIMessage> {
548
496
  /**
@@ -959,7 +907,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
959
907
  errorSchema: FlexibleValidator<T>;
960
908
  errorToMessage: (error: T) => string;
961
909
  isRetryable?: (response: Response, error?: T) => boolean;
962
- }) => ResponseHandler<APICallError_2>;
910
+ }) => ResponseHandler<APICallError>;
963
911
 
964
912
  declare const createJsonResponseHandler: <T>(responseSchema: FlexibleValidator<T>) => ResponseHandler<T>;
965
913
 
@@ -990,12 +938,12 @@ declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT,
990
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.
991
939
  * @returns A new ProviderRegistryProvider instance that provides access to all registered providers with optional middleware applied to language models.
992
940
  */
993
- 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, }?: {
994
942
  separator?: SEPARATOR;
995
943
  languageModelMiddleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
996
944
  }): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
997
945
 
998
- declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError_2>;
946
+ declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
999
947
 
1000
948
  export declare function createTextStreamResponse({ status, statusText, headers, textStream, }: ResponseInit & {
1001
949
  textStream: ReadableStream<string>;
@@ -1038,19 +986,19 @@ export declare function createUIMessageStreamResponse({ status, statusText, head
1038
986
  *
1039
987
  * @throws {NoSuchModelError} Throws when a requested model is not found and no fallback provider is available.
1040
988
  */
1041
- 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, }: {
1042
990
  languageModels?: LANGUAGE_MODELS;
1043
991
  textEmbeddingModels?: EMBEDDING_MODELS;
1044
992
  imageModels?: IMAGE_MODELS;
1045
993
  transcriptionModels?: TRANSCRIPTION_MODELS;
1046
994
  speechModels?: SPEECH_MODELS;
1047
- fallbackProvider?: ProviderV2_2;
1048
- }): ProviderV2_2 & {
1049
- languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV2_2;
1050
- textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>): EmbeddingModelV2_2<string>;
1051
- imageModel(modelId: ExtractModelId<IMAGE_MODELS>): ImageModelV2_2;
1052
- transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>): TranscriptionModelV2_2;
1053
- 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;
1054
1002
  };
1055
1003
 
1056
1004
  /**
@@ -1086,6 +1034,19 @@ export declare type DeepPartial<T> = T extends z3.ZodTypeAny ? DeepPartialIntern
1086
1034
 
1087
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;
1088
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
+
1089
1050
  export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
1090
1051
  constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
1091
1052
  protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
@@ -1096,19 +1057,19 @@ export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends
1096
1057
  */
1097
1058
  export declare function defaultSettingsMiddleware({ settings, }: {
1098
1059
  settings: Partial<{
1099
- maxOutputTokens?: LanguageModelV2CallOptions_2['maxOutputTokens'];
1100
- temperature?: LanguageModelV2CallOptions_2['temperature'];
1101
- stopSequences?: LanguageModelV2CallOptions_2['stopSequences'];
1102
- topP?: LanguageModelV2CallOptions_2['topP'];
1103
- topK?: LanguageModelV2CallOptions_2['topK'];
1104
- presencePenalty?: LanguageModelV2CallOptions_2['presencePenalty'];
1105
- frequencyPenalty?: LanguageModelV2CallOptions_2['frequencyPenalty'];
1106
- responseFormat?: LanguageModelV2CallOptions_2['responseFormat'];
1107
- seed?: LanguageModelV2CallOptions_2['seed'];
1108
- tools?: LanguageModelV2CallOptions_2['tools'];
1109
- toolChoice?: LanguageModelV2CallOptions_2['toolChoice'];
1110
- headers?: LanguageModelV2CallOptions_2['headers'];
1111
- 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'];
1112
1073
  }>;
1113
1074
  }): LanguageModelMiddleware;
1114
1075
 
@@ -1156,6 +1117,21 @@ export declare class DownloadError extends AISDKError {
1156
1117
  static isInstance(error: unknown): error is DownloadError;
1157
1118
  }
1158
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
+
1159
1135
  /**
1160
1136
  Helper function for defining a dynamic tool.
1161
1137
  */
@@ -1303,12 +1279,12 @@ export declare function embed<VALUE = string>({ model: modelArg, value, provider
1303
1279
  /**
1304
1280
  Embedding.
1305
1281
  */
1306
- export declare type Embedding = EmbeddingModelV2Embedding_2;
1282
+ export declare type Embedding = EmbeddingModelV2Embedding;
1307
1283
 
1308
1284
  /**
1309
1285
  Embedding model that is used by the AI SDK Core functions.
1310
1286
  */
1311
- export declare type EmbeddingModel<VALUE = string> = string | EmbeddingModelV2_2<VALUE>;
1287
+ export declare type EmbeddingModel<VALUE = string> = string | EmbeddingModelV2<VALUE>;
1312
1288
 
1313
1289
  /**
1314
1290
  Represents the number of tokens used in an embedding.
@@ -1414,112 +1390,12 @@ declare type EmbeddingModelV2<VALUE> = {
1414
1390
  }>;
1415
1391
  };
1416
1392
 
1417
- /**
1418
- Specification for an embedding model that implements the embedding model
1419
- interface version 1.
1420
-
1421
- VALUE is the type of the values that the model can embed.
1422
- This will allow us to go beyond text embeddings in the future,
1423
- e.g. to support image embeddings
1424
- */
1425
- declare type EmbeddingModelV2_2<VALUE> = {
1426
- /**
1427
- The embedding model must specify which embedding model interface
1428
- version it implements. This will allow us to evolve the embedding
1429
- model interface and retain backwards compatibility. The different
1430
- implementation versions can be handled as a discriminated union
1431
- on our side.
1432
- */
1433
- readonly specificationVersion: 'v2';
1434
- /**
1435
- Name of the provider for logging purposes.
1436
- */
1437
- readonly provider: string;
1438
- /**
1439
- Provider-specific model ID for logging purposes.
1440
- */
1441
- readonly modelId: string;
1442
- /**
1443
- Limit of how many embeddings can be generated in a single API call.
1444
-
1445
- Use Infinity for models that do not have a limit.
1446
- */
1447
- readonly maxEmbeddingsPerCall: PromiseLike<number | undefined> | number | undefined;
1448
- /**
1449
- True if the model can handle multiple embedding calls in parallel.
1450
- */
1451
- readonly supportsParallelCalls: PromiseLike<boolean> | boolean;
1452
- /**
1453
- Generates a list of embeddings for the given input text.
1454
-
1455
- Naming: "do" prefix to prevent accidental direct usage of the method
1456
- by the user.
1457
- */
1458
- doEmbed(options: {
1459
- /**
1460
- List of values to embed.
1461
- */
1462
- values: Array<VALUE>;
1463
- /**
1464
- Abort signal for cancelling the operation.
1465
- */
1466
- abortSignal?: AbortSignal;
1467
- /**
1468
- Additional provider-specific options. They are passed through
1469
- to the provider from the AI SDK and enable provider-specific
1470
- functionality that can be fully encapsulated in the provider.
1471
- */
1472
- providerOptions?: SharedV2ProviderOptions_2;
1473
- /**
1474
- Additional HTTP headers to be sent with the request.
1475
- Only applicable for HTTP-based providers.
1476
- */
1477
- headers?: Record<string, string | undefined>;
1478
- }): PromiseLike<{
1479
- /**
1480
- Generated embeddings. They are in the same order as the input values.
1481
- */
1482
- embeddings: Array<EmbeddingModelV2Embedding_2>;
1483
- /**
1484
- Token usage. We only have input tokens for embeddings.
1485
- */
1486
- usage?: {
1487
- tokens: number;
1488
- };
1489
- /**
1490
- Additional provider-specific metadata. They are passed through
1491
- from the provider to the AI SDK and enable provider-specific
1492
- results that can be fully encapsulated in the provider.
1493
- */
1494
- providerMetadata?: SharedV2ProviderMetadata_2;
1495
- /**
1496
- Optional response information for debugging purposes.
1497
- */
1498
- response?: {
1499
- /**
1500
- Response headers.
1501
- */
1502
- headers?: SharedV2Headers_2;
1503
- /**
1504
- The response body.
1505
- */
1506
- body?: unknown;
1507
- };
1508
- }>;
1509
- };
1510
-
1511
1393
  /**
1512
1394
  An embedding is a vector, i.e. an array of numbers.
1513
1395
  It is e.g. used to represent a text as a vector of word embeddings.
1514
1396
  */
1515
1397
  declare type EmbeddingModelV2Embedding = Array<number>;
1516
1398
 
1517
- /**
1518
- An embedding is a vector, i.e. an array of numbers.
1519
- It is e.g. used to represent a text as a vector of word embeddings.
1520
- */
1521
- declare type EmbeddingModelV2Embedding_2 = Array<number>;
1522
-
1523
1399
  /**
1524
1400
  Embed several values using an embedding model. The type of the value is defined
1525
1401
  by the embedding model.
@@ -2022,7 +1898,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
2022
1898
  /**
2023
1899
  The speech model to use.
2024
1900
  */
2025
- model: SpeechModelV2_2;
1901
+ model: SpeechModelV2;
2026
1902
  /**
2027
1903
  The text to convert to speech.
2028
1904
  */
@@ -2105,14 +1981,14 @@ export declare interface Experimental_SpeechResult {
2105
1981
  /**
2106
1982
  Provider metadata from the provider.
2107
1983
  */
2108
- readonly providerMetadata: Record<string, Record<string, JSONValue_3>>;
1984
+ readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
2109
1985
  }
2110
1986
 
2111
1987
  export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
2112
1988
  /**
2113
1989
  The transcription model to use.
2114
1990
  */
2115
- model: TranscriptionModelV2_2;
1991
+ model: TranscriptionModelV2;
2116
1992
  /**
2117
1993
  The audio data to transcribe.
2118
1994
  */
@@ -2210,10 +2086,10 @@ export declare interface Experimental_TranscriptionResult {
2210
2086
  /**
2211
2087
  Provider metadata from the provider.
2212
2088
  */
2213
- readonly providerMetadata: Record<string, Record<string, JSONValue_3>>;
2089
+ readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
2214
2090
  }
2215
2091
 
2216
- export declare type Experimental_Warning = LanguageModelV2CallWarning_2 | ImageModelV2CallWarning_2 | SpeechModelV2CallWarning_2 | TranscriptionModelV2CallWarning_2;
2092
+ export declare type Experimental_Warning = LanguageModelV2CallWarning | ImageModelV2CallWarning | SpeechModelV2CallWarning | TranscriptionModelV2CallWarning;
2217
2093
 
2218
2094
  declare type ExtractLiteralUnion<T> = T extends string ? string extends T ? never : T : never;
2219
2095
 
@@ -2315,7 +2191,7 @@ export declare type FileUIPart = {
2315
2191
  - `error`: model stopped because of an error
2316
2192
  - `other`: model stopped for other reasons
2317
2193
  */
2318
- export declare type FinishReason = LanguageModelV2FinishReason_2;
2194
+ export declare type FinishReason = LanguageModelV2FinishReason;
2319
2195
 
2320
2196
  declare type FlexibleSchema<SCHEMA> = z4.core.$ZodType<SCHEMA, any> | z3.Schema<SCHEMA, z3.ZodTypeDef, any> | Schema<SCHEMA> | LazySchema<SCHEMA>;
2321
2197
 
@@ -2330,13 +2206,57 @@ declare interface GatewayCreditsResponse {
2330
2206
  totalUsed: string;
2331
2207
  }
2332
2208
 
2333
- 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 & {});
2334
2210
 
2335
2211
  declare interface GatewayFetchMetadataResponse {
2336
2212
  models: GatewayLanguageModelEntry[];
2337
2213
  }
2338
2214
 
2339
- 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 & {});
2340
2260
 
2341
2261
  declare interface GatewayLanguageModelEntry {
2342
2262
  /**
@@ -2382,12 +2302,12 @@ declare interface GatewayLanguageModelEntry {
2382
2302
  /**
2383
2303
  * Optional field to differentiate between model types.
2384
2304
  */
2385
- modelType?: 'language' | 'embedding' | 'image' | null;
2305
+ modelType?: KnownModelType | null;
2386
2306
  }
2387
2307
 
2388
2308
  declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
2389
2309
 
2390
- 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 & {});
2391
2311
 
2392
2312
  declare interface GatewayProvider extends ProviderV2 {
2393
2313
  (modelId: GatewayModelId): LanguageModelV2;
@@ -2403,6 +2323,16 @@ declare interface GatewayProvider extends ProviderV2 {
2403
2323
  Returns credit information for the authenticated user.
2404
2324
  */
2405
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>;
2406
2336
  /**
2407
2337
  Creates a model for generating text embeddings.
2408
2338
  */
@@ -2441,6 +2371,64 @@ declare interface GatewayProviderSettings {
2441
2371
  metadataCacheRefreshMillis?: number;
2442
2372
  }
2443
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
+
2444
2432
  /**
2445
2433
  * Gateway-specific provider-defined tools.
2446
2434
  */
@@ -2566,7 +2554,7 @@ export declare const generateId: IdGenerator;
2566
2554
  @returns
2567
2555
  A result object that contains the generated object, the finish reason, the token usage, and additional information.
2568
2556
  */
2569
- 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' ? {
2570
2558
  /**
2571
2559
  The enum values that the model should use.
2572
2560
  */
@@ -2944,10 +2932,6 @@ declare type GetMaxImagesPerCallFunction = (options: {
2944
2932
  modelId: string;
2945
2933
  }) => PromiseLike<number | undefined> | number | undefined;
2946
2934
 
2947
- declare type GetMaxImagesPerCallFunction_2 = (options: {
2948
- modelId: string;
2949
- }) => PromiseLike<number | undefined> | number | undefined;
2950
-
2951
2935
  declare const getOriginalFetch: () => typeof fetch;
2952
2936
 
2953
2937
  declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
@@ -3070,18 +3054,18 @@ export declare type IdGenerator = () => string;
3070
3054
  /**
3071
3055
  Image model that is used by the AI SDK Core functions.
3072
3056
  */
3073
- export declare type ImageModel = string | ImageModelV2_2;
3057
+ export declare type ImageModel = string | ImageModelV2;
3074
3058
 
3075
3059
  /**
3076
3060
  Warning from the model provider for this call. The call will proceed, but e.g.
3077
3061
  some settings might not be supported, which can lead to suboptimal results.
3078
3062
  */
3079
- export declare type ImageModelCallWarning = ImageModelV2CallWarning_2;
3063
+ export declare type ImageModelCallWarning = ImageModelV2CallWarning;
3080
3064
 
3081
3065
  /**
3082
3066
  Metadata from the model provider for this call
3083
3067
  */
3084
- export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata_2;
3068
+ export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata;
3085
3069
 
3086
3070
  export declare type ImageModelResponseMetadata = {
3087
3071
  /**
@@ -3179,116 +3163,35 @@ declare type ImageModelV2 = {
3179
3163
  }>;
3180
3164
  };
3181
3165
 
3182
- /**
3183
- Image generation model specification version 2.
3184
- */
3185
- declare type ImageModelV2_2 = {
3166
+ declare type ImageModelV2CallOptions = {
3186
3167
  /**
3187
- The image model must specify which image model interface
3188
- version it implements. This will allow us to evolve the image
3189
- model interface and retain backwards compatibility. The different
3190
- implementation versions can be handled as a discriminated union
3191
- on our side.
3168
+ Prompt for the image generation.
3192
3169
  */
3193
- readonly specificationVersion: 'v2';
3170
+ prompt: string;
3194
3171
  /**
3195
- Name of the provider for logging purposes.
3172
+ Number of images to generate.
3196
3173
  */
3197
- readonly provider: string;
3174
+ n: number;
3198
3175
  /**
3199
- 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.
3200
3179
  */
3201
- readonly modelId: string;
3180
+ size: `${number}x${number}` | undefined;
3202
3181
  /**
3203
- Limit of how many images can be generated in a single API call.
3204
- Can be set to a number for a fixed limit, to undefined to use
3205
- the global limit, or a function that returns a number or undefined,
3206
- 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.
3207
3185
  */
3208
- readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction_2;
3186
+ aspectRatio: `${number}:${number}` | undefined;
3209
3187
  /**
3210
- Generates an array of images.
3188
+ Seed for the image generation.
3189
+ `undefined` will use the provider's default seed.
3211
3190
  */
3212
- doGenerate(options: ImageModelV2CallOptions_2): PromiseLike<{
3213
- /**
3214
- Generated images as base64 encoded strings or binary data.
3215
- The images should be returned without any unnecessary conversion.
3216
- If the API returns base64 encoded strings, the images should be returned
3217
- as base64 encoded strings. If the API returns binary data, the images should
3218
- be returned as binary data.
3219
- */
3220
- images: Array<string> | Array<Uint8Array>;
3221
- /**
3222
- Warnings for the call, e.g. unsupported settings.
3223
- */
3224
- warnings: Array<ImageModelV2CallWarning_2>;
3225
- /**
3226
- Additional provider-specific metadata. They are passed through
3227
- from the provider to the AI SDK and enable provider-specific
3228
- results that can be fully encapsulated in the provider.
3229
-
3230
- The outer record is keyed by the provider name, and the inner
3231
- record is provider-specific metadata. It always includes an
3232
- `images` key with image-specific metadata
3233
-
3234
- ```ts
3235
- {
3236
- "openai": {
3237
- "images": ["revisedPrompt": "Revised prompt here."]
3238
- }
3239
- }
3240
- ```
3241
- */
3242
- providerMetadata?: ImageModelV2ProviderMetadata_2;
3243
- /**
3244
- Response information for telemetry and debugging purposes.
3245
- */
3246
- response: {
3247
- /**
3248
- Timestamp for the start of the generated response.
3249
- */
3250
- timestamp: Date;
3251
- /**
3252
- The ID of the response model that was used to generate the response.
3253
- */
3254
- modelId: string;
3255
- /**
3256
- Response headers.
3257
- */
3258
- headers: Record<string, string> | undefined;
3259
- };
3260
- }>;
3261
- };
3262
-
3263
- declare type ImageModelV2CallOptions = {
3264
- /**
3265
- Prompt for the image generation.
3266
- */
3267
- prompt: string;
3268
- /**
3269
- Number of images to generate.
3270
- */
3271
- n: number;
3272
- /**
3273
- Size of the images to generate.
3274
- Must have the format `{width}x{height}`.
3275
- `undefined` will use the provider's default size.
3276
- */
3277
- size: `${number}x${number}` | undefined;
3278
- /**
3279
- Aspect ratio of the images to generate.
3280
- Must have the format `{width}:{height}`.
3281
- `undefined` will use the provider's default aspect ratio.
3282
- */
3283
- aspectRatio: `${number}:${number}` | undefined;
3284
- /**
3285
- Seed for the image generation.
3286
- `undefined` will use the provider's default seed.
3287
- */
3288
- seed: number | undefined;
3289
- /**
3290
- Additional provider-specific options that are passed through to the provider
3291
- as body parameters.
3191
+ seed: number | undefined;
3192
+ /**
3193
+ Additional provider-specific options that are passed through to the provider
3194
+ as body parameters.
3292
3195
 
3293
3196
  The outer record is keyed by the provider name, and the inner
3294
3197
  record is keyed by the provider-specific metadata key.
@@ -3312,58 +3215,6 @@ declare type ImageModelV2CallOptions = {
3312
3215
  headers?: Record<string, string | undefined>;
3313
3216
  };
3314
3217
 
3315
- declare type ImageModelV2CallOptions_2 = {
3316
- /**
3317
- Prompt for the image generation.
3318
- */
3319
- prompt: string;
3320
- /**
3321
- Number of images to generate.
3322
- */
3323
- n: number;
3324
- /**
3325
- Size of the images to generate.
3326
- Must have the format `{width}x{height}`.
3327
- `undefined` will use the provider's default size.
3328
- */
3329
- size: `${number}x${number}` | undefined;
3330
- /**
3331
- Aspect ratio of the images to generate.
3332
- Must have the format `{width}:{height}`.
3333
- `undefined` will use the provider's default aspect ratio.
3334
- */
3335
- aspectRatio: `${number}:${number}` | undefined;
3336
- /**
3337
- Seed for the image generation.
3338
- `undefined` will use the provider's default seed.
3339
- */
3340
- seed: number | undefined;
3341
- /**
3342
- Additional provider-specific options that are passed through to the provider
3343
- as body parameters.
3344
-
3345
- The outer record is keyed by the provider name, and the inner
3346
- record is keyed by the provider-specific metadata key.
3347
- ```ts
3348
- {
3349
- "openai": {
3350
- "style": "vivid"
3351
- }
3352
- }
3353
- ```
3354
- */
3355
- providerOptions: SharedV2ProviderOptions_2;
3356
- /**
3357
- Abort signal for cancelling the operation.
3358
- */
3359
- abortSignal?: AbortSignal;
3360
- /**
3361
- Additional HTTP headers to be sent with the request.
3362
- Only applicable for HTTP-based providers.
3363
- */
3364
- headers?: Record<string, string | undefined>;
3365
- };
3366
-
3367
3218
  /**
3368
3219
  Warning from the model provider for this call. The call will proceed, but e.g.
3369
3220
  some settings might not be supported, which can lead to suboptimal results.
@@ -3377,27 +3228,10 @@ declare type ImageModelV2CallWarning = {
3377
3228
  message: string;
3378
3229
  };
3379
3230
 
3380
- /**
3381
- Warning from the model provider for this call. The call will proceed, but e.g.
3382
- some settings might not be supported, which can lead to suboptimal results.
3383
- */
3384
- declare type ImageModelV2CallWarning_2 = {
3385
- type: 'unsupported-setting';
3386
- setting: keyof ImageModelV2CallOptions_2;
3387
- details?: string;
3388
- } | {
3389
- type: 'other';
3390
- message: string;
3391
- };
3392
-
3393
3231
  declare type ImageModelV2ProviderMetadata = Record<string, {
3394
3232
  images: JSONArray;
3395
3233
  } & JSONValue_2>;
3396
3234
 
3397
- declare type ImageModelV2ProviderMetadata_2 = Record<string, {
3398
- images: JSONArray_2;
3399
- } & JSONValue_3>;
3400
-
3401
3235
  /**
3402
3236
  Image content part of a prompt. It contains an image.
3403
3237
  */
@@ -3485,7 +3319,7 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
3485
3319
  }): LanguageModelV2Prompt;
3486
3320
 
3487
3321
  export declare class InvalidArgumentError extends AISDKError {
3488
- private readonly [symbol$c_3];
3322
+ private readonly [symbol$c_2];
3489
3323
  readonly parameter: string;
3490
3324
  readonly value: unknown;
3491
3325
  constructor({ parameter, value, message, }: {
@@ -3604,11 +3438,11 @@ export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
3604
3438
  */
3605
3439
  export declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is FileUIPart;
3606
3440
 
3607
- declare function isJSONArray(value: unknown): value is JSONArray_2;
3441
+ declare function isJSONArray(value: unknown): value is JSONArray;
3608
3442
 
3609
- declare function isJSONObject(value: unknown): value is JSONObject_2;
3443
+ declare function isJSONObject(value: unknown): value is JSONObject;
3610
3444
 
3611
- declare function isJSONValue(value: unknown): value is JSONValue_3;
3445
+ declare function isJSONValue(value: unknown): value is JSONValue_2;
3612
3446
 
3613
3447
  declare function isParsableJson(input: string): boolean;
3614
3448
 
@@ -3649,34 +3483,18 @@ declare type Job = () => Promise<void>;
3649
3483
 
3650
3484
  declare type JSONArray = JSONValue_2[];
3651
3485
 
3652
- declare type JSONArray_2 = JSONValue_3[];
3653
-
3654
3486
  declare type JSONObject = {
3655
3487
  [key: string]: JSONValue_2;
3656
3488
  };
3657
3489
 
3658
- declare type JSONObject_2 = {
3659
- [key: string]: JSONValue_3;
3660
- };
3661
-
3662
3490
  export declare class JSONParseError extends AISDKError {
3663
- private readonly [symbol$7_2];
3664
- readonly text: string;
3665
- constructor({ text, cause }: {
3666
- text: string;
3667
- cause: unknown;
3668
- });
3669
- static isInstance(error: unknown): error is JSONParseError;
3670
- }
3671
-
3672
- declare class JSONParseError_2 extends AISDKError_2 {
3673
3491
  private readonly [symbol$7];
3674
3492
  readonly text: string;
3675
3493
  constructor({ text, cause }: {
3676
3494
  text: string;
3677
3495
  cause: unknown;
3678
3496
  });
3679
- static isInstance(error: unknown): error is JSONParseError_2;
3497
+ static isInstance(error: unknown): error is JSONParseError;
3680
3498
  }
3681
3499
 
3682
3500
  /**
@@ -3852,7 +3670,7 @@ export declare class JsonToSseTransformStream extends TransformStream<unknown, s
3852
3670
  constructor();
3853
3671
  }
3854
3672
 
3855
- export declare type JSONValue = JSONValue_3;
3673
+ export declare type JSONValue = JSONValue_2;
3856
3674
 
3857
3675
  /**
3858
3676
  A JSON value can be a string, number, boolean, object, array, or null.
@@ -3860,16 +3678,14 @@ export declare type JSONValue = JSONValue_3;
3860
3678
  */
3861
3679
  declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
3862
3680
 
3863
- /**
3864
- A JSON value can be a string, number, boolean, object, array, or null.
3865
- JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
3866
- */
3867
- 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];
3868
3684
 
3869
3685
  /**
3870
3686
  Language model that is used by the AI SDK Core functions.
3871
3687
  */
3872
- export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2_2;
3688
+ export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2;
3873
3689
 
3874
3690
  export declare type LanguageModelMiddleware = LanguageModelV2Middleware;
3875
3691
 
@@ -3902,7 +3718,7 @@ export declare type LanguageModelResponseMetadata = {
3902
3718
  /**
3903
3719
  Represents the number of tokens used in a prompt and completion.
3904
3720
  */
3905
- export declare type LanguageModelUsage = LanguageModelV2Usage_2;
3721
+ export declare type LanguageModelUsage = LanguageModelV2Usage;
3906
3722
 
3907
3723
  /**
3908
3724
  Specification for a language model that implements the language model interface version 2.
@@ -4016,118 +3832,6 @@ declare type LanguageModelV2 = {
4016
3832
  }>;
4017
3833
  };
4018
3834
 
4019
- /**
4020
- Specification for a language model that implements the language model interface version 2.
4021
- */
4022
- declare type LanguageModelV2_2 = {
4023
- /**
4024
- The language model must specify which language model interface version it implements.
4025
- */
4026
- readonly specificationVersion: 'v2';
4027
- /**
4028
- Name of the provider for logging purposes.
4029
- */
4030
- readonly provider: string;
4031
- /**
4032
- Provider-specific model ID for logging purposes.
4033
- */
4034
- readonly modelId: string;
4035
- /**
4036
- Supported URL patterns by media type for the provider.
4037
-
4038
- The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`).
4039
- and the values are arrays of regular expressions that match the URL paths.
4040
-
4041
- The matching should be against lower-case URLs.
4042
-
4043
- Matched URLs are supported natively by the model and are not downloaded.
4044
-
4045
- @returns A map of supported URL patterns by media type (as a promise or a plain object).
4046
- */
4047
- supportedUrls: PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
4048
- /**
4049
- Generates a language model output (non-streaming).
4050
-
4051
- Naming: "do" prefix to prevent accidental direct usage of the method
4052
- by the user.
4053
- */
4054
- doGenerate(options: LanguageModelV2CallOptions_2): PromiseLike<{
4055
- /**
4056
- Ordered content that the model has generated.
4057
- */
4058
- content: Array<LanguageModelV2Content_2>;
4059
- /**
4060
- Finish reason.
4061
- */
4062
- finishReason: LanguageModelV2FinishReason_2;
4063
- /**
4064
- Usage information.
4065
- */
4066
- usage: LanguageModelV2Usage_2;
4067
- /**
4068
- Additional provider-specific metadata. They are passed through
4069
- from the provider to the AI SDK and enable provider-specific
4070
- results that can be fully encapsulated in the provider.
4071
- */
4072
- providerMetadata?: SharedV2ProviderMetadata_2;
4073
- /**
4074
- Optional request information for telemetry and debugging purposes.
4075
- */
4076
- request?: {
4077
- /**
4078
- Request HTTP body that was sent to the provider API.
4079
- */
4080
- body?: unknown;
4081
- };
4082
- /**
4083
- Optional response information for telemetry and debugging purposes.
4084
- */
4085
- response?: LanguageModelV2ResponseMetadata_2 & {
4086
- /**
4087
- Response headers.
4088
- */
4089
- headers?: SharedV2Headers_2;
4090
- /**
4091
- Response HTTP body.
4092
- */
4093
- body?: unknown;
4094
- };
4095
- /**
4096
- Warnings for the call, e.g. unsupported settings.
4097
- */
4098
- warnings: Array<LanguageModelV2CallWarning_2>;
4099
- }>;
4100
- /**
4101
- Generates a language model output (streaming).
4102
-
4103
- Naming: "do" prefix to prevent accidental direct usage of the method
4104
- by the user.
4105
- *
4106
- @return A stream of higher-level language model output parts.
4107
- */
4108
- doStream(options: LanguageModelV2CallOptions_2): PromiseLike<{
4109
- stream: ReadableStream<LanguageModelV2StreamPart_2>;
4110
- /**
4111
- Optional request information for telemetry and debugging purposes.
4112
- */
4113
- request?: {
4114
- /**
4115
- Request HTTP body that was sent to the provider API.
4116
- */
4117
- body?: unknown;
4118
- };
4119
- /**
4120
- Optional response data.
4121
- */
4122
- response?: {
4123
- /**
4124
- Response headers.
4125
- */
4126
- headers?: SharedV2Headers_2;
4127
- };
4128
- }>;
4129
- };
4130
-
4131
3835
  declare type LanguageModelV2CallOptions = {
4132
3836
  /**
4133
3837
  A language mode prompt is a standardized prompt type.
@@ -4229,188 +3933,39 @@ declare type LanguageModelV2CallOptions = {
4229
3933
  providerOptions?: SharedV2ProviderOptions;
4230
3934
  };
4231
3935
 
4232
- declare type LanguageModelV2CallOptions_2 = {
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
+ };
3952
+
3953
+ declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
3954
+
3955
+ /**
3956
+ Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
3957
+ */
3958
+ declare type LanguageModelV2DataContent = Uint8Array | string | URL;
3959
+
3960
+ /**
3961
+ A file that has been generated by the model.
3962
+ Generated files as base64 encoded strings or binary data.
3963
+ The files should be returned without any unnecessary conversion.
3964
+ */
3965
+ declare type LanguageModelV2File = {
3966
+ type: 'file';
4233
3967
  /**
4234
- A language mode prompt is a standardized prompt type.
4235
-
4236
- Note: This is **not** the user-facing prompt. The AI SDK methods will map the
4237
- user-facing prompt types such as chat or instruction prompts to this format.
4238
- That approach allows us to evolve the user facing prompts without breaking
4239
- the language model interface.
4240
- */
4241
- prompt: LanguageModelV2Prompt_2;
4242
- /**
4243
- Maximum number of tokens to generate.
4244
- */
4245
- maxOutputTokens?: number;
4246
- /**
4247
- Temperature setting. The range depends on the provider and model.
4248
- */
4249
- temperature?: number;
4250
- /**
4251
- Stop sequences.
4252
- If set, the model will stop generating text when one of the stop sequences is generated.
4253
- Providers may have limits on the number of stop sequences.
4254
- */
4255
- stopSequences?: string[];
4256
- /**
4257
- Nucleus sampling.
4258
- */
4259
- topP?: number;
4260
- /**
4261
- Only sample from the top K options for each subsequent token.
4262
-
4263
- Used to remove "long tail" low probability responses.
4264
- Recommended for advanced use cases only. You usually only need to use temperature.
4265
- */
4266
- topK?: number;
4267
- /**
4268
- Presence penalty setting. It affects the likelihood of the model to
4269
- repeat information that is already in the prompt.
4270
- */
4271
- presencePenalty?: number;
4272
- /**
4273
- Frequency penalty setting. It affects the likelihood of the model
4274
- to repeatedly use the same words or phrases.
4275
- */
4276
- frequencyPenalty?: number;
4277
- /**
4278
- Response format. The output can either be text or JSON. Default is text.
4279
-
4280
- If JSON is selected, a schema can optionally be provided to guide the LLM.
4281
- */
4282
- responseFormat?: {
4283
- type: 'text';
4284
- } | {
4285
- type: 'json';
4286
- /**
4287
- * JSON schema that the generated output should conform to.
4288
- */
4289
- schema?: JSONSchema7;
4290
- /**
4291
- * Name of output that should be generated. Used by some providers for additional LLM guidance.
4292
- */
4293
- name?: string;
4294
- /**
4295
- * Description of the output that should be generated. Used by some providers for additional LLM guidance.
4296
- */
4297
- description?: string;
4298
- };
4299
- /**
4300
- The seed (integer) to use for random sampling. If set and supported
4301
- by the model, calls will generate deterministic results.
4302
- */
4303
- seed?: number;
4304
- /**
4305
- The tools that are available for the model.
4306
- */
4307
- tools?: Array<LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2>;
4308
- /**
4309
- Specifies how the tool should be selected. Defaults to 'auto'.
4310
- */
4311
- toolChoice?: LanguageModelV2ToolChoice_2;
4312
- /**
4313
- Include raw chunks in the stream. Only applicable for streaming calls.
4314
- */
4315
- includeRawChunks?: boolean;
4316
- /**
4317
- Abort signal for cancelling the operation.
4318
- */
4319
- abortSignal?: AbortSignal;
4320
- /**
4321
- Additional HTTP headers to be sent with the request.
4322
- Only applicable for HTTP-based providers.
4323
- */
4324
- headers?: Record<string, string | undefined>;
4325
- /**
4326
- * Additional provider-specific options. They are passed through
4327
- * to the provider from the AI SDK and enable provider-specific
4328
- * functionality that can be fully encapsulated in the provider.
4329
- */
4330
- providerOptions?: SharedV2ProviderOptions_2;
4331
- };
4332
-
4333
- /**
4334
- Warning from the model provider for this call. The call will proceed, but e.g.
4335
- some settings might not be supported, which can lead to suboptimal results.
4336
- */
4337
- declare type LanguageModelV2CallWarning = {
4338
- type: 'unsupported-setting';
4339
- setting: Omit<keyof LanguageModelV2CallOptions, 'prompt'>;
4340
- details?: string;
4341
- } | {
4342
- type: 'unsupported-tool';
4343
- tool: LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool;
4344
- details?: string;
4345
- } | {
4346
- type: 'other';
4347
- message: string;
4348
- };
4349
-
4350
- /**
4351
- Warning from the model provider for this call. The call will proceed, but e.g.
4352
- some settings might not be supported, which can lead to suboptimal results.
4353
- */
4354
- declare type LanguageModelV2CallWarning_2 = {
4355
- type: 'unsupported-setting';
4356
- setting: Omit<keyof LanguageModelV2CallOptions_2, 'prompt'>;
4357
- details?: string;
4358
- } | {
4359
- type: 'unsupported-tool';
4360
- tool: LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2;
4361
- details?: string;
4362
- } | {
4363
- type: 'other';
4364
- message: string;
4365
- };
4366
-
4367
- declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
4368
-
4369
- declare type LanguageModelV2Content_2 = LanguageModelV2Text_2 | LanguageModelV2Reasoning_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2;
4370
-
4371
- /**
4372
- Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
4373
- */
4374
- declare type LanguageModelV2DataContent = Uint8Array | string | URL;
4375
-
4376
- /**
4377
- Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
4378
- */
4379
- declare type LanguageModelV2DataContent_2 = Uint8Array | string | URL;
4380
-
4381
- /**
4382
- A file that has been generated by the model.
4383
- Generated files as base64 encoded strings or binary data.
4384
- The files should be returned without any unnecessary conversion.
4385
- */
4386
- declare type LanguageModelV2File = {
4387
- type: 'file';
4388
- /**
4389
- The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
4390
-
4391
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
4392
- */
4393
- mediaType: string;
4394
- /**
4395
- Generated file data as base64 encoded strings or binary data.
4396
-
4397
- The file data should be returned without any unnecessary conversion.
4398
- If the API returns base64 encoded strings, the file data should be returned
4399
- as base64 encoded strings. If the API returns binary data, the file data should
4400
- be returned as binary data.
4401
- */
4402
- data: string | Uint8Array;
4403
- };
4404
-
4405
- /**
4406
- A file that has been generated by the model.
4407
- Generated files as base64 encoded strings or binary data.
4408
- The files should be returned without any unnecessary conversion.
4409
- */
4410
- declare type LanguageModelV2File_2 = {
4411
- type: 'file';
4412
- /**
4413
- The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
3968
+ The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
4414
3969
 
4415
3970
  @see https://www.iana.org/assignments/media-types/media-types.xhtml
4416
3971
  */
@@ -4455,35 +4010,6 @@ declare interface LanguageModelV2FilePart {
4455
4010
  providerOptions?: SharedV2ProviderOptions;
4456
4011
  }
4457
4012
 
4458
- /**
4459
- File content part of a prompt. It contains a file.
4460
- */
4461
- declare interface LanguageModelV2FilePart_2 {
4462
- type: 'file';
4463
- /**
4464
- * Optional filename of the file.
4465
- */
4466
- filename?: string;
4467
- /**
4468
- File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
4469
- */
4470
- data: LanguageModelV2DataContent_2;
4471
- /**
4472
- IANA media type of the file.
4473
-
4474
- Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
4475
-
4476
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
4477
- */
4478
- mediaType: string;
4479
- /**
4480
- * Additional provider-specific options. They are passed through
4481
- * to the provider from the AI SDK and enable provider-specific
4482
- * functionality that can be fully encapsulated in the provider.
4483
- */
4484
- providerOptions?: SharedV2ProviderOptions_2;
4485
- }
4486
-
4487
4013
  /**
4488
4014
  Reason why a language model finished generating a response.
4489
4015
 
@@ -4498,20 +4024,6 @@ declare interface LanguageModelV2FilePart_2 {
4498
4024
  */
4499
4025
  declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4500
4026
 
4501
- /**
4502
- Reason why a language model finished generating a response.
4503
-
4504
- Can be one of the following:
4505
- - `stop`: model generated stop sequence
4506
- - `length`: model generated maximum number of tokens
4507
- - `content-filter`: content filter violation stopped the model
4508
- - `tool-calls`: model triggered tool calls
4509
- - `error`: model stopped because of an error
4510
- - `other`: model stopped for other reasons
4511
- - `unknown`: the model has not transmitted a finish reason
4512
- */
4513
- declare type LanguageModelV2FinishReason_2 = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4514
-
4515
4027
  /**
4516
4028
  A tool has a name, a description, and a set of parameters.
4517
4029
 
@@ -4543,37 +4055,6 @@ declare type LanguageModelV2FunctionTool = {
4543
4055
  providerOptions?: SharedV2ProviderOptions;
4544
4056
  };
4545
4057
 
4546
- /**
4547
- A tool has a name, a description, and a set of parameters.
4548
-
4549
- Note: this is **not** the user-facing tool definition. The AI SDK methods will
4550
- map the user-facing tool definitions to this format.
4551
- */
4552
- declare type LanguageModelV2FunctionTool_2 = {
4553
- /**
4554
- The type of the tool (always 'function').
4555
- */
4556
- type: 'function';
4557
- /**
4558
- The name of the tool. Unique within this model call.
4559
- */
4560
- name: string;
4561
- /**
4562
- A description of the tool. The language model uses this to understand the
4563
- tool's purpose and to provide better completion suggestions.
4564
- */
4565
- description?: string;
4566
- /**
4567
- The parameters that the tool expects. The language model uses this to
4568
- understand the tool's input requirements and to provide matching suggestions.
4569
- */
4570
- inputSchema: JSONSchema7;
4571
- /**
4572
- The provider-specific options for the tool.
4573
- */
4574
- providerOptions?: SharedV2ProviderOptions_2;
4575
- };
4576
-
4577
4058
  declare type LanguageModelV2Message = ({
4578
4059
  role: 'system';
4579
4060
  content: string;
@@ -4595,27 +4076,6 @@ declare type LanguageModelV2Message = ({
4595
4076
  providerOptions?: SharedV2ProviderOptions;
4596
4077
  };
4597
4078
 
4598
- declare type LanguageModelV2Message_2 = ({
4599
- role: 'system';
4600
- content: string;
4601
- } | {
4602
- role: 'user';
4603
- content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2>;
4604
- } | {
4605
- role: 'assistant';
4606
- content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2 | LanguageModelV2ReasoningPart_2 | LanguageModelV2ToolCallPart_2 | LanguageModelV2ToolResultPart_2>;
4607
- } | {
4608
- role: 'tool';
4609
- content: Array<LanguageModelV2ToolResultPart_2>;
4610
- }) & {
4611
- /**
4612
- * Additional provider-specific options. They are passed through
4613
- * to the provider from the AI SDK and enable provider-specific
4614
- * functionality that can be fully encapsulated in the provider.
4615
- */
4616
- providerOptions?: SharedV2ProviderOptions_2;
4617
- };
4618
-
4619
4079
  /**
4620
4080
  * Experimental middleware for LanguageModelV2.
4621
4081
  * This type defines the structure for middleware that can be used to modify
@@ -4631,21 +4091,21 @@ declare type LanguageModelV2Middleware = {
4631
4091
  * @param options.model - The language model instance.
4632
4092
  */
4633
4093
  overrideProvider?: (options: {
4634
- model: LanguageModelV2_2;
4094
+ model: LanguageModelV2;
4635
4095
  }) => string;
4636
4096
  /**
4637
4097
  * Override the model ID if desired.
4638
4098
  * @param options.model - The language model instance.
4639
4099
  */
4640
4100
  overrideModelId?: (options: {
4641
- model: LanguageModelV2_2;
4101
+ model: LanguageModelV2;
4642
4102
  }) => string;
4643
4103
  /**
4644
4104
  * Override the supported URLs if desired.
4645
4105
  * @param options.model - The language model instance.
4646
4106
  */
4647
4107
  overrideSupportedUrls?: (options: {
4648
- model: LanguageModelV2_2;
4108
+ model: LanguageModelV2;
4649
4109
  }) => PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
4650
4110
  /**
4651
4111
  * Transforms the parameters before they are passed to the language model.
@@ -4656,9 +4116,9 @@ declare type LanguageModelV2Middleware = {
4656
4116
  */
4657
4117
  transformParams?: (options: {
4658
4118
  type: 'generate' | 'stream';
4659
- params: LanguageModelV2CallOptions_2;
4660
- model: LanguageModelV2_2;
4661
- }) => PromiseLike<LanguageModelV2CallOptions_2>;
4119
+ params: LanguageModelV2CallOptions;
4120
+ model: LanguageModelV2;
4121
+ }) => PromiseLike<LanguageModelV2CallOptions>;
4662
4122
  /**
4663
4123
  * Wraps the generate operation of the language model.
4664
4124
  * @param options - Object containing the generate function, parameters, and model.
@@ -4670,11 +4130,11 @@ declare type LanguageModelV2Middleware = {
4670
4130
  * @returns A promise that resolves to the result of the generate operation.
4671
4131
  */
4672
4132
  wrapGenerate?: (options: {
4673
- doGenerate: () => ReturnType<LanguageModelV2_2['doGenerate']>;
4674
- doStream: () => ReturnType<LanguageModelV2_2['doStream']>;
4675
- params: LanguageModelV2CallOptions_2;
4676
- model: LanguageModelV2_2;
4677
- }) => 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']>>>;
4678
4138
  /**
4679
4139
  * Wraps the stream operation of the language model.
4680
4140
  *
@@ -4687,11 +4147,11 @@ declare type LanguageModelV2Middleware = {
4687
4147
  * @returns A promise that resolves to the result of the stream operation.
4688
4148
  */
4689
4149
  wrapStream?: (options: {
4690
- doGenerate: () => ReturnType<LanguageModelV2_2['doGenerate']>;
4691
- doStream: () => ReturnType<LanguageModelV2_2['doStream']>;
4692
- params: LanguageModelV2CallOptions_2;
4693
- model: LanguageModelV2_2;
4694
- }) => 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']>>>;
4695
4155
  };
4696
4156
 
4697
4157
  /**
@@ -4705,17 +4165,6 @@ declare type LanguageModelV2Middleware = {
4705
4165
  */
4706
4166
  declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
4707
4167
 
4708
- /**
4709
- A prompt is a list of messages.
4710
-
4711
- Note: Not all models and prompt formats support multi-modal inputs and
4712
- tool calls. The validation happens at runtime.
4713
-
4714
- Note: This is not a user-facing prompt. The AI SDK methods will map the
4715
- user-facing prompt types such as chat or instruction prompts to this format.
4716
- */
4717
- declare type LanguageModelV2Prompt_2 = Array<LanguageModelV2Message_2>;
4718
-
4719
4168
  /**
4720
4169
  The configuration of a tool that is defined by the provider.
4721
4170
  */
@@ -4738,28 +4187,6 @@ declare type LanguageModelV2ProviderDefinedTool = {
4738
4187
  args: Record<string, unknown>;
4739
4188
  };
4740
4189
 
4741
- /**
4742
- The configuration of a tool that is defined by the provider.
4743
- */
4744
- declare type LanguageModelV2ProviderDefinedTool_2 = {
4745
- /**
4746
- The type of the tool (always 'provider-defined').
4747
- */
4748
- type: 'provider-defined';
4749
- /**
4750
- The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`.
4751
- */
4752
- id: `${string}.${string}`;
4753
- /**
4754
- The name of the tool that the user must use in the tool set.
4755
- */
4756
- name: string;
4757
- /**
4758
- The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
4759
- */
4760
- args: Record<string, unknown>;
4761
- };
4762
-
4763
4190
  /**
4764
4191
  Reasoning that the model has generated.
4765
4192
  */
@@ -4772,68 +4199,24 @@ declare type LanguageModelV2Reasoning = {
4772
4199
  providerMetadata?: SharedV2ProviderMetadata;
4773
4200
  };
4774
4201
 
4775
- /**
4776
- Reasoning that the model has generated.
4777
- */
4778
- declare type LanguageModelV2Reasoning_2 = {
4779
- type: 'reasoning';
4780
- text: string;
4781
- /**
4782
- * Optional provider-specific metadata for the reasoning part.
4783
- */
4784
- providerMetadata?: SharedV2ProviderMetadata_2;
4785
- };
4786
-
4787
4202
  /**
4788
4203
  Reasoning content part of a prompt. It contains a string of reasoning text.
4789
4204
  */
4790
4205
  declare interface LanguageModelV2ReasoningPart {
4791
4206
  type: 'reasoning';
4792
4207
  /**
4793
- The reasoning text.
4794
- */
4795
- text: string;
4796
- /**
4797
- * Additional provider-specific options. They are passed through
4798
- * to the provider from the AI SDK and enable provider-specific
4799
- * functionality that can be fully encapsulated in the provider.
4800
- */
4801
- providerOptions?: SharedV2ProviderOptions;
4802
- }
4803
-
4804
- /**
4805
- Reasoning content part of a prompt. It contains a string of reasoning text.
4806
- */
4807
- declare interface LanguageModelV2ReasoningPart_2 {
4808
- type: 'reasoning';
4809
- /**
4810
- The reasoning text.
4811
- */
4812
- text: string;
4813
- /**
4814
- * Additional provider-specific options. They are passed through
4815
- * to the provider from the AI SDK and enable provider-specific
4816
- * functionality that can be fully encapsulated in the provider.
4817
- */
4818
- providerOptions?: SharedV2ProviderOptions_2;
4819
- }
4820
-
4821
- declare interface LanguageModelV2ResponseMetadata {
4822
- /**
4823
- ID for the generated response, if the provider sends one.
4824
- */
4825
- id?: string;
4826
- /**
4827
- Timestamp for the start of the generated response, if the provider sends one.
4208
+ The reasoning text.
4828
4209
  */
4829
- timestamp?: Date;
4210
+ text: string;
4830
4211
  /**
4831
- The ID of the response model that was used to generate the response, if the provider sends one.
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.
4832
4215
  */
4833
- modelId?: string;
4216
+ providerOptions?: SharedV2ProviderOptions;
4834
4217
  }
4835
4218
 
4836
- declare interface LanguageModelV2ResponseMetadata_2 {
4219
+ declare interface LanguageModelV2ResponseMetadata {
4837
4220
  /**
4838
4221
  ID for the generated response, if the provider sends one.
4839
4222
  */
@@ -4901,59 +4284,6 @@ declare type LanguageModelV2Source = {
4901
4284
  providerMetadata?: SharedV2ProviderMetadata;
4902
4285
  };
4903
4286
 
4904
- /**
4905
- A source that has been used as input to generate the response.
4906
- */
4907
- declare type LanguageModelV2Source_2 = {
4908
- type: 'source';
4909
- /**
4910
- * The type of source - URL sources reference web content.
4911
- */
4912
- sourceType: 'url';
4913
- /**
4914
- * The ID of the source.
4915
- */
4916
- id: string;
4917
- /**
4918
- * The URL of the source.
4919
- */
4920
- url: string;
4921
- /**
4922
- * The title of the source.
4923
- */
4924
- title?: string;
4925
- /**
4926
- * Additional provider metadata for the source.
4927
- */
4928
- providerMetadata?: SharedV2ProviderMetadata_2;
4929
- } | {
4930
- type: 'source';
4931
- /**
4932
- * The type of source - document sources reference files/documents.
4933
- */
4934
- sourceType: 'document';
4935
- /**
4936
- * The ID of the source.
4937
- */
4938
- id: string;
4939
- /**
4940
- * IANA media type of the document (e.g., 'application/pdf').
4941
- */
4942
- mediaType: string;
4943
- /**
4944
- * The title of the document.
4945
- */
4946
- title: string;
4947
- /**
4948
- * Optional filename of the document.
4949
- */
4950
- filename?: string;
4951
- /**
4952
- * Additional provider metadata for the source.
4953
- */
4954
- providerMetadata?: SharedV2ProviderMetadata_2;
4955
- };
4956
-
4957
4287
  declare type LanguageModelV2StreamPart = {
4958
4288
  type: 'text-start';
4959
4289
  providerMetadata?: SharedV2ProviderMetadata;
@@ -5013,65 +4343,6 @@ declare type LanguageModelV2StreamPart = {
5013
4343
  error: unknown;
5014
4344
  };
5015
4345
 
5016
- declare type LanguageModelV2StreamPart_2 = {
5017
- type: 'text-start';
5018
- providerMetadata?: SharedV2ProviderMetadata_2;
5019
- id: string;
5020
- } | {
5021
- type: 'text-delta';
5022
- id: string;
5023
- providerMetadata?: SharedV2ProviderMetadata_2;
5024
- delta: string;
5025
- } | {
5026
- type: 'text-end';
5027
- providerMetadata?: SharedV2ProviderMetadata_2;
5028
- id: string;
5029
- } | {
5030
- type: 'reasoning-start';
5031
- providerMetadata?: SharedV2ProviderMetadata_2;
5032
- id: string;
5033
- } | {
5034
- type: 'reasoning-delta';
5035
- id: string;
5036
- providerMetadata?: SharedV2ProviderMetadata_2;
5037
- delta: string;
5038
- } | {
5039
- type: 'reasoning-end';
5040
- id: string;
5041
- providerMetadata?: SharedV2ProviderMetadata_2;
5042
- } | {
5043
- type: 'tool-input-start';
5044
- id: string;
5045
- toolName: string;
5046
- providerMetadata?: SharedV2ProviderMetadata_2;
5047
- providerExecuted?: boolean;
5048
- } | {
5049
- type: 'tool-input-delta';
5050
- id: string;
5051
- delta: string;
5052
- providerMetadata?: SharedV2ProviderMetadata_2;
5053
- } | {
5054
- type: 'tool-input-end';
5055
- id: string;
5056
- providerMetadata?: SharedV2ProviderMetadata_2;
5057
- } | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | {
5058
- type: 'stream-start';
5059
- warnings: Array<LanguageModelV2CallWarning_2>;
5060
- } | ({
5061
- type: 'response-metadata';
5062
- } & LanguageModelV2ResponseMetadata_2) | {
5063
- type: 'finish';
5064
- usage: LanguageModelV2Usage_2;
5065
- finishReason: LanguageModelV2FinishReason_2;
5066
- providerMetadata?: SharedV2ProviderMetadata_2;
5067
- } | {
5068
- type: 'raw';
5069
- rawValue: unknown;
5070
- } | {
5071
- type: 'error';
5072
- error: unknown;
5073
- };
5074
-
5075
4346
  /**
5076
4347
  Text that the model has generated.
5077
4348
  */
@@ -5084,18 +4355,6 @@ declare type LanguageModelV2Text = {
5084
4355
  providerMetadata?: SharedV2ProviderMetadata;
5085
4356
  };
5086
4357
 
5087
- /**
5088
- Text that the model has generated.
5089
- */
5090
- declare type LanguageModelV2Text_2 = {
5091
- type: 'text';
5092
- /**
5093
- The text content.
5094
- */
5095
- text: string;
5096
- providerMetadata?: SharedV2ProviderMetadata_2;
5097
- };
5098
-
5099
4358
  /**
5100
4359
  Text content part of a prompt. It contains a string of text.
5101
4360
  */
@@ -5113,23 +4372,6 @@ declare interface LanguageModelV2TextPart {
5113
4372
  providerOptions?: SharedV2ProviderOptions;
5114
4373
  }
5115
4374
 
5116
- /**
5117
- Text content part of a prompt. It contains a string of text.
5118
- */
5119
- declare interface LanguageModelV2TextPart_2 {
5120
- type: 'text';
5121
- /**
5122
- The text content.
5123
- */
5124
- text: string;
5125
- /**
5126
- * Additional provider-specific options. They are passed through
5127
- * to the provider from the AI SDK and enable provider-specific
5128
- * functionality that can be fully encapsulated in the provider.
5129
- */
5130
- providerOptions?: SharedV2ProviderOptions_2;
5131
- }
5132
-
5133
4375
  /**
5134
4376
  * Tool calls that the model has generated.
5135
4377
  */
@@ -5159,29 +4401,6 @@ declare type LanguageModelV2ToolCall = {
5159
4401
  providerMetadata?: SharedV2ProviderMetadata;
5160
4402
  };
5161
4403
 
5162
- /**
5163
- Tool calls that the model has generated.
5164
- */
5165
- declare type LanguageModelV2ToolCall_2 = {
5166
- type: 'tool-call';
5167
- toolCallId: string;
5168
- toolName: string;
5169
- /**
5170
- Stringified JSON object with the tool call arguments. Must match the
5171
- parameters schema of the tool.
5172
- */
5173
- input: string;
5174
- /**
5175
- * Whether the tool call will be executed by the provider.
5176
- * If this flag is not set or is false, the tool call will be executed by the client.
5177
- */
5178
- providerExecuted?: boolean;
5179
- /**
5180
- * Additional provider-specific metadata for the tool call.
5181
- */
5182
- providerMetadata?: SharedV2ProviderMetadata_2;
5183
- };
5184
-
5185
4404
  /**
5186
4405
  Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
5187
4406
  */
@@ -5212,36 +4431,6 @@ declare interface LanguageModelV2ToolCallPart {
5212
4431
  providerOptions?: SharedV2ProviderOptions;
5213
4432
  }
5214
4433
 
5215
- /**
5216
- Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
5217
- */
5218
- declare interface LanguageModelV2ToolCallPart_2 {
5219
- type: 'tool-call';
5220
- /**
5221
- ID of the tool call. This ID is used to match the tool call with the tool result.
5222
- */
5223
- toolCallId: string;
5224
- /**
5225
- Name of the tool that is being called.
5226
- */
5227
- toolName: string;
5228
- /**
5229
- Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
5230
- */
5231
- input: unknown;
5232
- /**
5233
- * Whether the tool call will be executed by the provider.
5234
- * If this flag is not set or is false, the tool call will be executed by the client.
5235
- */
5236
- providerExecuted?: boolean;
5237
- /**
5238
- * Additional provider-specific options. They are passed through
5239
- * to the provider from the AI SDK and enable provider-specific
5240
- * functionality that can be fully encapsulated in the provider.
5241
- */
5242
- providerOptions?: SharedV2ProviderOptions_2;
5243
- }
5244
-
5245
4434
  declare type LanguageModelV2ToolChoice = {
5246
4435
  type: 'auto';
5247
4436
  } | {
@@ -5253,17 +4442,6 @@ declare type LanguageModelV2ToolChoice = {
5253
4442
  toolName: string;
5254
4443
  };
5255
4444
 
5256
- declare type LanguageModelV2ToolChoice_2 = {
5257
- type: 'auto';
5258
- } | {
5259
- type: 'none';
5260
- } | {
5261
- type: 'required';
5262
- } | {
5263
- type: 'tool';
5264
- toolName: string;
5265
- };
5266
-
5267
4445
  /**
5268
4446
  Result of a tool call that has been executed by the provider.
5269
4447
  */
@@ -5289,93 +4467,26 @@ declare type LanguageModelV2ToolResult = {
5289
4467
  * Whether the tool result was generated by the provider.
5290
4468
  * If this flag is set to true, the tool result was generated by the provider.
5291
4469
  * If this flag is not set or is false, the tool result was generated by the client.
5292
- */
5293
- providerExecuted?: boolean;
5294
- /**
5295
- * Additional provider-specific metadata for the tool result.
5296
- */
5297
- providerMetadata?: SharedV2ProviderMetadata;
5298
- };
5299
-
5300
- /**
5301
- Result of a tool call that has been executed by the provider.
5302
- */
5303
- declare type LanguageModelV2ToolResult_2 = {
5304
- type: 'tool-result';
5305
- /**
5306
- * The ID of the tool call that this result is associated with.
5307
- */
5308
- toolCallId: string;
5309
- /**
5310
- * Name of the tool that generated this result.
5311
- */
5312
- toolName: string;
5313
- /**
5314
- * Result of the tool call. This is a JSON-serializable object.
5315
- */
5316
- result: unknown;
5317
- /**
5318
- * Optional flag if the result is an error or an error message.
5319
- */
5320
- isError?: boolean;
5321
- /**
5322
- * Whether the tool result was generated by the provider.
5323
- * If this flag is set to true, the tool result was generated by the provider.
5324
- * If this flag is not set or is false, the tool result was generated by the client.
5325
- */
5326
- providerExecuted?: boolean;
5327
- /**
5328
- * Additional provider-specific metadata for the tool result.
5329
- */
5330
- providerMetadata?: SharedV2ProviderMetadata_2;
5331
- };
5332
-
5333
- declare type LanguageModelV2ToolResultOutput = {
5334
- type: 'text';
5335
- value: string;
5336
- } | {
5337
- type: 'json';
5338
- value: JSONValue_2;
5339
- } | {
5340
- type: 'error-text';
5341
- value: string;
5342
- } | {
5343
- type: 'error-json';
5344
- value: JSONValue_2;
5345
- } | {
5346
- type: 'content';
5347
- value: Array<{
5348
- type: 'text';
5349
- /**
5350
- Text content.
5351
- */
5352
- text: string;
5353
- } | {
5354
- type: 'media';
5355
- /**
5356
- Base-64 encoded media data.
5357
- */
5358
- data: string;
5359
- /**
5360
- IANA media type.
5361
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
5362
- */
5363
- mediaType: string;
5364
- }>;
4470
+ */
4471
+ providerExecuted?: boolean;
4472
+ /**
4473
+ * Additional provider-specific metadata for the tool result.
4474
+ */
4475
+ providerMetadata?: SharedV2ProviderMetadata;
5365
4476
  };
5366
4477
 
5367
- declare type LanguageModelV2ToolResultOutput_2 = {
4478
+ declare type LanguageModelV2ToolResultOutput = {
5368
4479
  type: 'text';
5369
4480
  value: string;
5370
4481
  } | {
5371
4482
  type: 'json';
5372
- value: JSONValue_3;
4483
+ value: JSONValue_2;
5373
4484
  } | {
5374
4485
  type: 'error-text';
5375
4486
  value: string;
5376
4487
  } | {
5377
4488
  type: 'error-json';
5378
- value: JSONValue_3;
4489
+ value: JSONValue_2;
5379
4490
  } | {
5380
4491
  type: 'content';
5381
4492
  value: Array<{
@@ -5423,31 +4534,6 @@ declare interface LanguageModelV2ToolResultPart {
5423
4534
  providerOptions?: SharedV2ProviderOptions;
5424
4535
  }
5425
4536
 
5426
- /**
5427
- Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
5428
- */
5429
- declare interface LanguageModelV2ToolResultPart_2 {
5430
- type: 'tool-result';
5431
- /**
5432
- ID of the tool call that this result is associated with.
5433
- */
5434
- toolCallId: string;
5435
- /**
5436
- Name of the tool that generated this result.
5437
- */
5438
- toolName: string;
5439
- /**
5440
- Result of the tool call.
5441
- */
5442
- output: LanguageModelV2ToolResultOutput_2;
5443
- /**
5444
- * Additional provider-specific options. They are passed through
5445
- * to the provider from the AI SDK and enable provider-specific
5446
- * functionality that can be fully encapsulated in the provider.
5447
- */
5448
- providerOptions?: SharedV2ProviderOptions_2;
5449
- }
5450
-
5451
4537
  /**
5452
4538
  Usage information for a language model call.
5453
4539
 
@@ -5479,37 +4565,6 @@ declare type LanguageModelV2Usage = {
5479
4565
  cachedInputTokens?: number | undefined;
5480
4566
  };
5481
4567
 
5482
- /**
5483
- Usage information for a language model call.
5484
-
5485
- If your API return additional usage information, you can add it to the
5486
- provider metadata under your provider's key.
5487
- */
5488
- declare type LanguageModelV2Usage_2 = {
5489
- /**
5490
- The number of input (prompt) tokens used.
5491
- */
5492
- inputTokens: number | undefined;
5493
- /**
5494
- The number of output (completion) tokens used.
5495
- */
5496
- outputTokens: number | undefined;
5497
- /**
5498
- The total number of tokens as reported by the provider.
5499
- This number might be different from the sum of `inputTokens` and `outputTokens`
5500
- and e.g. include reasoning tokens or other overhead.
5501
- */
5502
- totalTokens: number | undefined;
5503
- /**
5504
- The number of reasoning tokens used.
5505
- */
5506
- reasoningTokens?: number | undefined;
5507
- /**
5508
- The number of cached input tokens.
5509
- */
5510
- cachedInputTokens?: number | undefined;
5511
- };
5512
-
5513
4568
  /**
5514
4569
  Check if the message is an assistant message with completed tool calls.
5515
4570
  The last step of the message must have at least one tool invocation and
@@ -5738,7 +4793,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
5738
4793
  Thrown when no output type is specified and output-related methods are called.
5739
4794
  */
5740
4795
  export declare class NoOutputSpecifiedError extends AISDKError {
5741
- private readonly [symbol$7_3];
4796
+ private readonly [symbol$7_2];
5742
4797
  constructor({ message }?: {
5743
4798
  message?: string;
5744
4799
  });
@@ -5778,7 +4833,7 @@ export declare class NoSuchModelError extends AISDKError {
5778
4833
  }
5779
4834
 
5780
4835
  export declare class NoSuchProviderError extends NoSuchModelError {
5781
- private readonly [symbol_2];
4836
+ private readonly [symbol_3];
5782
4837
  readonly providerId: string;
5783
4838
  readonly availableProviders: string[];
5784
4839
  constructor({ modelId, modelType, providerId, availableProviders, message, }: {
@@ -5792,7 +4847,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
5792
4847
  }
5793
4848
 
5794
4849
  export declare class NoSuchToolError extends AISDKError {
5795
- private readonly [symbol$d_3];
4850
+ private readonly [symbol$d_2];
5796
4851
  readonly toolName: string;
5797
4852
  readonly availableTools: string[] | undefined;
5798
4853
  constructor({ toolName, availableTools, message, }: {
@@ -5830,7 +4885,7 @@ export declare namespace Output {
5830
4885
 
5831
4886
  declare interface Output_2<OUTPUT, PARTIAL> {
5832
4887
  readonly type: 'object' | 'text';
5833
- responseFormat: LanguageModelV2CallOptions_2['responseFormat'];
4888
+ responseFormat: LanguageModelV2CallOptions['responseFormat'];
5834
4889
  parsePartial(options: {
5835
4890
  text: string;
5836
4891
  }): Promise<{
@@ -6020,7 +5075,7 @@ export declare function parseJsonEventStream<T>({ stream, schema, }: {
6020
5075
  }): ReadableStream<ParseResult<T>>;
6021
5076
 
6022
5077
  export declare function parsePartialJson(jsonText: string | undefined): Promise<{
6023
- value: JSONValue_3 | undefined;
5078
+ value: JSONValue_2 | undefined;
6024
5079
  state: 'undefined-input' | 'successful-parse' | 'repaired-parse' | 'failed-parse';
6025
5080
  }>;
6026
5081
 
@@ -6036,7 +5091,7 @@ declare type ParseResult<T> = {
6036
5091
  rawValue: unknown;
6037
5092
  } | {
6038
5093
  success: false;
6039
- error: JSONParseError_2 | TypeValidationError_2;
5094
+ error: JSONParseError | TypeValidationError;
6040
5095
  rawValue: unknown;
6041
5096
  };
6042
5097
 
@@ -6200,7 +5255,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
6200
5255
  url: string;
6201
5256
  headers?: Record<string, string | undefined>;
6202
5257
  formData: FormData;
6203
- failedResponseHandler: ResponseHandler<APICallError_2>;
5258
+ failedResponseHandler: ResponseHandler<APICallError>;
6204
5259
  successfulResponseHandler: ResponseHandler<T>;
6205
5260
  abortSignal?: AbortSignal;
6206
5261
  fetch?: FetchFunction;
@@ -6214,7 +5269,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
6214
5269
  url: string;
6215
5270
  headers?: Record<string, string | undefined>;
6216
5271
  body: unknown;
6217
- failedResponseHandler: ResponseHandler<APICallError_2>;
5272
+ failedResponseHandler: ResponseHandler<APICallError>;
6218
5273
  successfulResponseHandler: ResponseHandler<T>;
6219
5274
  abortSignal?: AbortSignal;
6220
5275
  fetch?: FetchFunction;
@@ -6403,7 +5458,7 @@ declare type ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS exte
6403
5458
  This is needed to enable provider-specific functionality that can be
6404
5459
  fully encapsulated in the provider.
6405
5460
  */
6406
- export declare type ProviderMetadata = SharedV2ProviderMetadata_2;
5461
+ export declare type ProviderMetadata = SharedV2ProviderMetadata;
6407
5462
 
6408
5463
  /**
6409
5464
  Additional provider-specific options.
@@ -6413,17 +5468,17 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata_2;
6413
5468
  */
6414
5469
  declare type ProviderOptions = SharedV2ProviderOptions;
6415
5470
 
6416
- export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2_2> = Record<string, ProviderV2_2>, SEPARATOR extends string = ':'> {
6417
- languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2_2;
6418
- languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): LanguageModelV2_2;
6419
- textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never): EmbeddingModelV2_2<string>;
6420
- textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): EmbeddingModelV2_2<string>;
6421
- imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never): ImageModelV2_2;
6422
- imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): ImageModelV2_2;
6423
- transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never): TranscriptionModelV2_2;
6424
- transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): TranscriptionModelV2_2;
6425
- speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never): SpeechModelV2_2;
6426
- 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;
6427
5482
  }
6428
5483
 
6429
5484
  /**
@@ -6481,61 +5536,6 @@ declare interface ProviderV2 {
6481
5536
  speechModel?(modelId: string): SpeechModelV2;
6482
5537
  }
6483
5538
 
6484
- /**
6485
- * Provider for language, text embedding, and image generation models.
6486
- */
6487
- declare interface ProviderV2_2 {
6488
- /**
6489
- Returns the language model with the given id.
6490
- The model id is then passed to the provider function to get the model.
6491
-
6492
- @param {string} modelId - The id of the model to return.
6493
-
6494
- @returns {LanguageModel} The language model associated with the id
6495
-
6496
- @throws {NoSuchModelError} If no such model exists.
6497
- */
6498
- languageModel(modelId: string): LanguageModelV2_2;
6499
- /**
6500
- Returns the text embedding model with the given id.
6501
- The model id is then passed to the provider function to get the model.
6502
-
6503
- @param {string} modelId - The id of the model to return.
6504
-
6505
- @returns {LanguageModel} The language model associated with the id
6506
-
6507
- @throws {NoSuchModelError} If no such model exists.
6508
- */
6509
- textEmbeddingModel(modelId: string): EmbeddingModelV2_2<string>;
6510
- /**
6511
- Returns the image model with the given id.
6512
- The model id is then passed to the provider function to get the model.
6513
-
6514
- @param {string} modelId - The id of the model to return.
6515
-
6516
- @returns {ImageModel} The image model associated with the id
6517
- */
6518
- imageModel(modelId: string): ImageModelV2_2;
6519
- /**
6520
- Returns the transcription model with the given id.
6521
- The model id is then passed to the provider function to get the model.
6522
-
6523
- @param {string} modelId - The id of the model to return.
6524
-
6525
- @returns {TranscriptionModel} The transcription model associated with the id
6526
- */
6527
- transcriptionModel?(modelId: string): TranscriptionModelV2_2;
6528
- /**
6529
- Returns the speech model with the given id.
6530
- The model id is then passed to the provider function to get the model.
6531
-
6532
- @param {string} modelId - The id of the model to return.
6533
-
6534
- @returns {SpeechModel} The speech model associated with the id
6535
- */
6536
- speechModel?(modelId: string): SpeechModelV2_2;
6537
- }
6538
-
6539
5539
  /**
6540
5540
  * Prunes model messages from a list of model messages.
6541
5541
  *
@@ -6556,6 +5556,25 @@ export declare function pruneMessages({ messages, reasoning, toolCalls, emptyMes
6556
5556
  emptyMessages?: 'keep' | 'remove';
6557
5557
  }): ModelMessage[];
6558
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
+
6559
5578
  /**
6560
5579
  * Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
6561
5580
  *
@@ -6670,7 +5689,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
6670
5689
  declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
6671
5690
 
6672
5691
  export declare class RetryError extends AISDKError {
6673
- private readonly [symbol$1_3];
5692
+ private readonly [symbol$1_2];
6674
5693
  readonly reason: RetryErrorReason;
6675
5694
  readonly lastError: unknown;
6676
5695
  readonly errors: Array<unknown>;
@@ -6726,7 +5745,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
6726
5745
  rawValue: unknown;
6727
5746
  } | {
6728
5747
  success: false;
6729
- error: TypeValidationError_2;
5748
+ error: TypeValidationError;
6730
5749
  rawValue: unknown;
6731
5750
  }>;
6732
5751
 
@@ -6783,8 +5802,6 @@ export declare class SerialJobExecutor {
6783
5802
 
6784
5803
  declare type SharedV2Headers = Record<string, string>;
6785
5804
 
6786
- declare type SharedV2Headers_2 = Record<string, string>;
6787
-
6788
5805
  /**
6789
5806
  * Additional provider-specific metadata.
6790
5807
  * Metadata are additional outputs from the provider.
@@ -6808,29 +5825,6 @@ declare type SharedV2Headers_2 = Record<string, string>;
6808
5825
  */
6809
5826
  declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
6810
5827
 
6811
- /**
6812
- * Additional provider-specific metadata.
6813
- * Metadata are additional outputs from the provider.
6814
- * They are passed through to the provider from the AI SDK
6815
- * and enable provider-specific functionality
6816
- * that can be fully encapsulated in the provider.
6817
- *
6818
- * This enables us to quickly ship provider-specific functionality
6819
- * without affecting the core AI SDK.
6820
- *
6821
- * The outer record is keyed by the provider name, and the inner
6822
- * record is keyed by the provider-specific metadata key.
6823
- *
6824
- * ```ts
6825
- * {
6826
- * "anthropic": {
6827
- * "cacheControl": { "type": "ephemeral" }
6828
- * }
6829
- * }
6830
- * ```
6831
- */
6832
- declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValue_3>>;
6833
-
6834
5828
  /**
6835
5829
  * Additional provider-specific options.
6836
5830
  * Options are additional input to the provider.
@@ -6854,29 +5848,6 @@ declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValu
6854
5848
  */
6855
5849
  declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
6856
5850
 
6857
- /**
6858
- * Additional provider-specific options.
6859
- * Options are additional input to the provider.
6860
- * They are passed through to the provider from the AI SDK
6861
- * and enable provider-specific functionality
6862
- * that can be fully encapsulated in the provider.
6863
- *
6864
- * This enables us to quickly ship provider-specific functionality
6865
- * without affecting the core AI SDK.
6866
- *
6867
- * The outer record is keyed by the provider name, and the inner
6868
- * record is keyed by the provider-specific metadata key.
6869
- *
6870
- * ```ts
6871
- * {
6872
- * "anthropic": {
6873
- * "cacheControl": { "type": "ephemeral" }
6874
- * }
6875
- * }
6876
- * ```
6877
- */
6878
- declare type SharedV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
6879
-
6880
5851
  /**
6881
5852
  * Creates a ReadableStream that emits the provided values with an optional delay between each value.
6882
5853
  *
@@ -6956,7 +5927,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
6956
5927
  file: GeneratedFile;
6957
5928
  } | {
6958
5929
  type: 'stream-start';
6959
- warnings: LanguageModelV2CallWarning_2[];
5930
+ warnings: LanguageModelV2CallWarning[];
6960
5931
  } | {
6961
5932
  type: 'response-metadata';
6962
5933
  id?: string;
@@ -6999,7 +5970,7 @@ export declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunkin
6999
5970
  /**
7000
5971
  A source that has been used as input to generate the response.
7001
5972
  */
7002
- declare type Source = LanguageModelV2Source_2;
5973
+ declare type Source = LanguageModelV2Source;
7003
5974
 
7004
5975
  /**
7005
5976
  * A document source part of a message.
@@ -7301,106 +6272,31 @@ declare enum SpanStatusCode {
7301
6272
  /**
7302
6273
  Speech model that is used by the AI SDK Core functions.
7303
6274
  */
7304
- export declare type SpeechModel = SpeechModelV2_2;
6275
+ export declare type SpeechModel = SpeechModelV2;
7305
6276
 
7306
6277
  export declare type SpeechModelResponseMetadata = {
7307
6278
  /**
7308
6279
  Timestamp for the start of the generated response.
7309
6280
  */
7310
- timestamp: Date;
7311
- /**
7312
- The ID of the response model that was used to generate the response.
7313
- */
7314
- modelId: string;
7315
- /**
7316
- Response headers.
7317
- */
7318
- headers?: Record<string, string>;
7319
- /**
7320
- Response body.
7321
- */
7322
- body?: unknown;
7323
- };
7324
-
7325
- /**
7326
- * Speech model specification version 2.
7327
- */
7328
- declare type SpeechModelV2 = {
7329
- /**
7330
- * The speech model must specify which speech model interface
7331
- * version it implements. This will allow us to evolve the speech
7332
- * model interface and retain backwards compatibility. The different
7333
- * implementation versions can be handled as a discriminated union
7334
- * on our side.
7335
- */
7336
- readonly specificationVersion: 'v2';
7337
- /**
7338
- * Name of the provider for logging purposes.
7339
- */
7340
- readonly provider: string;
7341
- /**
7342
- * Provider-specific model ID for logging purposes.
7343
- */
7344
- readonly modelId: string;
7345
- /**
7346
- * Generates speech audio from text.
7347
- */
7348
- doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
7349
- /**
7350
- * Generated audio as an ArrayBuffer.
7351
- * The audio should be returned without any unnecessary conversion.
7352
- * If the API returns base64 encoded strings, the audio should be returned
7353
- * as base64 encoded strings. If the API returns binary data, the audio
7354
- * should be returned as binary data.
7355
- */
7356
- audio: string | Uint8Array;
7357
- /**
7358
- * Warnings for the call, e.g. unsupported settings.
7359
- */
7360
- warnings: Array<SpeechModelV2CallWarning>;
7361
- /**
7362
- * Optional request information for telemetry and debugging purposes.
7363
- */
7364
- request?: {
7365
- /**
7366
- * Response body (available only for providers that use HTTP requests).
7367
- */
7368
- body?: unknown;
7369
- };
7370
- /**
7371
- * Response information for telemetry and debugging purposes.
7372
- */
7373
- response: {
7374
- /**
7375
- * Timestamp for the start of the generated response.
7376
- */
7377
- timestamp: Date;
7378
- /**
7379
- * The ID of the response model that was used to generate the response.
7380
- */
7381
- modelId: string;
7382
- /**
7383
- * Response headers.
7384
- */
7385
- headers?: SharedV2Headers;
7386
- /**
7387
- * Response body.
7388
- */
7389
- body?: unknown;
7390
- };
7391
- /**
7392
- * Additional provider-specific metadata. They are passed through
7393
- * from the provider to the AI SDK and enable provider-specific
7394
- * results that can be fully encapsulated in the provider.
7395
- */
7396
- providerMetadata?: Record<string, Record<string, JSONValue_2>>;
7397
- }>;
6281
+ timestamp: Date;
6282
+ /**
6283
+ The ID of the response model that was used to generate the response.
6284
+ */
6285
+ modelId: string;
6286
+ /**
6287
+ Response headers.
6288
+ */
6289
+ headers?: Record<string, string>;
6290
+ /**
6291
+ Response body.
6292
+ */
6293
+ body?: unknown;
7398
6294
  };
7399
6295
 
7400
6296
  /**
7401
6297
  * Speech model specification version 2.
7402
6298
  */
7403
- declare type SpeechModelV2_2 = {
6299
+ declare type SpeechModelV2 = {
7404
6300
  /**
7405
6301
  * The speech model must specify which speech model interface
7406
6302
  * version it implements. This will allow us to evolve the speech
@@ -7420,7 +6316,7 @@ declare type SpeechModelV2_2 = {
7420
6316
  /**
7421
6317
  * Generates speech audio from text.
7422
6318
  */
7423
- doGenerate(options: SpeechModelV2CallOptions_2): PromiseLike<{
6319
+ doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
7424
6320
  /**
7425
6321
  * Generated audio as an ArrayBuffer.
7426
6322
  * The audio should be returned without any unnecessary conversion.
@@ -7432,7 +6328,7 @@ declare type SpeechModelV2_2 = {
7432
6328
  /**
7433
6329
  * Warnings for the call, e.g. unsupported settings.
7434
6330
  */
7435
- warnings: Array<SpeechModelV2CallWarning_2>;
6331
+ warnings: Array<SpeechModelV2CallWarning>;
7436
6332
  /**
7437
6333
  * Optional request information for telemetry and debugging purposes.
7438
6334
  */
@@ -7457,7 +6353,7 @@ declare type SpeechModelV2_2 = {
7457
6353
  /**
7458
6354
  * Response headers.
7459
6355
  */
7460
- headers?: SharedV2Headers_2;
6356
+ headers?: SharedV2Headers;
7461
6357
  /**
7462
6358
  * Response body.
7463
6359
  */
@@ -7468,7 +6364,7 @@ declare type SpeechModelV2_2 = {
7468
6364
  * from the provider to the AI SDK and enable provider-specific
7469
6365
  * results that can be fully encapsulated in the provider.
7470
6366
  */
7471
- providerMetadata?: Record<string, Record<string, JSONValue_3>>;
6367
+ providerMetadata?: Record<string, Record<string, JSONValue_2>>;
7472
6368
  }>;
7473
6369
  };
7474
6370
 
@@ -7523,57 +6419,6 @@ declare type SpeechModelV2CallOptions = {
7523
6419
  headers?: Record<string, string | undefined>;
7524
6420
  };
7525
6421
 
7526
- declare type SpeechModelV2CallOptions_2 = {
7527
- /**
7528
- * Text to convert to speech.
7529
- */
7530
- text: string;
7531
- /**
7532
- * The voice to use for speech synthesis.
7533
- * This is provider-specific and may be a voice ID, name, or other identifier.
7534
- */
7535
- voice?: string;
7536
- /**
7537
- * The desired output format for the audio e.g. "mp3", "wav", etc.
7538
- */
7539
- outputFormat?: string;
7540
- /**
7541
- * Instructions for the speech generation e.g. "Speak in a slow and steady tone".
7542
- */
7543
- instructions?: string;
7544
- /**
7545
- * The speed of the speech generation.
7546
- */
7547
- speed?: number;
7548
- /**
7549
- * The language for speech generation. This should be an ISO 639-1 language code (e.g. "en", "es", "fr")
7550
- * or "auto" for automatic language detection. Provider support varies.
7551
- */
7552
- language?: string;
7553
- /**
7554
- * Additional provider-specific options that are passed through to the provider
7555
- * as body parameters.
7556
- *
7557
- * The outer record is keyed by the provider name, and the inner
7558
- * record is keyed by the provider-specific metadata key.
7559
- * ```ts
7560
- * {
7561
- * "openai": {}
7562
- * }
7563
- * ```
7564
- */
7565
- providerOptions?: SpeechModelV2ProviderOptions_2;
7566
- /**
7567
- * Abort signal for cancelling the operation.
7568
- */
7569
- abortSignal?: AbortSignal;
7570
- /**
7571
- * Additional HTTP headers to be sent with the request.
7572
- * Only applicable for HTTP-based providers.
7573
- */
7574
- headers?: Record<string, string | undefined>;
7575
- };
7576
-
7577
6422
  /**
7578
6423
  * Warning from the model provider for this call. The call will proceed, but e.g.
7579
6424
  * some settings might not be supported, which can lead to suboptimal results.
@@ -7587,28 +6432,13 @@ declare type SpeechModelV2CallWarning = {
7587
6432
  message: string;
7588
6433
  };
7589
6434
 
7590
- /**
7591
- * Warning from the model provider for this call. The call will proceed, but e.g.
7592
- * some settings might not be supported, which can lead to suboptimal results.
7593
- */
7594
- declare type SpeechModelV2CallWarning_2 = {
7595
- type: 'unsupported-setting';
7596
- setting: keyof SpeechModelV2CallOptions_2;
7597
- details?: string;
7598
- } | {
7599
- type: 'other';
7600
- message: string;
7601
- };
7602
-
7603
6435
  declare type SpeechModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
7604
6436
 
7605
- declare type SpeechModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
7606
-
7607
6437
  /**
7608
6438
  Warning from the model provider for this call. The call will proceed, but e.g.
7609
6439
  some settings might not be supported, which can lead to suboptimal results.
7610
6440
  */
7611
- export declare type SpeechWarning = SpeechModelV2CallWarning_2;
6441
+ export declare type SpeechWarning = SpeechModelV2CallWarning;
7612
6442
 
7613
6443
  /** The Standard JSON Schema interface. */
7614
6444
  declare interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
@@ -7941,7 +6771,7 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
7941
6771
  @returns
7942
6772
  A result object for accessing the partial object stream and additional information.
7943
6773
  */
7944
- 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' ? {
7945
6775
  /**
7946
6776
  The enum values that the model should use.
7947
6777
  */
@@ -8595,8 +7425,6 @@ declare const symbol$1: unique symbol;
8595
7425
 
8596
7426
  declare const symbol$1_2: unique symbol;
8597
7427
 
8598
- declare const symbol$1_3: unique symbol;
8599
-
8600
7428
  declare const symbol$2: unique symbol;
8601
7429
 
8602
7430
  declare const symbol$2_2: unique symbol;
@@ -8621,8 +7449,6 @@ declare const symbol$7: unique symbol;
8621
7449
 
8622
7450
  declare const symbol$7_2: unique symbol;
8623
7451
 
8624
- declare const symbol$7_3: unique symbol;
8625
-
8626
7452
  declare const symbol$8: unique symbol;
8627
7453
 
8628
7454
  declare const symbol$8_2: unique symbol;
@@ -8643,20 +7469,18 @@ declare const symbol$c: unique symbol;
8643
7469
 
8644
7470
  declare const symbol$c_2: unique symbol;
8645
7471
 
8646
- declare const symbol$c_3: unique symbol;
8647
-
8648
7472
  declare const symbol$d: unique symbol;
8649
7473
 
8650
7474
  declare const symbol$d_2: unique symbol;
8651
7475
 
8652
- declare const symbol$d_3: unique symbol;
8653
-
8654
7476
  declare const symbol$e: unique symbol;
8655
7477
 
8656
7478
  declare const symbol: unique symbol;
8657
7479
 
8658
7480
  declare const symbol_2: unique symbol;
8659
7481
 
7482
+ declare const symbol_3: unique symbol;
7483
+
8660
7484
  /**
8661
7485
  A system message. It can contain system information.
8662
7486
 
@@ -9043,13 +7867,13 @@ export declare class ToolCallRepairError extends AISDKError {
9043
7867
  export declare type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
9044
7868
  system: string | undefined;
9045
7869
  messages: ModelMessage[];
9046
- toolCall: LanguageModelV2ToolCall_2;
7870
+ toolCall: LanguageModelV2ToolCall;
9047
7871
  tools: TOOLS;
9048
7872
  inputSchema: (options: {
9049
7873
  toolName: string;
9050
7874
  }) => JSONSchema7;
9051
7875
  error: NoSuchToolError | InvalidToolInputError;
9052
- }) => Promise<LanguageModelV2ToolCall_2 | null>;
7876
+ }) => Promise<LanguageModelV2ToolCall | null>;
9053
7877
 
9054
7878
  /**
9055
7879
  Tool choice for the generation. It supports the following settings:
@@ -9295,7 +8119,7 @@ declare interface TraceState {
9295
8119
  /**
9296
8120
  Transcription model that is used by the AI SDK Core functions.
9297
8121
  */
9298
- export declare type TranscriptionModel = TranscriptionModelV2_2;
8122
+ export declare type TranscriptionModel = TranscriptionModelV2;
9299
8123
 
9300
8124
  export declare type TranscriptionModelResponseMetadata = {
9301
8125
  /**
@@ -9412,106 +8236,6 @@ declare type TranscriptionModelV2 = {
9412
8236
  }>;
9413
8237
  };
9414
8238
 
9415
- /**
9416
- Transcription model specification version 2.
9417
- */
9418
- declare type TranscriptionModelV2_2 = {
9419
- /**
9420
- The transcription model must specify which transcription model interface
9421
- version it implements. This will allow us to evolve the transcription
9422
- model interface and retain backwards compatibility. The different
9423
- implementation versions can be handled as a discriminated union
9424
- on our side.
9425
- */
9426
- readonly specificationVersion: 'v2';
9427
- /**
9428
- Name of the provider for logging purposes.
9429
- */
9430
- readonly provider: string;
9431
- /**
9432
- Provider-specific model ID for logging purposes.
9433
- */
9434
- readonly modelId: string;
9435
- /**
9436
- Generates a transcript.
9437
- */
9438
- doGenerate(options: TranscriptionModelV2CallOptions_2): PromiseLike<{
9439
- /**
9440
- * The complete transcribed text from the audio.
9441
- */
9442
- text: string;
9443
- /**
9444
- * Array of transcript segments with timing information.
9445
- * Each segment represents a portion of the transcribed text with start and end times.
9446
- */
9447
- segments: Array<{
9448
- /**
9449
- * The text content of this segment.
9450
- */
9451
- text: string;
9452
- /**
9453
- * The start time of this segment in seconds.
9454
- */
9455
- startSecond: number;
9456
- /**
9457
- * The end time of this segment in seconds.
9458
- */
9459
- endSecond: number;
9460
- }>;
9461
- /**
9462
- * The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
9463
- * May be undefined if the language couldn't be detected.
9464
- */
9465
- language: string | undefined;
9466
- /**
9467
- * The total duration of the audio file in seconds.
9468
- * May be undefined if the duration couldn't be determined.
9469
- */
9470
- durationInSeconds: number | undefined;
9471
- /**
9472
- Warnings for the call, e.g. unsupported settings.
9473
- */
9474
- warnings: Array<TranscriptionModelV2CallWarning_2>;
9475
- /**
9476
- Optional request information for telemetry and debugging purposes.
9477
- */
9478
- request?: {
9479
- /**
9480
- Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
9481
- Non-HTTP(s) providers should not set this.
9482
- */
9483
- body?: string;
9484
- };
9485
- /**
9486
- Response information for telemetry and debugging purposes.
9487
- */
9488
- response: {
9489
- /**
9490
- Timestamp for the start of the generated response.
9491
- */
9492
- timestamp: Date;
9493
- /**
9494
- The ID of the response model that was used to generate the response.
9495
- */
9496
- modelId: string;
9497
- /**
9498
- Response headers.
9499
- */
9500
- headers?: SharedV2Headers_2;
9501
- /**
9502
- Response body.
9503
- */
9504
- body?: unknown;
9505
- };
9506
- /**
9507
- Additional provider-specific metadata. They are passed through
9508
- from the provider to the AI SDK and enable provider-specific
9509
- results that can be fully encapsulated in the provider.
9510
- */
9511
- providerMetadata?: Record<string, Record<string, JSONValue_3>>;
9512
- }>;
9513
- };
9514
-
9515
8239
  declare type TranscriptionModelV2CallOptions = {
9516
8240
  /**
9517
8241
  Audio data to transcribe.
@@ -9550,44 +8274,6 @@ declare type TranscriptionModelV2CallOptions = {
9550
8274
  headers?: Record<string, string | undefined>;
9551
8275
  };
9552
8276
 
9553
- declare type TranscriptionModelV2CallOptions_2 = {
9554
- /**
9555
- Audio data to transcribe.
9556
- Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
9557
- */
9558
- audio: Uint8Array | string;
9559
- /**
9560
- The IANA media type of the audio data.
9561
-
9562
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
9563
- */
9564
- mediaType: string;
9565
- /**
9566
- Additional provider-specific options that are passed through to the provider
9567
- as body parameters.
9568
-
9569
- The outer record is keyed by the provider name, and the inner
9570
- record is keyed by the provider-specific metadata key.
9571
- ```ts
9572
- {
9573
- "openai": {
9574
- "timestampGranularities": ["word"]
9575
- }
9576
- }
9577
- ```
9578
- */
9579
- providerOptions?: TranscriptionModelV2ProviderOptions_2;
9580
- /**
9581
- Abort signal for cancelling the operation.
9582
- */
9583
- abortSignal?: AbortSignal;
9584
- /**
9585
- Additional HTTP headers to be sent with the request.
9586
- Only applicable for HTTP-based providers.
9587
- */
9588
- headers?: Record<string, string | undefined>;
9589
- };
9590
-
9591
8277
  /**
9592
8278
  Warning from the model provider for this call. The call will proceed, but e.g.
9593
8279
  some settings might not be supported, which can lead to suboptimal results.
@@ -9601,28 +8287,13 @@ declare type TranscriptionModelV2CallWarning = {
9601
8287
  message: string;
9602
8288
  };
9603
8289
 
9604
- /**
9605
- Warning from the model provider for this call. The call will proceed, but e.g.
9606
- some settings might not be supported, which can lead to suboptimal results.
9607
- */
9608
- declare type TranscriptionModelV2CallWarning_2 = {
9609
- type: 'unsupported-setting';
9610
- setting: keyof TranscriptionModelV2CallOptions_2;
9611
- details?: string;
9612
- } | {
9613
- type: 'other';
9614
- message: string;
9615
- };
9616
-
9617
8290
  declare type TranscriptionModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
9618
8291
 
9619
- declare type TranscriptionModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
9620
-
9621
8292
  /**
9622
8293
  Warning from the model provider for this call. The call will proceed, but e.g.
9623
8294
  some settings might not be supported, which can lead to suboptimal results.
9624
8295
  */
9625
- export declare type TranscriptionWarning = TranscriptionModelV2CallWarning_2;
8296
+ export declare type TranscriptionWarning = TranscriptionModelV2CallWarning;
9626
8297
 
9627
8298
  export declare type TypedToolCall<TOOLS extends ToolSet> = StaticToolCall<TOOLS> | DynamicToolCall;
9628
8299
 
@@ -9631,7 +8302,7 @@ export declare type TypedToolError<TOOLS extends ToolSet> = StaticToolError<TOOL
9631
8302
  export declare type TypedToolResult<TOOLS extends ToolSet> = StaticToolResult<TOOLS> | DynamicToolResult;
9632
8303
 
9633
8304
  export declare class TypeValidationError extends AISDKError {
9634
- private readonly [symbol$1_2];
8305
+ private readonly [symbol$1];
9635
8306
  readonly value: unknown;
9636
8307
  constructor({ value, cause }: {
9637
8308
  value: unknown;
@@ -9654,30 +8325,6 @@ export declare class TypeValidationError extends AISDKError {
9654
8325
  }): TypeValidationError;
9655
8326
  }
9656
8327
 
9657
- declare class TypeValidationError_2 extends AISDKError_2 {
9658
- private readonly [symbol$1];
9659
- readonly value: unknown;
9660
- constructor({ value, cause }: {
9661
- value: unknown;
9662
- cause: unknown;
9663
- });
9664
- static isInstance(error: unknown): error is TypeValidationError_2;
9665
- /**
9666
- * Wraps an error into a TypeValidationError.
9667
- * If the cause is already a TypeValidationError with the same value, it returns the cause.
9668
- * Otherwise, it creates a new TypeValidationError.
9669
- *
9670
- * @param {Object} params - The parameters for wrapping the error.
9671
- * @param {unknown} params.value - The value that failed validation.
9672
- * @param {unknown} params.cause - The original error or cause of the validation failure.
9673
- * @returns {TypeValidationError} A TypeValidationError instance.
9674
- */
9675
- static wrap({ value, cause, }: {
9676
- value: unknown;
9677
- cause: unknown;
9678
- }): TypeValidationError_2;
9679
- }
9680
-
9681
8328
  export declare const UI_MESSAGE_STREAM_HEADERS: {
9682
8329
  'content-type': string;
9683
8330
  'cache-control': string;
@@ -10100,7 +8747,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
10100
8747
  export declare type UITools = Record<string, UITool>;
10101
8748
 
10102
8749
  export declare class UnsupportedFunctionalityError extends AISDKError {
10103
- private readonly [symbol];
8750
+ private readonly [symbol_2];
10104
8751
  readonly functionality: string;
10105
8752
  constructor({ functionality, message, }: {
10106
8753
  functionality: string;
@@ -10206,6 +8853,15 @@ export declare type UserModelMessage = {
10206
8853
 
10207
8854
  export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
10208
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
+
10209
8865
  /**
10210
8866
  * Validates the types of an unknown object using a schema and
10211
8867
  * return a strongly-typed object.
@@ -10341,11 +8997,11 @@ declare function withUserAgentSuffix(headers: HeadersInit | Record<string, strin
10341
8997
  * @returns A new LanguageModelV2 instance with middleware applied.
10342
8998
  */
10343
8999
  export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, modelId, providerId, }: {
10344
- model: LanguageModelV2_2;
9000
+ model: LanguageModelV2;
10345
9001
  middleware: LanguageModelMiddleware | LanguageModelMiddleware[];
10346
9002
  modelId?: string;
10347
9003
  providerId?: string;
10348
- }) => LanguageModelV2_2;
9004
+ }) => LanguageModelV2;
10349
9005
 
10350
9006
  /**
10351
9007
  * Wraps a ProviderV2 instance with middleware functionality.
@@ -10359,9 +9015,9 @@ export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, mod
10359
9015
  * @returns A new ProviderV2 instance with middleware applied to all language models.
10360
9016
  */
10361
9017
  export declare function wrapProvider({ provider, languageModelMiddleware, }: {
10362
- provider: ProviderV2_2;
9018
+ provider: ProviderV2;
10363
9019
  languageModelMiddleware: LanguageModelMiddleware | LanguageModelMiddleware[];
10364
- }): ProviderV2_2;
9020
+ }): ProviderV2;
10365
9021
 
10366
9022
  export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
10367
9023
  /**
@@ -10374,5 +9030,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
10374
9030
  }): Schema<OBJECT>;
10375
9031
 
10376
9032
  export { }
10377
- 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 };
10378
- 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 };