@ai-sdk/gateway 2.0.108 → 2.0.110

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.
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  import { APICallError } from "@ai-sdk/provider";
10
10
 
11
11
  // src/errors/create-gateway-error.ts
12
- import { z as z2 } from "zod/v4";
12
+ import { z as z3 } from "zod/v4";
13
13
 
14
14
  // src/errors/gateway-error.ts
15
15
  var marker = "vercel.ai.gateway.error";
@@ -101,21 +101,32 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
101
101
  };
102
102
 
103
103
  // src/errors/gateway-forbidden-error.ts
104
+ import { z } from "zod/v4";
105
+ import { lazyValidator, zodSchema } from "@ai-sdk/provider-utils";
104
106
  var name2 = "GatewayForbiddenError";
105
107
  var marker3 = `vercel.ai.gateway.error.${name2}`;
106
108
  var symbol3 = Symbol.for(marker3);
109
+ var forbiddenParamSchema = lazyValidator(
110
+ () => zodSchema(
111
+ z.object({
112
+ ruleId: z.string()
113
+ })
114
+ )
115
+ );
107
116
  var _a3, _b3;
108
117
  var GatewayForbiddenError = class extends (_b3 = GatewayError, _a3 = symbol3, _b3) {
109
118
  constructor({
110
119
  message = "Forbidden",
111
120
  statusCode = 403,
112
- cause
121
+ cause,
122
+ ruleId
113
123
  } = {}) {
114
124
  super({ message, statusCode, cause });
115
125
  this[_a3] = true;
116
126
  // used in isInstance
117
127
  this.name = name2;
118
128
  this.type = "forbidden";
129
+ this.ruleId = ruleId;
119
130
  }
120
131
  static isInstance(error) {
121
132
  return GatewayError.hasMarker(error) && symbol3 in error;
@@ -167,15 +178,15 @@ var GatewayRateLimitError = class extends (_b5 = GatewayError, _a5 = symbol5, _b
167
178
  };
168
179
 
169
180
  // src/errors/gateway-model-not-found-error.ts
170
- import { z } from "zod/v4";
171
- import { lazyValidator, zodSchema } from "@ai-sdk/provider-utils";
181
+ import { z as z2 } from "zod/v4";
182
+ import { lazyValidator as lazyValidator2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
172
183
  var name5 = "GatewayModelNotFoundError";
173
184
  var marker6 = `vercel.ai.gateway.error.${name5}`;
174
185
  var symbol6 = Symbol.for(marker6);
175
- var modelNotFoundParamSchema = lazyValidator(
176
- () => zodSchema(
177
- z.object({
178
- modelId: z.string()
186
+ var modelNotFoundParamSchema = lazyValidator2(
187
+ () => zodSchema2(
188
+ z2.object({
189
+ modelId: z2.string()
179
190
  })
180
191
  )
181
192
  );
@@ -249,9 +260,9 @@ var GatewayResponseError = class extends (_b8 = GatewayError, _a8 = symbol8, _b8
249
260
 
250
261
  // src/errors/create-gateway-error.ts
251
262
  import {
252
- lazyValidator as lazyValidator2,
263
+ lazyValidator as lazyValidator3,
253
264
  safeValidateTypes,
254
- zodSchema as zodSchema2
265
+ zodSchema as zodSchema3
255
266
  } from "@ai-sdk/provider-utils";
256
267
  async function createGatewayErrorFromResponse({
257
268
  response,
@@ -302,20 +313,30 @@ async function createGatewayErrorFromResponse({
302
313
  }
303
314
  case "internal_server_error":
304
315
  return new GatewayInternalServerError({ message, statusCode, cause });
305
- case "forbidden":
306
- return new GatewayForbiddenError({ message, statusCode, cause });
316
+ case "forbidden": {
317
+ const ruleResult = await safeValidateTypes({
318
+ value: validatedResponse.error.param,
319
+ schema: forbiddenParamSchema
320
+ });
321
+ return new GatewayForbiddenError({
322
+ message,
323
+ statusCode,
324
+ cause,
325
+ ruleId: ruleResult.success ? ruleResult.value.ruleId : void 0
326
+ });
327
+ }
307
328
  default:
308
329
  return new GatewayInternalServerError({ message, statusCode, cause });
309
330
  }
310
331
  }
311
- var gatewayErrorResponseSchema = lazyValidator2(
312
- () => zodSchema2(
313
- z2.object({
314
- error: z2.object({
315
- message: z2.string(),
316
- type: z2.string().nullish(),
317
- param: z2.unknown().nullish(),
318
- code: z2.union([z2.string(), z2.number()]).nullish()
332
+ var gatewayErrorResponseSchema = lazyValidator3(
333
+ () => zodSchema3(
334
+ z3.object({
335
+ error: z3.object({
336
+ message: z3.string(),
337
+ type: z3.string().nullish(),
338
+ param: z3.unknown().nullish(),
339
+ code: z3.union([z3.string(), z3.number()]).nullish()
319
340
  })
320
341
  })
321
342
  )
@@ -427,11 +448,11 @@ async function asGatewayError(error, authMethod) {
427
448
  }
428
449
 
429
450
  // src/errors/parse-auth-method.ts
430
- import { z as z3 } from "zod/v4";
451
+ import { z as z4 } from "zod/v4";
431
452
  import {
432
- lazyValidator as lazyValidator3,
453
+ lazyValidator as lazyValidator4,
433
454
  safeValidateTypes as safeValidateTypes2,
434
- zodSchema as zodSchema3
455
+ zodSchema as zodSchema4
435
456
  } from "@ai-sdk/provider-utils";
436
457
  var GATEWAY_AUTH_METHOD_HEADER = "ai-gateway-auth-method";
437
458
  async function parseAuthMethod(headers) {
@@ -441,8 +462,8 @@ async function parseAuthMethod(headers) {
441
462
  });
442
463
  return result.success ? result.value : void 0;
443
464
  }
444
- var gatewayAuthMethodSchema = lazyValidator3(
445
- () => zodSchema3(z3.union([z3.literal("api-key"), z3.literal("oidc")]))
465
+ var gatewayAuthMethodSchema = lazyValidator4(
466
+ () => zodSchema4(z4.union([z4.literal("api-key"), z4.literal("oidc")]))
446
467
  );
447
468
 
448
469
  // src/gateway-fetch-metadata.ts
@@ -450,11 +471,11 @@ import {
450
471
  createJsonErrorResponseHandler,
451
472
  createJsonResponseHandler,
452
473
  getFromApi,
453
- lazyValidator as lazyValidator4,
474
+ lazyValidator as lazyValidator5,
454
475
  resolve,
455
- zodSchema as zodSchema4
476
+ zodSchema as zodSchema5
456
477
  } from "@ai-sdk/provider-utils";
457
- import { z as z4 } from "zod/v4";
478
+ import { z as z5 } from "zod/v4";
458
479
 
459
480
  // src/gateway-model-entry.ts
460
481
  var KNOWN_MODEL_TYPES = ["embedding", "image", "language"];
@@ -473,7 +494,7 @@ var GatewayFetchMetadata = class {
473
494
  gatewayAvailableModelsResponseSchema
474
495
  ),
475
496
  failedResponseHandler: createJsonErrorResponseHandler({
476
- errorSchema: z4.any(),
497
+ errorSchema: z5.any(),
477
498
  errorToMessage: (data) => data
478
499
  }),
479
500
  fetch: this.config.fetch
@@ -493,7 +514,7 @@ var GatewayFetchMetadata = class {
493
514
  gatewayCreditsResponseSchema
494
515
  ),
495
516
  failedResponseHandler: createJsonErrorResponseHandler({
496
- errorSchema: z4.any(),
517
+ errorSchema: z5.any(),
497
518
  errorToMessage: (data) => data
498
519
  }),
499
520
  fetch: this.config.fetch
@@ -504,19 +525,19 @@ var GatewayFetchMetadata = class {
504
525
  }
505
526
  }
506
527
  };
507
- var gatewayAvailableModelsResponseSchema = lazyValidator4(
508
- () => zodSchema4(
509
- z4.object({
510
- models: z4.array(
511
- z4.object({
512
- id: z4.string(),
513
- name: z4.string(),
514
- description: z4.string().nullish(),
515
- pricing: z4.object({
516
- input: z4.string(),
517
- output: z4.string(),
518
- input_cache_read: z4.string().nullish(),
519
- input_cache_write: z4.string().nullish()
528
+ var gatewayAvailableModelsResponseSchema = lazyValidator5(
529
+ () => zodSchema5(
530
+ z5.object({
531
+ models: z5.array(
532
+ z5.object({
533
+ id: z5.string(),
534
+ name: z5.string(),
535
+ description: z5.string().nullish(),
536
+ pricing: z5.object({
537
+ input: z5.string(),
538
+ output: z5.string(),
539
+ input_cache_read: z5.string().nullish(),
540
+ input_cache_write: z5.string().nullish()
520
541
  }).transform(
521
542
  ({ input, output, input_cache_read, input_cache_write }) => ({
522
543
  input,
@@ -525,12 +546,12 @@ var gatewayAvailableModelsResponseSchema = lazyValidator4(
525
546
  ...input_cache_write ? { cacheCreationInputTokens: input_cache_write } : {}
526
547
  })
527
548
  ).nullish(),
528
- specification: z4.object({
529
- specificationVersion: z4.literal("v2"),
530
- provider: z4.string(),
531
- modelId: z4.string()
549
+ specification: z5.object({
550
+ specificationVersion: z5.literal("v2"),
551
+ provider: z5.string(),
552
+ modelId: z5.string()
532
553
  }),
533
- modelType: z4.string().nullish()
554
+ modelType: z5.string().nullish()
534
555
  })
535
556
  ).transform(
536
557
  (models) => models.filter(
@@ -540,11 +561,11 @@ var gatewayAvailableModelsResponseSchema = lazyValidator4(
540
561
  })
541
562
  )
542
563
  );
543
- var gatewayCreditsResponseSchema = lazyValidator4(
544
- () => zodSchema4(
545
- z4.object({
546
- balance: z4.string(),
547
- total_used: z4.string()
564
+ var gatewayCreditsResponseSchema = lazyValidator5(
565
+ () => zodSchema5(
566
+ z5.object({
567
+ balance: z5.string(),
568
+ total_used: z5.string()
548
569
  }).transform(({ balance, total_used }) => ({
549
570
  balance,
550
571
  totalUsed: total_used
@@ -559,9 +580,9 @@ import {
559
580
  getFromApi as getFromApi2,
560
581
  lazySchema,
561
582
  resolve as resolve2,
562
- zodSchema as zodSchema5
583
+ zodSchema as zodSchema6
563
584
  } from "@ai-sdk/provider-utils";
564
- import { z as z5 } from "zod/v4";
585
+ import { z as z6 } from "zod/v4";
565
586
  var GatewaySpendReport = class {
566
587
  constructor(config) {
567
588
  this.config = config;
@@ -600,7 +621,7 @@ var GatewaySpendReport = class {
600
621
  gatewaySpendReportResponseSchema
601
622
  ),
602
623
  failedResponseHandler: createJsonErrorResponseHandler2({
603
- errorSchema: z5.any(),
624
+ errorSchema: z6.any(),
604
625
  errorToMessage: (data) => data
605
626
  }),
606
627
  fetch: this.config.fetch
@@ -612,25 +633,25 @@ var GatewaySpendReport = class {
612
633
  }
613
634
  };
614
635
  var gatewaySpendReportResponseSchema = lazySchema(
615
- () => zodSchema5(
616
- z5.object({
617
- results: z5.array(
618
- z5.object({
619
- day: z5.string().optional(),
620
- hour: z5.string().optional(),
621
- user: z5.string().optional(),
622
- model: z5.string().optional(),
623
- tag: z5.string().optional(),
624
- provider: z5.string().optional(),
625
- credential_type: z5.enum(["byok", "system"]).optional(),
626
- total_cost: z5.number(),
627
- market_cost: z5.number().optional(),
628
- input_tokens: z5.number().optional(),
629
- output_tokens: z5.number().optional(),
630
- cached_input_tokens: z5.number().optional(),
631
- cache_creation_input_tokens: z5.number().optional(),
632
- reasoning_tokens: z5.number().optional(),
633
- request_count: z5.number().optional()
636
+ () => zodSchema6(
637
+ z6.object({
638
+ results: z6.array(
639
+ z6.object({
640
+ day: z6.string().optional(),
641
+ hour: z6.string().optional(),
642
+ user: z6.string().optional(),
643
+ model: z6.string().optional(),
644
+ tag: z6.string().optional(),
645
+ provider: z6.string().optional(),
646
+ credential_type: z6.enum(["byok", "system"]).optional(),
647
+ total_cost: z6.number(),
648
+ market_cost: z6.number().optional(),
649
+ input_tokens: z6.number().optional(),
650
+ output_tokens: z6.number().optional(),
651
+ cached_input_tokens: z6.number().optional(),
652
+ cache_creation_input_tokens: z6.number().optional(),
653
+ reasoning_tokens: z6.number().optional(),
654
+ request_count: z6.number().optional()
634
655
  }).transform(
635
656
  ({
636
657
  credential_type,
@@ -668,9 +689,9 @@ import {
668
689
  getFromApi as getFromApi3,
669
690
  lazySchema as lazySchema2,
670
691
  resolve as resolve3,
671
- zodSchema as zodSchema6
692
+ zodSchema as zodSchema7
672
693
  } from "@ai-sdk/provider-utils";
673
- import { z as z6 } from "zod/v4";
694
+ import { z as z7 } from "zod/v4";
674
695
  var GatewayGenerationInfoFetcher = class {
675
696
  constructor(config) {
676
697
  this.config = config;
@@ -685,7 +706,7 @@ var GatewayGenerationInfoFetcher = class {
685
706
  gatewayGenerationInfoResponseSchema
686
707
  ),
687
708
  failedResponseHandler: createJsonErrorResponseHandler3({
688
- errorSchema: z6.any(),
709
+ errorSchema: z7.any(),
689
710
  errorToMessage: (data) => data
690
711
  }),
691
712
  fetch: this.config.fetch
@@ -697,27 +718,27 @@ var GatewayGenerationInfoFetcher = class {
697
718
  }
698
719
  };
699
720
  var gatewayGenerationInfoResponseSchema = lazySchema2(
700
- () => zodSchema6(
701
- z6.object({
702
- data: z6.object({
703
- id: z6.string(),
704
- total_cost: z6.number(),
705
- upstream_inference_cost: z6.number(),
706
- usage: z6.number(),
707
- created_at: z6.string(),
708
- model: z6.string(),
709
- is_byok: z6.boolean(),
710
- provider_name: z6.string(),
711
- streamed: z6.boolean(),
712
- finish_reason: z6.string(),
713
- latency: z6.number(),
714
- generation_time: z6.number(),
715
- native_tokens_prompt: z6.number(),
716
- native_tokens_completion: z6.number(),
717
- native_tokens_reasoning: z6.number(),
718
- native_tokens_cached: z6.number(),
719
- native_tokens_cache_creation: z6.number(),
720
- billable_web_search_calls: z6.number()
721
+ () => zodSchema7(
722
+ z7.object({
723
+ data: z7.object({
724
+ id: z7.string(),
725
+ total_cost: z7.number(),
726
+ upstream_inference_cost: z7.number(),
727
+ usage: z7.number(),
728
+ created_at: z7.string(),
729
+ model: z7.string(),
730
+ is_byok: z7.boolean(),
731
+ provider_name: z7.string(),
732
+ streamed: z7.boolean(),
733
+ finish_reason: z7.string(),
734
+ latency: z7.number(),
735
+ generation_time: z7.number(),
736
+ native_tokens_prompt: z7.number(),
737
+ native_tokens_completion: z7.number(),
738
+ native_tokens_reasoning: z7.number(),
739
+ native_tokens_cached: z7.number(),
740
+ native_tokens_cache_creation: z7.number(),
741
+ billable_web_search_calls: z7.number()
721
742
  }).transform(
722
743
  ({
723
744
  total_cost,
@@ -764,7 +785,7 @@ import {
764
785
  postJsonToApi,
765
786
  resolve as resolve4
766
787
  } from "@ai-sdk/provider-utils";
767
- import { z as z7 } from "zod/v4";
788
+ import { z as z8 } from "zod/v4";
768
789
  var GatewayLanguageModel = class {
769
790
  constructor(modelId, config) {
770
791
  this.modelId = modelId;
@@ -800,9 +821,9 @@ var GatewayLanguageModel = class {
800
821
  await resolve4(this.config.o11yHeaders)
801
822
  ),
802
823
  body: args,
803
- successfulResponseHandler: createJsonResponseHandler4(z7.any()),
824
+ successfulResponseHandler: createJsonResponseHandler4(z8.any()),
804
825
  failedResponseHandler: createJsonErrorResponseHandler4({
805
- errorSchema: z7.any(),
826
+ errorSchema: z8.any(),
806
827
  errorToMessage: (data) => data
807
828
  }),
808
829
  ...abortSignal && { abortSignal },
@@ -832,9 +853,9 @@ var GatewayLanguageModel = class {
832
853
  await resolve4(this.config.o11yHeaders)
833
854
  ),
834
855
  body: args,
835
- successfulResponseHandler: createEventSourceResponseHandler(z7.any()),
856
+ successfulResponseHandler: createEventSourceResponseHandler(z8.any()),
836
857
  failedResponseHandler: createJsonErrorResponseHandler4({
837
- errorSchema: z7.any(),
858
+ errorSchema: z8.any(),
838
859
  errorToMessage: (data) => data
839
860
  }),
840
861
  ...abortSignal && { abortSignal },
@@ -916,12 +937,12 @@ import {
916
937
  combineHeaders as combineHeaders2,
917
938
  createJsonErrorResponseHandler as createJsonErrorResponseHandler5,
918
939
  createJsonResponseHandler as createJsonResponseHandler5,
919
- lazyValidator as lazyValidator5,
940
+ lazyValidator as lazyValidator6,
920
941
  postJsonToApi as postJsonToApi2,
921
942
  resolve as resolve5,
922
- zodSchema as zodSchema7
943
+ zodSchema as zodSchema8
923
944
  } from "@ai-sdk/provider-utils";
924
- import { z as z8 } from "zod/v4";
945
+ import { z as z9 } from "zod/v4";
925
946
  var GatewayEmbeddingModel = class {
926
947
  constructor(modelId, config) {
927
948
  this.modelId = modelId;
@@ -962,7 +983,7 @@ var GatewayEmbeddingModel = class {
962
983
  gatewayEmbeddingResponseSchema
963
984
  ),
964
985
  failedResponseHandler: createJsonErrorResponseHandler5({
965
- errorSchema: z8.any(),
986
+ errorSchema: z9.any(),
966
987
  errorToMessage: (data) => data
967
988
  }),
968
989
  ...abortSignal && { abortSignal },
@@ -988,12 +1009,12 @@ var GatewayEmbeddingModel = class {
988
1009
  };
989
1010
  }
990
1011
  };
991
- var gatewayEmbeddingResponseSchema = lazyValidator5(
992
- () => zodSchema7(
993
- z8.object({
994
- embeddings: z8.array(z8.array(z8.number())),
995
- usage: z8.object({ tokens: z8.number() }).nullish(),
996
- providerMetadata: z8.record(z8.string(), z8.record(z8.string(), z8.unknown())).optional()
1012
+ var gatewayEmbeddingResponseSchema = lazyValidator6(
1013
+ () => zodSchema8(
1014
+ z9.object({
1015
+ embeddings: z9.array(z9.array(z9.number())),
1016
+ usage: z9.object({ tokens: z9.number() }).nullish(),
1017
+ providerMetadata: z9.record(z9.string(), z9.record(z9.string(), z9.unknown())).optional()
997
1018
  })
998
1019
  )
999
1020
  );
@@ -1006,7 +1027,7 @@ import {
1006
1027
  postJsonToApi as postJsonToApi3,
1007
1028
  resolve as resolve6
1008
1029
  } from "@ai-sdk/provider-utils";
1009
- import { z as z9 } from "zod/v4";
1030
+ import { z as z10 } from "zod/v4";
1010
1031
  var GatewayImageModel = class {
1011
1032
  constructor(modelId, config) {
1012
1033
  this.modelId = modelId;
@@ -1055,7 +1076,7 @@ var GatewayImageModel = class {
1055
1076
  gatewayImageResponseSchema
1056
1077
  ),
1057
1078
  failedResponseHandler: createJsonErrorResponseHandler6({
1058
- errorSchema: z9.any(),
1079
+ errorSchema: z10.any(),
1059
1080
  errorToMessage: (data) => data
1060
1081
  }),
1061
1082
  ...abortSignal && { abortSignal },
@@ -1093,24 +1114,24 @@ var GatewayImageModel = class {
1093
1114
  };
1094
1115
  }
1095
1116
  };
1096
- var providerMetadataEntrySchema = z9.object({
1097
- images: z9.array(z9.unknown()).optional()
1098
- }).catchall(z9.unknown());
1099
- var gatewayImageUsageSchema = z9.object({
1100
- inputTokens: z9.number().nullish(),
1101
- outputTokens: z9.number().nullish(),
1102
- totalTokens: z9.number().nullish()
1117
+ var providerMetadataEntrySchema = z10.object({
1118
+ images: z10.array(z10.unknown()).optional()
1119
+ }).catchall(z10.unknown());
1120
+ var gatewayImageUsageSchema = z10.object({
1121
+ inputTokens: z10.number().nullish(),
1122
+ outputTokens: z10.number().nullish(),
1123
+ totalTokens: z10.number().nullish()
1103
1124
  });
1104
- var gatewayImageResponseSchema = z9.object({
1105
- images: z9.array(z9.string()),
1125
+ var gatewayImageResponseSchema = z10.object({
1126
+ images: z10.array(z10.string()),
1106
1127
  // Always base64 strings over the wire
1107
- warnings: z9.array(
1108
- z9.object({
1109
- type: z9.literal("other"),
1110
- message: z9.string()
1128
+ warnings: z10.array(
1129
+ z10.object({
1130
+ type: z10.literal("other"),
1131
+ message: z10.string()
1111
1132
  })
1112
1133
  ).optional(),
1113
- providerMetadata: z9.record(z9.string(), providerMetadataEntrySchema).optional(),
1134
+ providerMetadata: z10.record(z10.string(), providerMetadataEntrySchema).optional(),
1114
1135
  usage: gatewayImageUsageSchema.optional()
1115
1136
  });
1116
1137
 
@@ -1118,39 +1139,39 @@ var gatewayImageResponseSchema = z9.object({
1118
1139
  import {
1119
1140
  createProviderDefinedToolFactoryWithOutputSchema,
1120
1141
  lazySchema as lazySchema3,
1121
- zodSchema as zodSchema8
1142
+ zodSchema as zodSchema9
1122
1143
  } from "@ai-sdk/provider-utils";
1123
- import { z as z10 } from "zod";
1144
+ import { z as z11 } from "zod";
1124
1145
  var parallelSearchInputSchema = lazySchema3(
1125
- () => zodSchema8(
1126
- z10.object({
1127
- objective: z10.string().describe(
1146
+ () => zodSchema9(
1147
+ z11.object({
1148
+ objective: z11.string().describe(
1128
1149
  "Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
1129
1150
  ),
1130
- search_queries: z10.array(z10.string()).optional().describe(
1151
+ search_queries: z11.array(z11.string()).optional().describe(
1131
1152
  "Optional search queries to supplement the objective. Maximum 200 characters per query."
1132
1153
  ),
1133
- mode: z10.enum(["one-shot", "agentic"]).optional().describe(
1154
+ mode: z11.enum(["one-shot", "agentic"]).optional().describe(
1134
1155
  'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
1135
1156
  ),
1136
- max_results: z10.number().optional().describe(
1157
+ max_results: z11.number().optional().describe(
1137
1158
  "Maximum number of results to return (1-20). Defaults to 10 if not specified."
1138
1159
  ),
1139
- source_policy: z10.object({
1140
- include_domains: z10.array(z10.string()).optional().describe("List of domains to include in search results."),
1141
- exclude_domains: z10.array(z10.string()).optional().describe("List of domains to exclude from search results."),
1142
- after_date: z10.string().optional().describe(
1160
+ source_policy: z11.object({
1161
+ include_domains: z11.array(z11.string()).optional().describe("List of domains to include in search results."),
1162
+ exclude_domains: z11.array(z11.string()).optional().describe("List of domains to exclude from search results."),
1163
+ after_date: z11.string().optional().describe(
1143
1164
  "Only include results published after this date (ISO 8601 format)."
1144
1165
  )
1145
1166
  }).optional().describe(
1146
1167
  "Source policy for controlling which domains to include/exclude and freshness."
1147
1168
  ),
1148
- excerpts: z10.object({
1149
- max_chars_per_result: z10.number().optional().describe("Maximum characters per result."),
1150
- max_chars_total: z10.number().optional().describe("Maximum total characters across all results.")
1169
+ excerpts: z11.object({
1170
+ max_chars_per_result: z11.number().optional().describe("Maximum characters per result."),
1171
+ max_chars_total: z11.number().optional().describe("Maximum total characters across all results.")
1151
1172
  }).optional().describe("Excerpt configuration for controlling result length."),
1152
- fetch_policy: z10.object({
1153
- max_age_seconds: z10.number().optional().describe(
1173
+ fetch_policy: z11.object({
1174
+ max_age_seconds: z11.number().optional().describe(
1154
1175
  "Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
1155
1176
  )
1156
1177
  }).optional().describe("Fetch policy for controlling content freshness.")
@@ -1158,24 +1179,24 @@ var parallelSearchInputSchema = lazySchema3(
1158
1179
  )
1159
1180
  );
1160
1181
  var parallelSearchOutputSchema = lazySchema3(
1161
- () => zodSchema8(
1162
- z10.union([
1182
+ () => zodSchema9(
1183
+ z11.union([
1163
1184
  // Success response
1164
- z10.object({
1165
- searchId: z10.string(),
1166
- results: z10.array(
1167
- z10.object({
1168
- url: z10.string(),
1169
- title: z10.string(),
1170
- excerpt: z10.string(),
1171
- publishDate: z10.string().nullable().optional(),
1172
- relevanceScore: z10.number().optional()
1185
+ z11.object({
1186
+ searchId: z11.string(),
1187
+ results: z11.array(
1188
+ z11.object({
1189
+ url: z11.string(),
1190
+ title: z11.string(),
1191
+ excerpt: z11.string(),
1192
+ publishDate: z11.string().nullable().optional(),
1193
+ relevanceScore: z11.number().optional()
1173
1194
  })
1174
1195
  )
1175
1196
  }),
1176
1197
  // Error response
1177
- z10.object({
1178
- error: z10.enum([
1198
+ z11.object({
1199
+ error: z11.enum([
1179
1200
  "api_error",
1180
1201
  "rate_limit",
1181
1202
  "timeout",
@@ -1183,8 +1204,8 @@ var parallelSearchOutputSchema = lazySchema3(
1183
1204
  "configuration_error",
1184
1205
  "unknown"
1185
1206
  ]),
1186
- statusCode: z10.number().optional(),
1187
- message: z10.string()
1207
+ statusCode: z11.number().optional(),
1208
+ message: z11.string()
1188
1209
  })
1189
1210
  ])
1190
1211
  )
@@ -1201,78 +1222,78 @@ var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
1201
1222
  import {
1202
1223
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
1203
1224
  lazySchema as lazySchema4,
1204
- zodSchema as zodSchema9
1225
+ zodSchema as zodSchema10
1205
1226
  } from "@ai-sdk/provider-utils";
1206
- import { z as z11 } from "zod";
1227
+ import { z as z12 } from "zod";
1207
1228
  var perplexitySearchInputSchema = lazySchema4(
1208
- () => zodSchema9(
1209
- z11.object({
1210
- query: z11.union([z11.string(), z11.array(z11.string())]).describe(
1229
+ () => zodSchema10(
1230
+ z12.object({
1231
+ query: z12.union([z12.string(), z12.array(z12.string())]).describe(
1211
1232
  "Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
1212
1233
  ),
1213
- max_results: z11.number().optional().describe(
1234
+ max_results: z12.number().optional().describe(
1214
1235
  "Maximum number of search results to return (1-20, default: 10)"
1215
1236
  ),
1216
- max_tokens_per_page: z11.number().optional().describe(
1237
+ max_tokens_per_page: z12.number().optional().describe(
1217
1238
  "Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
1218
1239
  ),
1219
- max_tokens: z11.number().optional().describe(
1240
+ max_tokens: z12.number().optional().describe(
1220
1241
  "Maximum total tokens across all search results (default: 25000, max: 1000000)"
1221
1242
  ),
1222
- country: z11.string().optional().describe(
1243
+ country: z12.string().optional().describe(
1223
1244
  "Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
1224
1245
  ),
1225
- search_domain_filter: z11.array(z11.string()).optional().describe(
1246
+ search_domain_filter: z12.array(z12.string()).optional().describe(
1226
1247
  "List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
1227
1248
  ),
1228
- search_language_filter: z11.array(z11.string()).optional().describe(
1249
+ search_language_filter: z12.array(z12.string()).optional().describe(
1229
1250
  "List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
1230
1251
  ),
1231
- search_after_date: z11.string().optional().describe(
1252
+ search_after_date: z12.string().optional().describe(
1232
1253
  "Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
1233
1254
  ),
1234
- search_before_date: z11.string().optional().describe(
1255
+ search_before_date: z12.string().optional().describe(
1235
1256
  "Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
1236
1257
  ),
1237
- last_updated_after_filter: z11.string().optional().describe(
1258
+ last_updated_after_filter: z12.string().optional().describe(
1238
1259
  "Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
1239
1260
  ),
1240
- last_updated_before_filter: z11.string().optional().describe(
1261
+ last_updated_before_filter: z12.string().optional().describe(
1241
1262
  "Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
1242
1263
  ),
1243
- search_recency_filter: z11.enum(["day", "week", "month", "year"]).optional().describe(
1264
+ search_recency_filter: z12.enum(["day", "week", "month", "year"]).optional().describe(
1244
1265
  "Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
1245
1266
  )
1246
1267
  })
1247
1268
  )
1248
1269
  );
1249
1270
  var perplexitySearchOutputSchema = lazySchema4(
1250
- () => zodSchema9(
1251
- z11.union([
1271
+ () => zodSchema10(
1272
+ z12.union([
1252
1273
  // Success response
1253
- z11.object({
1254
- results: z11.array(
1255
- z11.object({
1256
- title: z11.string(),
1257
- url: z11.string(),
1258
- snippet: z11.string(),
1259
- date: z11.string().optional(),
1260
- lastUpdated: z11.string().optional()
1274
+ z12.object({
1275
+ results: z12.array(
1276
+ z12.object({
1277
+ title: z12.string(),
1278
+ url: z12.string(),
1279
+ snippet: z12.string(),
1280
+ date: z12.string().optional(),
1281
+ lastUpdated: z12.string().optional()
1261
1282
  })
1262
1283
  ),
1263
- id: z11.string()
1284
+ id: z12.string()
1264
1285
  }),
1265
1286
  // Error response
1266
- z11.object({
1267
- error: z11.enum([
1287
+ z12.object({
1288
+ error: z12.enum([
1268
1289
  "api_error",
1269
1290
  "rate_limit",
1270
1291
  "timeout",
1271
1292
  "invalid_input",
1272
1293
  "unknown"
1273
1294
  ]),
1274
- statusCode: z11.number().optional(),
1275
- message: z11.string()
1295
+ statusCode: z12.number().optional(),
1296
+ message: z12.string()
1276
1297
  })
1277
1298
  ])
1278
1299
  )
@@ -1315,7 +1336,7 @@ async function getVercelRequestId() {
1315
1336
  }
1316
1337
 
1317
1338
  // src/version.ts
1318
- var VERSION = true ? "2.0.108" : "0.0.0-test";
1339
+ var VERSION = true ? "2.0.110" : "0.0.0-test";
1319
1340
 
1320
1341
  // src/gateway-provider.ts
1321
1342
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";