@mastra/schema-compat 1.2.9 → 1.2.10-alpha.0

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_2];
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.
@@ -1671,16 +1547,16 @@ declare interface EventSourceMessage {
1671
1547
  * implementation in that browsers will default this to `message`, whereas this parser will
1672
1548
  * leave this as `undefined` if not explicitly declared.
1673
1549
  */
1674
- event?: string | undefined
1550
+ event?: string | undefined;
1675
1551
  /**
1676
1552
  * ID of the message, if any was provided by the server. Can be used by clients to keep the
1677
1553
  * last received message ID in sync when reconnecting.
1678
1554
  */
1679
- id?: string | undefined
1555
+ id?: string | undefined;
1680
1556
  /**
1681
1557
  * The data received for this message
1682
1558
  */
1683
- data: string
1559
+ data: string;
1684
1560
  }
1685
1561
 
1686
1562
  /**
@@ -1704,8 +1580,11 @@ declare interface EventSourceMessage {
1704
1580
  *
1705
1581
  * @public
1706
1582
  */
1707
- declare class EventSourceParserStream extends TransformStream<string, EventSourceMessage> {
1708
- constructor({onError, onRetry, onComment}?: StreamOptions)
1583
+ declare class EventSourceParserStream extends TransformStream<
1584
+ string,
1585
+ EventSourceMessage
1586
+ > {
1587
+ constructor({ onError, onRetry, onComment }?: StreamOptions);
1709
1588
  }
1710
1589
 
1711
1590
  /**
@@ -2022,7 +1901,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
2022
1901
  /**
2023
1902
  The speech model to use.
2024
1903
  */
2025
- model: SpeechModelV2_2;
1904
+ model: SpeechModelV2;
2026
1905
  /**
2027
1906
  The text to convert to speech.
2028
1907
  */
@@ -2105,14 +1984,14 @@ export declare interface Experimental_SpeechResult {
2105
1984
  /**
2106
1985
  Provider metadata from the provider.
2107
1986
  */
2108
- readonly providerMetadata: Record<string, Record<string, JSONValue_3>>;
1987
+ readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
2109
1988
  }
2110
1989
 
2111
1990
  export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
2112
1991
  /**
2113
1992
  The transcription model to use.
2114
1993
  */
2115
- model: TranscriptionModelV2_2;
1994
+ model: TranscriptionModelV2;
2116
1995
  /**
2117
1996
  The audio data to transcribe.
2118
1997
  */
@@ -2210,10 +2089,10 @@ export declare interface Experimental_TranscriptionResult {
2210
2089
  /**
2211
2090
  Provider metadata from the provider.
2212
2091
  */
2213
- readonly providerMetadata: Record<string, Record<string, JSONValue_3>>;
2092
+ readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
2214
2093
  }
2215
2094
 
2216
- export declare type Experimental_Warning = LanguageModelV2CallWarning_2 | ImageModelV2CallWarning_2 | SpeechModelV2CallWarning_2 | TranscriptionModelV2CallWarning_2;
2095
+ export declare type Experimental_Warning = LanguageModelV2CallWarning | ImageModelV2CallWarning | SpeechModelV2CallWarning | TranscriptionModelV2CallWarning;
2217
2096
 
2218
2097
  declare type ExtractLiteralUnion<T> = T extends string ? string extends T ? never : T : never;
2219
2098
 
@@ -2315,7 +2194,7 @@ export declare type FileUIPart = {
2315
2194
  - `error`: model stopped because of an error
2316
2195
  - `other`: model stopped for other reasons
2317
2196
  */
2318
- export declare type FinishReason = LanguageModelV2FinishReason_2;
2197
+ export declare type FinishReason = LanguageModelV2FinishReason;
2319
2198
 
2320
2199
  declare type FlexibleSchema<SCHEMA> = z4.core.$ZodType<SCHEMA, any> | z3.Schema<SCHEMA, z3.ZodTypeDef, any> | Schema<SCHEMA> | LazySchema<SCHEMA>;
2321
2200
 
@@ -2330,13 +2209,57 @@ declare interface GatewayCreditsResponse {
2330
2209
  totalUsed: string;
2331
2210
  }
2332
2211
 
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 & {});
2212
+ 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
2213
 
2335
2214
  declare interface GatewayFetchMetadataResponse {
2336
2215
  models: GatewayLanguageModelEntry[];
2337
2216
  }
2338
2217
 
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 & {});
2218
+ declare interface GatewayGenerationInfo {
2219
+ /** The generation ID */
2220
+ id: string;
2221
+ /** Total cost in USD */
2222
+ totalCost: number;
2223
+ /** Upstream inference cost in USD (BYOK only) */
2224
+ upstreamInferenceCost: number;
2225
+ /** Usage cost in USD (same as totalCost) */
2226
+ usage: number;
2227
+ /** ISO 8601 timestamp when the generation was created */
2228
+ createdAt: string;
2229
+ /** Model identifier */
2230
+ model: string;
2231
+ /** Whether BYOK credentials were used */
2232
+ isByok: boolean;
2233
+ /** Provider that served this generation */
2234
+ providerName: string;
2235
+ /** Whether streaming was used */
2236
+ streamed: boolean;
2237
+ /** Finish reason (e.g. 'stop') */
2238
+ finishReason: string;
2239
+ /** Time to first token in milliseconds */
2240
+ latency: number;
2241
+ /** Total generation time in milliseconds */
2242
+ generationTime: number;
2243
+ /** Number of prompt tokens */
2244
+ promptTokens: number;
2245
+ /** Number of completion tokens */
2246
+ completionTokens: number;
2247
+ /** Reasoning tokens used */
2248
+ reasoningTokens: number;
2249
+ /** Cached tokens used */
2250
+ cachedTokens: number;
2251
+ /** Cache creation input tokens */
2252
+ cacheCreationTokens: number;
2253
+ /** Billable web search calls */
2254
+ billableWebSearchCalls: number;
2255
+ }
2256
+
2257
+ declare interface GatewayGenerationInfoParams {
2258
+ /** The generation ID to look up (format: gen_<ulid>) */
2259
+ id: string;
2260
+ }
2261
+
2262
+ 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' | 'openai/gpt-image-2' | '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
2263
 
2341
2264
  declare interface GatewayLanguageModelEntry {
2342
2265
  /**
@@ -2382,12 +2305,12 @@ declare interface GatewayLanguageModelEntry {
2382
2305
  /**
2383
2306
  * Optional field to differentiate between model types.
2384
2307
  */
2385
- modelType?: 'language' | 'embedding' | 'image' | null;
2308
+ modelType?: KnownModelType | null;
2386
2309
  }
2387
2310
 
2388
2311
  declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
2389
2312
 
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 & {});
2313
+ export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | '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-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | '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' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | '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' | 'interfaze/interfaze-beta' | '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' | 'moonshotai/kimi-k2.6' | '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-5.5' | 'openai/gpt-5.5-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' | '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-4.3' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-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
2314
 
2392
2315
  declare interface GatewayProvider extends ProviderV2 {
2393
2316
  (modelId: GatewayModelId): LanguageModelV2;
@@ -2403,6 +2326,16 @@ declare interface GatewayProvider extends ProviderV2 {
2403
2326
  Returns credit information for the authenticated user.
2404
2327
  */
2405
2328
  getCredits(): Promise<GatewayCreditsResponse>;
2329
+ /**
2330
+ * Returns a spend report with cost, token, and request count data,
2331
+ * aggregated by the specified dimension.
2332
+ */
2333
+ getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
2334
+ /**
2335
+ * Returns detailed information about a specific generation by its ID,
2336
+ * including cost, token usage, latency, and provider details.
2337
+ */
2338
+ getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
2406
2339
  /**
2407
2340
  Creates a model for generating text embeddings.
2408
2341
  */
@@ -2441,6 +2374,64 @@ declare interface GatewayProviderSettings {
2441
2374
  metadataCacheRefreshMillis?: number;
2442
2375
  }
2443
2376
 
2377
+ declare interface GatewaySpendReportParams {
2378
+ /** Start date in YYYY-MM-DD format (inclusive) */
2379
+ startDate: string;
2380
+ /** End date in YYYY-MM-DD format (inclusive) */
2381
+ endDate: string;
2382
+ /** Primary aggregation dimension. Defaults to 'day'. */
2383
+ groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
2384
+ /** Time granularity when groupBy is 'day'. */
2385
+ datePart?: 'day' | 'hour';
2386
+ /** Filter to a specific user's spend. */
2387
+ userId?: string;
2388
+ /** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
2389
+ model?: string;
2390
+ /** Filter to a specific provider (e.g. 'anthropic'). */
2391
+ provider?: string;
2392
+ /** Filter to BYOK or system credentials. */
2393
+ credentialType?: 'byok' | 'system';
2394
+ /** Filter to requests with these tags. */
2395
+ tags?: string[];
2396
+ }
2397
+
2398
+ declare interface GatewaySpendReportResponse {
2399
+ results: GatewaySpendReportRow[];
2400
+ }
2401
+
2402
+ declare interface GatewaySpendReportRow {
2403
+ /** Date string (present when groupBy is 'day') */
2404
+ day?: string;
2405
+ /** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
2406
+ hour?: string;
2407
+ /** User identifier (present when groupBy is 'user') */
2408
+ user?: string;
2409
+ /** Model identifier (present when groupBy is 'model') */
2410
+ model?: string;
2411
+ /** Tag value (present when groupBy is 'tag') */
2412
+ tag?: string;
2413
+ /** Provider name (present when groupBy is 'provider') */
2414
+ provider?: string;
2415
+ /** Credential type (present when groupBy is 'credential_type') */
2416
+ credentialType?: 'byok' | 'system';
2417
+ /** Total cost in USD */
2418
+ totalCost: number;
2419
+ /** Market cost in USD */
2420
+ marketCost?: number;
2421
+ /** Number of input tokens */
2422
+ inputTokens?: number;
2423
+ /** Number of output tokens */
2424
+ outputTokens?: number;
2425
+ /** Number of cached input tokens */
2426
+ cachedInputTokens?: number;
2427
+ /** Number of cache creation input tokens */
2428
+ cacheCreationInputTokens?: number;
2429
+ /** Number of reasoning tokens */
2430
+ reasoningTokens?: number;
2431
+ /** Number of requests */
2432
+ requestCount?: number;
2433
+ }
2434
+
2444
2435
  /**
2445
2436
  * Gateway-specific provider-defined tools.
2446
2437
  */
@@ -2566,7 +2557,7 @@ export declare const generateId: IdGenerator;
2566
2557
  @returns
2567
2558
  A result object that contains the generated object, the finish reason, the token usage, and additional information.
2568
2559
  */
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' ? {
2560
+ 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
2561
  /**
2571
2562
  The enum values that the model should use.
2572
2563
  */
@@ -2722,7 +2713,7 @@ export declare interface GenerateObjectResult<OBJECT> {
2722
2713
  @returns
2723
2714
  A result object that contains the generated text, the results of the tool calls, and additional information.
2724
2715
  */
2725
- export declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
2716
+ export declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model: modelArg, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
2726
2717
  /**
2727
2718
  The language model to use.
2728
2719
  */
@@ -2944,10 +2935,6 @@ declare type GetMaxImagesPerCallFunction = (options: {
2944
2935
  modelId: string;
2945
2936
  }) => PromiseLike<number | undefined> | number | undefined;
2946
2937
 
2947
- declare type GetMaxImagesPerCallFunction_2 = (options: {
2948
- modelId: string;
2949
- }) => PromiseLike<number | undefined> | number | undefined;
2950
-
2951
2938
  declare const getOriginalFetch: () => typeof fetch;
2952
2939
 
2953
2940
  declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
@@ -3070,18 +3057,18 @@ export declare type IdGenerator = () => string;
3070
3057
  /**
3071
3058
  Image model that is used by the AI SDK Core functions.
3072
3059
  */
3073
- export declare type ImageModel = string | ImageModelV2_2;
3060
+ export declare type ImageModel = string | ImageModelV2;
3074
3061
 
3075
3062
  /**
3076
3063
  Warning from the model provider for this call. The call will proceed, but e.g.
3077
3064
  some settings might not be supported, which can lead to suboptimal results.
3078
3065
  */
3079
- export declare type ImageModelCallWarning = ImageModelV2CallWarning_2;
3066
+ export declare type ImageModelCallWarning = ImageModelV2CallWarning;
3080
3067
 
3081
3068
  /**
3082
3069
  Metadata from the model provider for this call
3083
3070
  */
3084
- export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata_2;
3071
+ export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata;
3085
3072
 
3086
3073
  export declare type ImageModelResponseMetadata = {
3087
3074
  /**
@@ -3179,116 +3166,35 @@ declare type ImageModelV2 = {
3179
3166
  }>;
3180
3167
  };
3181
3168
 
3182
- /**
3183
- Image generation model specification version 2.
3184
- */
3185
- declare type ImageModelV2_2 = {
3169
+ declare type ImageModelV2CallOptions = {
3186
3170
  /**
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.
3171
+ Prompt for the image generation.
3192
3172
  */
3193
- readonly specificationVersion: 'v2';
3173
+ prompt: string;
3194
3174
  /**
3195
- Name of the provider for logging purposes.
3175
+ Number of images to generate.
3196
3176
  */
3197
- readonly provider: string;
3177
+ n: number;
3198
3178
  /**
3199
- Provider-specific model ID for logging purposes.
3179
+ Size of the images to generate.
3180
+ Must have the format `{width}x{height}`.
3181
+ `undefined` will use the provider's default size.
3200
3182
  */
3201
- readonly modelId: string;
3183
+ size: `${number}x${number}` | undefined;
3202
3184
  /**
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.
3185
+ Aspect ratio of the images to generate.
3186
+ Must have the format `{width}:{height}`.
3187
+ `undefined` will use the provider's default aspect ratio.
3207
3188
  */
3208
- readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction_2;
3189
+ aspectRatio: `${number}:${number}` | undefined;
3209
3190
  /**
3210
- Generates an array of images.
3191
+ Seed for the image generation.
3192
+ `undefined` will use the provider's default seed.
3211
3193
  */
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.
3194
+ seed: number | undefined;
3195
+ /**
3196
+ Additional provider-specific options that are passed through to the provider
3197
+ as body parameters.
3292
3198
 
3293
3199
  The outer record is keyed by the provider name, and the inner
3294
3200
  record is keyed by the provider-specific metadata key.
@@ -3312,58 +3218,6 @@ declare type ImageModelV2CallOptions = {
3312
3218
  headers?: Record<string, string | undefined>;
3313
3219
  };
3314
3220
 
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
3221
  /**
3368
3222
  Warning from the model provider for this call. The call will proceed, but e.g.
3369
3223
  some settings might not be supported, which can lead to suboptimal results.
@@ -3377,27 +3231,10 @@ declare type ImageModelV2CallWarning = {
3377
3231
  message: string;
3378
3232
  };
3379
3233
 
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
3234
  declare type ImageModelV2ProviderMetadata = Record<string, {
3394
3235
  images: JSONArray;
3395
3236
  } & JSONValue_2>;
3396
3237
 
3397
- declare type ImageModelV2ProviderMetadata_2 = Record<string, {
3398
- images: JSONArray_2;
3399
- } & JSONValue_3>;
3400
-
3401
3238
  /**
3402
3239
  Image content part of a prompt. It contains an image.
3403
3240
  */
@@ -3485,7 +3322,7 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
3485
3322
  }): LanguageModelV2Prompt;
3486
3323
 
3487
3324
  export declare class InvalidArgumentError extends AISDKError {
3488
- private readonly [symbol$c_3];
3325
+ private readonly [symbol$c_2];
3489
3326
  readonly parameter: string;
3490
3327
  readonly value: unknown;
3491
3328
  constructor({ parameter, value, message, }: {
@@ -3604,11 +3441,11 @@ export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
3604
3441
  */
3605
3442
  export declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is FileUIPart;
3606
3443
 
3607
- declare function isJSONArray(value: unknown): value is JSONArray_2;
3444
+ declare function isJSONArray(value: unknown): value is JSONArray;
3608
3445
 
3609
- declare function isJSONObject(value: unknown): value is JSONObject_2;
3446
+ declare function isJSONObject(value: unknown): value is JSONObject;
3610
3447
 
3611
- declare function isJSONValue(value: unknown): value is JSONValue_3;
3448
+ declare function isJSONValue(value: unknown): value is JSONValue_2;
3612
3449
 
3613
3450
  declare function isParsableJson(input: string): boolean;
3614
3451
 
@@ -3649,34 +3486,18 @@ declare type Job = () => Promise<void>;
3649
3486
 
3650
3487
  declare type JSONArray = JSONValue_2[];
3651
3488
 
3652
- declare type JSONArray_2 = JSONValue_3[];
3653
-
3654
3489
  declare type JSONObject = {
3655
3490
  [key: string]: JSONValue_2;
3656
3491
  };
3657
3492
 
3658
- declare type JSONObject_2 = {
3659
- [key: string]: JSONValue_3;
3660
- };
3661
-
3662
3493
  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
3494
  private readonly [symbol$7];
3674
3495
  readonly text: string;
3675
3496
  constructor({ text, cause }: {
3676
3497
  text: string;
3677
3498
  cause: unknown;
3678
3499
  });
3679
- static isInstance(error: unknown): error is JSONParseError_2;
3500
+ static isInstance(error: unknown): error is JSONParseError;
3680
3501
  }
3681
3502
 
3682
3503
  /**
@@ -3852,7 +3673,7 @@ export declare class JsonToSseTransformStream extends TransformStream<unknown, s
3852
3673
  constructor();
3853
3674
  }
3854
3675
 
3855
- export declare type JSONValue = JSONValue_3;
3676
+ export declare type JSONValue = JSONValue_2;
3856
3677
 
3857
3678
  /**
3858
3679
  A JSON value can be a string, number, boolean, object, array, or null.
@@ -3860,16 +3681,14 @@ export declare type JSONValue = JSONValue_3;
3860
3681
  */
3861
3682
  declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
3862
3683
 
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;
3684
+ declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language"];
3685
+
3686
+ declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
3868
3687
 
3869
3688
  /**
3870
3689
  Language model that is used by the AI SDK Core functions.
3871
3690
  */
3872
- export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2_2;
3691
+ export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2;
3873
3692
 
3874
3693
  export declare type LanguageModelMiddleware = LanguageModelV2Middleware;
3875
3694
 
@@ -3902,7 +3721,7 @@ export declare type LanguageModelResponseMetadata = {
3902
3721
  /**
3903
3722
  Represents the number of tokens used in a prompt and completion.
3904
3723
  */
3905
- export declare type LanguageModelUsage = LanguageModelV2Usage_2;
3724
+ export declare type LanguageModelUsage = LanguageModelV2Usage;
3906
3725
 
3907
3726
  /**
3908
3727
  Specification for a language model that implements the language model interface version 2.
@@ -4016,118 +3835,6 @@ declare type LanguageModelV2 = {
4016
3835
  }>;
4017
3836
  };
4018
3837
 
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
3838
  declare type LanguageModelV2CallOptions = {
4132
3839
  /**
4133
3840
  A language mode prompt is a standardized prompt type.
@@ -4229,188 +3936,39 @@ declare type LanguageModelV2CallOptions = {
4229
3936
  providerOptions?: SharedV2ProviderOptions;
4230
3937
  };
4231
3938
 
4232
- declare type LanguageModelV2CallOptions_2 = {
3939
+ /**
3940
+ Warning from the model provider for this call. The call will proceed, but e.g.
3941
+ some settings might not be supported, which can lead to suboptimal results.
3942
+ */
3943
+ declare type LanguageModelV2CallWarning = {
3944
+ type: 'unsupported-setting';
3945
+ setting: Omit<keyof LanguageModelV2CallOptions, 'prompt'>;
3946
+ details?: string;
3947
+ } | {
3948
+ type: 'unsupported-tool';
3949
+ tool: LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool;
3950
+ details?: string;
3951
+ } | {
3952
+ type: 'other';
3953
+ message: string;
3954
+ };
3955
+
3956
+ declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
3957
+
3958
+ /**
3959
+ Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
3960
+ */
3961
+ declare type LanguageModelV2DataContent = Uint8Array | string | URL;
3962
+
3963
+ /**
3964
+ A file that has been generated by the model.
3965
+ Generated files as base64 encoded strings or binary data.
3966
+ The files should be returned without any unnecessary conversion.
3967
+ */
3968
+ declare type LanguageModelV2File = {
3969
+ type: 'file';
4233
3970
  /**
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`.
3971
+ The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
4414
3972
 
4415
3973
  @see https://www.iana.org/assignments/media-types/media-types.xhtml
4416
3974
  */
@@ -4455,35 +4013,6 @@ declare interface LanguageModelV2FilePart {
4455
4013
  providerOptions?: SharedV2ProviderOptions;
4456
4014
  }
4457
4015
 
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
4016
  /**
4488
4017
  Reason why a language model finished generating a response.
4489
4018
 
@@ -4498,20 +4027,6 @@ declare interface LanguageModelV2FilePart_2 {
4498
4027
  */
4499
4028
  declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4500
4029
 
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
4030
  /**
4516
4031
  A tool has a name, a description, and a set of parameters.
4517
4032
 
@@ -4543,37 +4058,6 @@ declare type LanguageModelV2FunctionTool = {
4543
4058
  providerOptions?: SharedV2ProviderOptions;
4544
4059
  };
4545
4060
 
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
4061
  declare type LanguageModelV2Message = ({
4578
4062
  role: 'system';
4579
4063
  content: string;
@@ -4595,27 +4079,6 @@ declare type LanguageModelV2Message = ({
4595
4079
  providerOptions?: SharedV2ProviderOptions;
4596
4080
  };
4597
4081
 
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
4082
  /**
4620
4083
  * Experimental middleware for LanguageModelV2.
4621
4084
  * This type defines the structure for middleware that can be used to modify
@@ -4631,21 +4094,21 @@ declare type LanguageModelV2Middleware = {
4631
4094
  * @param options.model - The language model instance.
4632
4095
  */
4633
4096
  overrideProvider?: (options: {
4634
- model: LanguageModelV2_2;
4097
+ model: LanguageModelV2;
4635
4098
  }) => string;
4636
4099
  /**
4637
4100
  * Override the model ID if desired.
4638
4101
  * @param options.model - The language model instance.
4639
4102
  */
4640
4103
  overrideModelId?: (options: {
4641
- model: LanguageModelV2_2;
4104
+ model: LanguageModelV2;
4642
4105
  }) => string;
4643
4106
  /**
4644
4107
  * Override the supported URLs if desired.
4645
4108
  * @param options.model - The language model instance.
4646
4109
  */
4647
4110
  overrideSupportedUrls?: (options: {
4648
- model: LanguageModelV2_2;
4111
+ model: LanguageModelV2;
4649
4112
  }) => PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
4650
4113
  /**
4651
4114
  * Transforms the parameters before they are passed to the language model.
@@ -4656,9 +4119,9 @@ declare type LanguageModelV2Middleware = {
4656
4119
  */
4657
4120
  transformParams?: (options: {
4658
4121
  type: 'generate' | 'stream';
4659
- params: LanguageModelV2CallOptions_2;
4660
- model: LanguageModelV2_2;
4661
- }) => PromiseLike<LanguageModelV2CallOptions_2>;
4122
+ params: LanguageModelV2CallOptions;
4123
+ model: LanguageModelV2;
4124
+ }) => PromiseLike<LanguageModelV2CallOptions>;
4662
4125
  /**
4663
4126
  * Wraps the generate operation of the language model.
4664
4127
  * @param options - Object containing the generate function, parameters, and model.
@@ -4670,11 +4133,11 @@ declare type LanguageModelV2Middleware = {
4670
4133
  * @returns A promise that resolves to the result of the generate operation.
4671
4134
  */
4672
4135
  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']>>>;
4136
+ doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
4137
+ doStream: () => ReturnType<LanguageModelV2['doStream']>;
4138
+ params: LanguageModelV2CallOptions;
4139
+ model: LanguageModelV2;
4140
+ }) => Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
4678
4141
  /**
4679
4142
  * Wraps the stream operation of the language model.
4680
4143
  *
@@ -4687,11 +4150,11 @@ declare type LanguageModelV2Middleware = {
4687
4150
  * @returns A promise that resolves to the result of the stream operation.
4688
4151
  */
4689
4152
  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']>>>;
4153
+ doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
4154
+ doStream: () => ReturnType<LanguageModelV2['doStream']>;
4155
+ params: LanguageModelV2CallOptions;
4156
+ model: LanguageModelV2;
4157
+ }) => PromiseLike<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
4695
4158
  };
4696
4159
 
4697
4160
  /**
@@ -4705,17 +4168,6 @@ declare type LanguageModelV2Middleware = {
4705
4168
  */
4706
4169
  declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
4707
4170
 
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
4171
  /**
4720
4172
  The configuration of a tool that is defined by the provider.
4721
4173
  */
@@ -4738,28 +4190,6 @@ declare type LanguageModelV2ProviderDefinedTool = {
4738
4190
  args: Record<string, unknown>;
4739
4191
  };
4740
4192
 
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
4193
  /**
4764
4194
  Reasoning that the model has generated.
4765
4195
  */
@@ -4769,42 +4199,13 @@ declare type LanguageModelV2Reasoning = {
4769
4199
  /**
4770
4200
  * Optional provider-specific metadata for the reasoning part.
4771
4201
  */
4772
- providerMetadata?: SharedV2ProviderMetadata;
4773
- };
4774
-
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
- /**
4788
- Reasoning content part of a prompt. It contains a string of reasoning text.
4789
- */
4790
- declare interface LanguageModelV2ReasoningPart {
4791
- type: 'reasoning';
4792
- /**
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
- }
4202
+ providerMetadata?: SharedV2ProviderMetadata;
4203
+ };
4803
4204
 
4804
4205
  /**
4805
4206
  Reasoning content part of a prompt. It contains a string of reasoning text.
4806
4207
  */
4807
- declare interface LanguageModelV2ReasoningPart_2 {
4208
+ declare interface LanguageModelV2ReasoningPart {
4808
4209
  type: 'reasoning';
4809
4210
  /**
4810
4211
  The reasoning text.
@@ -4815,7 +4216,7 @@ declare interface LanguageModelV2ReasoningPart_2 {
4815
4216
  * to the provider from the AI SDK and enable provider-specific
4816
4217
  * functionality that can be fully encapsulated in the provider.
4817
4218
  */
4818
- providerOptions?: SharedV2ProviderOptions_2;
4219
+ providerOptions?: SharedV2ProviderOptions;
4819
4220
  }
4820
4221
 
4821
4222
  declare interface LanguageModelV2ResponseMetadata {
@@ -4833,21 +4234,6 @@ declare interface LanguageModelV2ResponseMetadata {
4833
4234
  modelId?: string;
4834
4235
  }
4835
4236
 
4836
- declare interface LanguageModelV2ResponseMetadata_2 {
4837
- /**
4838
- ID for the generated response, if the provider sends one.
4839
- */
4840
- id?: string;
4841
- /**
4842
- Timestamp for the start of the generated response, if the provider sends one.
4843
- */
4844
- timestamp?: Date;
4845
- /**
4846
- The ID of the response model that was used to generate the response, if the provider sends one.
4847
- */
4848
- modelId?: string;
4849
- }
4850
-
4851
4237
  /**
4852
4238
  A source that has been used as input to generate the response.
4853
4239
  */
@@ -4901,59 +4287,6 @@ declare type LanguageModelV2Source = {
4901
4287
  providerMetadata?: SharedV2ProviderMetadata;
4902
4288
  };
4903
4289
 
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
4290
  declare type LanguageModelV2StreamPart = {
4958
4291
  type: 'text-start';
4959
4292
  providerMetadata?: SharedV2ProviderMetadata;
@@ -5013,65 +4346,6 @@ declare type LanguageModelV2StreamPart = {
5013
4346
  error: unknown;
5014
4347
  };
5015
4348
 
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
4349
  /**
5076
4350
  Text that the model has generated.
5077
4351
  */
@@ -5084,18 +4358,6 @@ declare type LanguageModelV2Text = {
5084
4358
  providerMetadata?: SharedV2ProviderMetadata;
5085
4359
  };
5086
4360
 
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
4361
  /**
5100
4362
  Text content part of a prompt. It contains a string of text.
5101
4363
  */
@@ -5113,23 +4375,6 @@ declare interface LanguageModelV2TextPart {
5113
4375
  providerOptions?: SharedV2ProviderOptions;
5114
4376
  }
5115
4377
 
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
4378
  /**
5134
4379
  * Tool calls that the model has generated.
5135
4380
  */
@@ -5159,29 +4404,6 @@ declare type LanguageModelV2ToolCall = {
5159
4404
  providerMetadata?: SharedV2ProviderMetadata;
5160
4405
  };
5161
4406
 
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
4407
  /**
5186
4408
  Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
5187
4409
  */
@@ -5212,36 +4434,6 @@ declare interface LanguageModelV2ToolCallPart {
5212
4434
  providerOptions?: SharedV2ProviderOptions;
5213
4435
  }
5214
4436
 
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
4437
  declare type LanguageModelV2ToolChoice = {
5246
4438
  type: 'auto';
5247
4439
  } | {
@@ -5253,17 +4445,6 @@ declare type LanguageModelV2ToolChoice = {
5253
4445
  toolName: string;
5254
4446
  };
5255
4447
 
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
4448
  /**
5268
4449
  Result of a tool call that has been executed by the provider.
5269
4450
  */
@@ -5297,85 +4478,18 @@ declare type LanguageModelV2ToolResult = {
5297
4478
  providerMetadata?: SharedV2ProviderMetadata;
5298
4479
  };
5299
4480
 
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
4481
  declare type LanguageModelV2ToolResultOutput = {
5334
4482
  type: 'text';
5335
4483
  value: string;
5336
4484
  } | {
5337
4485
  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
- }>;
5365
- };
5366
-
5367
- declare type LanguageModelV2ToolResultOutput_2 = {
5368
- type: 'text';
5369
- value: string;
5370
- } | {
5371
- type: 'json';
5372
- value: JSONValue_3;
4486
+ value: JSONValue_2;
5373
4487
  } | {
5374
4488
  type: 'error-text';
5375
4489
  value: string;
5376
4490
  } | {
5377
4491
  type: 'error-json';
5378
- value: JSONValue_3;
4492
+ value: JSONValue_2;
5379
4493
  } | {
5380
4494
  type: 'content';
5381
4495
  value: Array<{
@@ -5423,31 +4537,6 @@ declare interface LanguageModelV2ToolResultPart {
5423
4537
  providerOptions?: SharedV2ProviderOptions;
5424
4538
  }
5425
4539
 
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
4540
  /**
5452
4541
  Usage information for a language model call.
5453
4542
 
@@ -5479,37 +4568,6 @@ declare type LanguageModelV2Usage = {
5479
4568
  cachedInputTokens?: number | undefined;
5480
4569
  };
5481
4570
 
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
4571
  /**
5514
4572
  Check if the message is an assistant message with completed tool calls.
5515
4573
  The last step of the message must have at least one tool invocation and
@@ -5738,7 +4796,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
5738
4796
  Thrown when no output type is specified and output-related methods are called.
5739
4797
  */
5740
4798
  export declare class NoOutputSpecifiedError extends AISDKError {
5741
- private readonly [symbol$7_3];
4799
+ private readonly [symbol$7_2];
5742
4800
  constructor({ message }?: {
5743
4801
  message?: string;
5744
4802
  });
@@ -5778,7 +4836,7 @@ export declare class NoSuchModelError extends AISDKError {
5778
4836
  }
5779
4837
 
5780
4838
  export declare class NoSuchProviderError extends NoSuchModelError {
5781
- private readonly [symbol_2];
4839
+ private readonly [symbol_3];
5782
4840
  readonly providerId: string;
5783
4841
  readonly availableProviders: string[];
5784
4842
  constructor({ modelId, modelType, providerId, availableProviders, message, }: {
@@ -5792,7 +4850,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
5792
4850
  }
5793
4851
 
5794
4852
  export declare class NoSuchToolError extends AISDKError {
5795
- private readonly [symbol$d_3];
4853
+ private readonly [symbol$d_2];
5796
4854
  readonly toolName: string;
5797
4855
  readonly availableTools: string[] | undefined;
5798
4856
  constructor({ toolName, availableTools, message, }: {
@@ -5830,7 +4888,7 @@ export declare namespace Output {
5830
4888
 
5831
4889
  declare interface Output_2<OUTPUT, PARTIAL> {
5832
4890
  readonly type: 'object' | 'text';
5833
- responseFormat: LanguageModelV2CallOptions_2['responseFormat'];
4891
+ responseFormat: LanguageModelV2CallOptions['responseFormat'];
5834
4892
  parsePartial(options: {
5835
4893
  text: string;
5836
4894
  }): Promise<{
@@ -6020,7 +5078,7 @@ export declare function parseJsonEventStream<T>({ stream, schema, }: {
6020
5078
  }): ReadableStream<ParseResult<T>>;
6021
5079
 
6022
5080
  export declare function parsePartialJson(jsonText: string | undefined): Promise<{
6023
- value: JSONValue_3 | undefined;
5081
+ value: JSONValue_2 | undefined;
6024
5082
  state: 'undefined-input' | 'successful-parse' | 'repaired-parse' | 'failed-parse';
6025
5083
  }>;
6026
5084
 
@@ -6036,7 +5094,7 @@ declare type ParseResult<T> = {
6036
5094
  rawValue: unknown;
6037
5095
  } | {
6038
5096
  success: false;
6039
- error: JSONParseError_2 | TypeValidationError_2;
5097
+ error: JSONParseError | TypeValidationError;
6040
5098
  rawValue: unknown;
6041
5099
  };
6042
5100
 
@@ -6200,7 +5258,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
6200
5258
  url: string;
6201
5259
  headers?: Record<string, string | undefined>;
6202
5260
  formData: FormData;
6203
- failedResponseHandler: ResponseHandler<APICallError_2>;
5261
+ failedResponseHandler: ResponseHandler<APICallError>;
6204
5262
  successfulResponseHandler: ResponseHandler<T>;
6205
5263
  abortSignal?: AbortSignal;
6206
5264
  fetch?: FetchFunction;
@@ -6214,7 +5272,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
6214
5272
  url: string;
6215
5273
  headers?: Record<string, string | undefined>;
6216
5274
  body: unknown;
6217
- failedResponseHandler: ResponseHandler<APICallError_2>;
5275
+ failedResponseHandler: ResponseHandler<APICallError>;
6218
5276
  successfulResponseHandler: ResponseHandler<T>;
6219
5277
  abortSignal?: AbortSignal;
6220
5278
  fetch?: FetchFunction;
@@ -6316,6 +5374,15 @@ export declare type Prompt = {
6316
5374
  System message to include in the prompt. Can be used with `prompt` or `messages`.
6317
5375
  */
6318
5376
  system?: string;
5377
+ /**
5378
+ * Whether system messages are allowed in the `prompt` or `messages` fields.
5379
+ *
5380
+ * When disabled, system messages must be provided through the `system`
5381
+ * option. When unset, system messages are allowed with a warning.
5382
+ *
5383
+ * @default undefined
5384
+ */
5385
+ allowSystemInMessages?: boolean;
6319
5386
  } & ({
6320
5387
  /**
6321
5388
  A prompt. It can be either a text prompt or a list of messages.
@@ -6403,7 +5470,7 @@ declare type ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS exte
6403
5470
  This is needed to enable provider-specific functionality that can be
6404
5471
  fully encapsulated in the provider.
6405
5472
  */
6406
- export declare type ProviderMetadata = SharedV2ProviderMetadata_2;
5473
+ export declare type ProviderMetadata = SharedV2ProviderMetadata;
6407
5474
 
6408
5475
  /**
6409
5476
  Additional provider-specific options.
@@ -6413,17 +5480,17 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata_2;
6413
5480
  */
6414
5481
  declare type ProviderOptions = SharedV2ProviderOptions;
6415
5482
 
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;
5483
+ export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
5484
+ languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
5485
+ languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): LanguageModelV2;
5486
+ textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never): EmbeddingModelV2<string>;
5487
+ textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): EmbeddingModelV2<string>;
5488
+ imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never): ImageModelV2;
5489
+ imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): ImageModelV2;
5490
+ transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never): TranscriptionModelV2;
5491
+ transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): TranscriptionModelV2;
5492
+ speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never): SpeechModelV2;
5493
+ speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): SpeechModelV2;
6427
5494
  }
6428
5495
 
6429
5496
  /**
@@ -6481,61 +5548,6 @@ declare interface ProviderV2 {
6481
5548
  speechModel?(modelId: string): SpeechModelV2;
6482
5549
  }
6483
5550
 
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
5551
  /**
6540
5552
  * Prunes model messages from a list of model messages.
6541
5553
  *
@@ -6556,6 +5568,25 @@ export declare function pruneMessages({ messages, reasoning, toolCalls, emptyMes
6556
5568
  emptyMessages?: 'keep' | 'remove';
6557
5569
  }): ModelMessage[];
6558
5570
 
5571
+ /**
5572
+ * Reads a fetch Response body with a size limit to prevent memory exhaustion.
5573
+ *
5574
+ * Checks the Content-Length header for early rejection, then reads the body
5575
+ * incrementally via ReadableStream and aborts with a DownloadError when the
5576
+ * limit is exceeded.
5577
+ *
5578
+ * @param response - The fetch Response to read.
5579
+ * @param url - The URL being downloaded (used in error messages).
5580
+ * @param maxBytes - Maximum allowed bytes. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.
5581
+ * @returns A Uint8Array containing the response body.
5582
+ * @throws DownloadError if the response exceeds maxBytes.
5583
+ */
5584
+ declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
5585
+ response: Response;
5586
+ url: string;
5587
+ maxBytes?: number;
5588
+ }): Promise<Uint8Array>;
5589
+
6559
5590
  /**
6560
5591
  * Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
6561
5592
  *
@@ -6670,7 +5701,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
6670
5701
  declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
6671
5702
 
6672
5703
  export declare class RetryError extends AISDKError {
6673
- private readonly [symbol$1_3];
5704
+ private readonly [symbol$1_2];
6674
5705
  readonly reason: RetryErrorReason;
6675
5706
  readonly lastError: unknown;
6676
5707
  readonly errors: Array<unknown>;
@@ -6726,7 +5757,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
6726
5757
  rawValue: unknown;
6727
5758
  } | {
6728
5759
  success: false;
6729
- error: TypeValidationError_2;
5760
+ error: TypeValidationError;
6730
5761
  rawValue: unknown;
6731
5762
  }>;
6732
5763
 
@@ -6783,8 +5814,6 @@ export declare class SerialJobExecutor {
6783
5814
 
6784
5815
  declare type SharedV2Headers = Record<string, string>;
6785
5816
 
6786
- declare type SharedV2Headers_2 = Record<string, string>;
6787
-
6788
5817
  /**
6789
5818
  * Additional provider-specific metadata.
6790
5819
  * Metadata are additional outputs from the provider.
@@ -6808,29 +5837,6 @@ declare type SharedV2Headers_2 = Record<string, string>;
6808
5837
  */
6809
5838
  declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
6810
5839
 
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
5840
  /**
6835
5841
  * Additional provider-specific options.
6836
5842
  * Options are additional input to the provider.
@@ -6854,29 +5860,6 @@ declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValu
6854
5860
  */
6855
5861
  declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
6856
5862
 
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
5863
  /**
6881
5864
  * Creates a ReadableStream that emits the provided values with an optional delay between each value.
6882
5865
  *
@@ -6956,7 +5939,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
6956
5939
  file: GeneratedFile;
6957
5940
  } | {
6958
5941
  type: 'stream-start';
6959
- warnings: LanguageModelV2CallWarning_2[];
5942
+ warnings: LanguageModelV2CallWarning[];
6960
5943
  } | {
6961
5944
  type: 'response-metadata';
6962
5945
  id?: string;
@@ -6999,7 +5982,7 @@ export declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunkin
6999
5982
  /**
7000
5983
  A source that has been used as input to generate the response.
7001
5984
  */
7002
- declare type Source = LanguageModelV2Source_2;
5985
+ declare type Source = LanguageModelV2Source;
7003
5986
 
7004
5987
  /**
7005
5988
  * A document source part of a message.
@@ -7301,106 +6284,31 @@ declare enum SpanStatusCode {
7301
6284
  /**
7302
6285
  Speech model that is used by the AI SDK Core functions.
7303
6286
  */
7304
- export declare type SpeechModel = SpeechModelV2_2;
6287
+ export declare type SpeechModel = SpeechModelV2;
7305
6288
 
7306
6289
  export declare type SpeechModelResponseMetadata = {
7307
6290
  /**
7308
- Timestamp for the start of the generated response.
7309
- */
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
- }>;
6291
+ Timestamp for the start of the generated response.
6292
+ */
6293
+ timestamp: Date;
6294
+ /**
6295
+ The ID of the response model that was used to generate the response.
6296
+ */
6297
+ modelId: string;
6298
+ /**
6299
+ Response headers.
6300
+ */
6301
+ headers?: Record<string, string>;
6302
+ /**
6303
+ Response body.
6304
+ */
6305
+ body?: unknown;
7398
6306
  };
7399
6307
 
7400
6308
  /**
7401
6309
  * Speech model specification version 2.
7402
6310
  */
7403
- declare type SpeechModelV2_2 = {
6311
+ declare type SpeechModelV2 = {
7404
6312
  /**
7405
6313
  * The speech model must specify which speech model interface
7406
6314
  * version it implements. This will allow us to evolve the speech
@@ -7420,7 +6328,7 @@ declare type SpeechModelV2_2 = {
7420
6328
  /**
7421
6329
  * Generates speech audio from text.
7422
6330
  */
7423
- doGenerate(options: SpeechModelV2CallOptions_2): PromiseLike<{
6331
+ doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
7424
6332
  /**
7425
6333
  * Generated audio as an ArrayBuffer.
7426
6334
  * The audio should be returned without any unnecessary conversion.
@@ -7432,7 +6340,7 @@ declare type SpeechModelV2_2 = {
7432
6340
  /**
7433
6341
  * Warnings for the call, e.g. unsupported settings.
7434
6342
  */
7435
- warnings: Array<SpeechModelV2CallWarning_2>;
6343
+ warnings: Array<SpeechModelV2CallWarning>;
7436
6344
  /**
7437
6345
  * Optional request information for telemetry and debugging purposes.
7438
6346
  */
@@ -7457,7 +6365,7 @@ declare type SpeechModelV2_2 = {
7457
6365
  /**
7458
6366
  * Response headers.
7459
6367
  */
7460
- headers?: SharedV2Headers_2;
6368
+ headers?: SharedV2Headers;
7461
6369
  /**
7462
6370
  * Response body.
7463
6371
  */
@@ -7468,7 +6376,7 @@ declare type SpeechModelV2_2 = {
7468
6376
  * from the provider to the AI SDK and enable provider-specific
7469
6377
  * results that can be fully encapsulated in the provider.
7470
6378
  */
7471
- providerMetadata?: Record<string, Record<string, JSONValue_3>>;
6379
+ providerMetadata?: Record<string, Record<string, JSONValue_2>>;
7472
6380
  }>;
7473
6381
  };
7474
6382
 
@@ -7523,57 +6431,6 @@ declare type SpeechModelV2CallOptions = {
7523
6431
  headers?: Record<string, string | undefined>;
7524
6432
  };
7525
6433
 
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
6434
  /**
7578
6435
  * Warning from the model provider for this call. The call will proceed, but e.g.
7579
6436
  * some settings might not be supported, which can lead to suboptimal results.
@@ -7587,28 +6444,13 @@ declare type SpeechModelV2CallWarning = {
7587
6444
  message: string;
7588
6445
  };
7589
6446
 
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
6447
  declare type SpeechModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
7604
6448
 
7605
- declare type SpeechModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
7606
-
7607
6449
  /**
7608
6450
  Warning from the model provider for this call. The call will proceed, but e.g.
7609
6451
  some settings might not be supported, which can lead to suboptimal results.
7610
6452
  */
7611
- export declare type SpeechWarning = SpeechModelV2CallWarning_2;
6453
+ export declare type SpeechWarning = SpeechModelV2CallWarning;
7612
6454
 
7613
6455
  /** The Standard JSON Schema interface. */
7614
6456
  declare interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
@@ -7941,7 +6783,7 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
7941
6783
  @returns
7942
6784
  A result object for accessing the partial object stream and additional information.
7943
6785
  */
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' ? {
6786
+ 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
6787
  /**
7946
6788
  The enum values that the model should use.
7947
6789
  */
@@ -8146,19 +6988,19 @@ declare interface StreamOptions {
8146
6988
  *
8147
6989
  * @defaultValue `undefined`
8148
6990
  */
8149
- onError?: ('terminate' | ((error: Error) => void)) | undefined
6991
+ onError?: ("terminate" | ((error: Error) => void)) | undefined;
8150
6992
  /**
8151
6993
  * Callback for when a reconnection interval is sent from the server.
8152
6994
  *
8153
6995
  * @param retry - The number of milliseconds to wait before reconnecting.
8154
6996
  */
8155
- onRetry?: ((retry: number) => void) | undefined
6997
+ onRetry?: ((retry: number) => void) | undefined;
8156
6998
  /**
8157
6999
  * Callback for when a comment is encountered in the stream.
8158
7000
  *
8159
7001
  * @param comment - The comment encountered in the stream.
8160
7002
  */
8161
- onComment?: ((comment: string) => void) | undefined
7003
+ onComment?: ((comment: string) => void) | undefined;
8162
7004
  }
8163
7005
 
8164
7006
  /**
@@ -8209,7 +7051,7 @@ declare interface StreamOptions {
8209
7051
  @return
8210
7052
  A result object for accessing different stream types and additional information.
8211
7053
  */
8212
- export declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
7054
+ export declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
8213
7055
  /**
8214
7056
  The language model to use.
8215
7057
  */
@@ -8595,8 +7437,6 @@ declare const symbol$1: unique symbol;
8595
7437
 
8596
7438
  declare const symbol$1_2: unique symbol;
8597
7439
 
8598
- declare const symbol$1_3: unique symbol;
8599
-
8600
7440
  declare const symbol$2: unique symbol;
8601
7441
 
8602
7442
  declare const symbol$2_2: unique symbol;
@@ -8621,8 +7461,6 @@ declare const symbol$7: unique symbol;
8621
7461
 
8622
7462
  declare const symbol$7_2: unique symbol;
8623
7463
 
8624
- declare const symbol$7_3: unique symbol;
8625
-
8626
7464
  declare const symbol$8: unique symbol;
8627
7465
 
8628
7466
  declare const symbol$8_2: unique symbol;
@@ -8643,20 +7481,18 @@ declare const symbol$c: unique symbol;
8643
7481
 
8644
7482
  declare const symbol$c_2: unique symbol;
8645
7483
 
8646
- declare const symbol$c_3: unique symbol;
8647
-
8648
7484
  declare const symbol$d: unique symbol;
8649
7485
 
8650
7486
  declare const symbol$d_2: unique symbol;
8651
7487
 
8652
- declare const symbol$d_3: unique symbol;
8653
-
8654
7488
  declare const symbol$e: unique symbol;
8655
7489
 
8656
7490
  declare const symbol: unique symbol;
8657
7491
 
8658
7492
  declare const symbol_2: unique symbol;
8659
7493
 
7494
+ declare const symbol_3: unique symbol;
7495
+
8660
7496
  /**
8661
7497
  A system message. It can contain system information.
8662
7498
 
@@ -9043,13 +7879,13 @@ export declare class ToolCallRepairError extends AISDKError {
9043
7879
  export declare type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
9044
7880
  system: string | undefined;
9045
7881
  messages: ModelMessage[];
9046
- toolCall: LanguageModelV2ToolCall_2;
7882
+ toolCall: LanguageModelV2ToolCall;
9047
7883
  tools: TOOLS;
9048
7884
  inputSchema: (options: {
9049
7885
  toolName: string;
9050
7886
  }) => JSONSchema7;
9051
7887
  error: NoSuchToolError | InvalidToolInputError;
9052
- }) => Promise<LanguageModelV2ToolCall_2 | null>;
7888
+ }) => Promise<LanguageModelV2ToolCall | null>;
9053
7889
 
9054
7890
  /**
9055
7891
  Tool choice for the generation. It supports the following settings:
@@ -9295,7 +8131,7 @@ declare interface TraceState {
9295
8131
  /**
9296
8132
  Transcription model that is used by the AI SDK Core functions.
9297
8133
  */
9298
- export declare type TranscriptionModel = TranscriptionModelV2_2;
8134
+ export declare type TranscriptionModel = TranscriptionModelV2;
9299
8135
 
9300
8136
  export declare type TranscriptionModelResponseMetadata = {
9301
8137
  /**
@@ -9412,106 +8248,6 @@ declare type TranscriptionModelV2 = {
9412
8248
  }>;
9413
8249
  };
9414
8250
 
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
8251
  declare type TranscriptionModelV2CallOptions = {
9516
8252
  /**
9517
8253
  Audio data to transcribe.
@@ -9550,44 +8286,6 @@ declare type TranscriptionModelV2CallOptions = {
9550
8286
  headers?: Record<string, string | undefined>;
9551
8287
  };
9552
8288
 
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
8289
  /**
9592
8290
  Warning from the model provider for this call. The call will proceed, but e.g.
9593
8291
  some settings might not be supported, which can lead to suboptimal results.
@@ -9601,28 +8299,13 @@ declare type TranscriptionModelV2CallWarning = {
9601
8299
  message: string;
9602
8300
  };
9603
8301
 
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
8302
  declare type TranscriptionModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
9618
8303
 
9619
- declare type TranscriptionModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
9620
-
9621
8304
  /**
9622
8305
  Warning from the model provider for this call. The call will proceed, but e.g.
9623
8306
  some settings might not be supported, which can lead to suboptimal results.
9624
8307
  */
9625
- export declare type TranscriptionWarning = TranscriptionModelV2CallWarning_2;
8308
+ export declare type TranscriptionWarning = TranscriptionModelV2CallWarning;
9626
8309
 
9627
8310
  export declare type TypedToolCall<TOOLS extends ToolSet> = StaticToolCall<TOOLS> | DynamicToolCall;
9628
8311
 
@@ -9631,7 +8314,7 @@ export declare type TypedToolError<TOOLS extends ToolSet> = StaticToolError<TOOL
9631
8314
  export declare type TypedToolResult<TOOLS extends ToolSet> = StaticToolResult<TOOLS> | DynamicToolResult;
9632
8315
 
9633
8316
  export declare class TypeValidationError extends AISDKError {
9634
- private readonly [symbol$1_2];
8317
+ private readonly [symbol$1];
9635
8318
  readonly value: unknown;
9636
8319
  constructor({ value, cause }: {
9637
8320
  value: unknown;
@@ -9654,30 +8337,6 @@ export declare class TypeValidationError extends AISDKError {
9654
8337
  }): TypeValidationError;
9655
8338
  }
9656
8339
 
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
8340
  export declare const UI_MESSAGE_STREAM_HEADERS: {
9682
8341
  'content-type': string;
9683
8342
  'cache-control': string;
@@ -10206,6 +8865,15 @@ export declare type UserModelMessage = {
10206
8865
 
10207
8866
  export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
10208
8867
 
8868
+ /**
8869
+ * Validates that a URL is safe to download from, blocking private/internal addresses
8870
+ * to prevent SSRF attacks.
8871
+ *
8872
+ * @param url - The URL string to validate.
8873
+ * @throws DownloadError if the URL is unsafe.
8874
+ */
8875
+ declare function validateDownloadUrl(url: string): void;
8876
+
10209
8877
  /**
10210
8878
  * Validates the types of an unknown object using a schema and
10211
8879
  * return a strongly-typed object.
@@ -10341,11 +9009,11 @@ declare function withUserAgentSuffix(headers: HeadersInit | Record<string, strin
10341
9009
  * @returns A new LanguageModelV2 instance with middleware applied.
10342
9010
  */
10343
9011
  export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, modelId, providerId, }: {
10344
- model: LanguageModelV2_2;
9012
+ model: LanguageModelV2;
10345
9013
  middleware: LanguageModelMiddleware | LanguageModelMiddleware[];
10346
9014
  modelId?: string;
10347
9015
  providerId?: string;
10348
- }) => LanguageModelV2_2;
9016
+ }) => LanguageModelV2;
10349
9017
 
10350
9018
  /**
10351
9019
  * Wraps a ProviderV2 instance with middleware functionality.
@@ -10359,9 +9027,9 @@ export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, mod
10359
9027
  * @returns A new ProviderV2 instance with middleware applied to all language models.
10360
9028
  */
10361
9029
  export declare function wrapProvider({ provider, languageModelMiddleware, }: {
10362
- provider: ProviderV2_2;
9030
+ provider: ProviderV2;
10363
9031
  languageModelMiddleware: LanguageModelMiddleware | LanguageModelMiddleware[];
10364
- }): ProviderV2_2;
9032
+ }): ProviderV2;
10365
9033
 
10366
9034
  export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
10367
9035
  /**
@@ -10374,5 +9042,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
10374
9042
  }): Schema<OBJECT>;
10375
9043
 
10376
9044
  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 };
9045
+ export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, FlexibleSchema as FlexibleSchema, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, 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, 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 };
9046
+ 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 };