@ai-sdk/gateway 0.0.0-02dba89b-20251009204516 → 0.0.0-4115c213-20260122152721
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/CHANGELOG.md +886 -167
- package/dist/index.d.mts +205 -34
- package/dist/index.d.ts +205 -34
- package/dist/index.js +459 -180
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +450 -148
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +625 -0
- package/package.json +19 -6
- package/src/errors/as-gateway-error.ts +33 -0
- package/src/errors/create-gateway-error.ts +132 -0
- package/src/errors/extract-api-call-response.ts +15 -0
- package/src/errors/gateway-authentication-error.ts +84 -0
- package/src/errors/gateway-error.ts +47 -0
- package/src/errors/gateway-internal-server-error.ts +33 -0
- package/src/errors/gateway-invalid-request-error.ts +33 -0
- package/src/errors/gateway-model-not-found-error.ts +47 -0
- package/src/errors/gateway-rate-limit-error.ts +33 -0
- package/src/errors/gateway-response-error.ts +42 -0
- package/src/errors/index.ts +16 -0
- package/src/errors/parse-auth-method.ts +23 -0
- package/src/gateway-config.ts +7 -0
- package/src/gateway-embedding-model-settings.ts +22 -0
- package/src/gateway-embedding-model.ts +109 -0
- package/src/gateway-fetch-metadata.ts +127 -0
- package/src/gateway-image-model-settings.ts +12 -0
- package/src/gateway-image-model.ts +145 -0
- package/src/gateway-language-model-settings.ts +159 -0
- package/src/gateway-language-model.ts +212 -0
- package/src/gateway-model-entry.ts +58 -0
- package/src/gateway-provider-options.ts +66 -0
- package/src/gateway-provider.ts +284 -0
- package/src/gateway-tools.ts +15 -0
- package/src/index.ts +27 -0
- package/src/tool/perplexity-search.ts +294 -0
- package/src/vercel-environment.ts +6 -0
- package/src/version.ts +6 -0
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// src/gateway-provider.ts
|
|
2
|
-
import { NoSuchModelError } from "@ai-sdk/provider";
|
|
3
2
|
import {
|
|
4
3
|
loadOptionalSetting,
|
|
5
4
|
withoutTrailingSlash
|
|
@@ -19,12 +18,14 @@ var GatewayError = class _GatewayError extends (_b = Error, _a = symbol, _b) {
|
|
|
19
18
|
constructor({
|
|
20
19
|
message,
|
|
21
20
|
statusCode = 500,
|
|
22
|
-
cause
|
|
21
|
+
cause,
|
|
22
|
+
generationId
|
|
23
23
|
}) {
|
|
24
|
-
super(message);
|
|
24
|
+
super(generationId ? `${message} [${generationId}]` : message);
|
|
25
25
|
this[_a] = true;
|
|
26
26
|
this.statusCode = statusCode;
|
|
27
27
|
this.cause = cause;
|
|
28
|
+
this.generationId = generationId;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
31
|
* Checks if the given error is a Gateway Error.
|
|
@@ -48,9 +49,10 @@ var GatewayAuthenticationError = class _GatewayAuthenticationError extends (_b2
|
|
|
48
49
|
constructor({
|
|
49
50
|
message = "Authentication failed",
|
|
50
51
|
statusCode = 401,
|
|
51
|
-
cause
|
|
52
|
+
cause,
|
|
53
|
+
generationId
|
|
52
54
|
} = {}) {
|
|
53
|
-
super({ message, statusCode, cause });
|
|
55
|
+
super({ message, statusCode, cause, generationId });
|
|
54
56
|
this[_a2] = true;
|
|
55
57
|
// used in isInstance
|
|
56
58
|
this.name = name;
|
|
@@ -67,44 +69,37 @@ var GatewayAuthenticationError = class _GatewayAuthenticationError extends (_b2
|
|
|
67
69
|
oidcTokenProvided,
|
|
68
70
|
message = "Authentication failed",
|
|
69
71
|
statusCode = 401,
|
|
70
|
-
cause
|
|
72
|
+
cause,
|
|
73
|
+
generationId
|
|
71
74
|
}) {
|
|
72
75
|
let contextualMessage;
|
|
73
76
|
if (apiKeyProvided) {
|
|
74
|
-
contextualMessage = `AI Gateway authentication failed: Invalid API key
|
|
77
|
+
contextualMessage = `AI Gateway authentication failed: Invalid API key.
|
|
75
78
|
|
|
76
|
-
|
|
79
|
+
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
80
|
+
|
|
81
|
+
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`;
|
|
77
82
|
} else if (oidcTokenProvided) {
|
|
78
|
-
contextualMessage = `AI Gateway authentication failed: Invalid OIDC token
|
|
83
|
+
contextualMessage = `AI Gateway authentication failed: Invalid OIDC token.
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
- make sure your Vercel project settings have OIDC enabled
|
|
82
|
-
- if running locally with 'vercel dev', the token is automatically obtained and refreshed
|
|
83
|
-
- if running locally with your own dev server, run 'vercel env pull' to fetch the token
|
|
84
|
-
- in production/preview, the token is automatically obtained and refreshed
|
|
85
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`;
|
|
87
88
|
} else {
|
|
88
89
|
contextualMessage = `AI Gateway authentication failed: No authentication provided.
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
The token is expected to be provided via the 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
|
|
95
|
-
|
|
96
|
-
OIDC token instructions:
|
|
91
|
+
Option 1 - API key:
|
|
92
|
+
Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
93
|
+
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
- if running locally with 'vercel dev', the token is automatically obtained and refreshed
|
|
101
|
-
- if running locally with your own dev server, run 'vercel env pull' to fetch the token
|
|
102
|
-
- in production/preview, the token is automatically obtained and refreshed`;
|
|
95
|
+
Option 2 - OIDC token:
|
|
96
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`;
|
|
103
97
|
}
|
|
104
98
|
return new _GatewayAuthenticationError({
|
|
105
99
|
message: contextualMessage,
|
|
106
100
|
statusCode,
|
|
107
|
-
cause
|
|
101
|
+
cause,
|
|
102
|
+
generationId
|
|
108
103
|
});
|
|
109
104
|
}
|
|
110
105
|
};
|
|
@@ -118,9 +113,10 @@ var GatewayInvalidRequestError = class extends (_b3 = GatewayError, _a3 = symbol
|
|
|
118
113
|
constructor({
|
|
119
114
|
message = "Invalid request",
|
|
120
115
|
statusCode = 400,
|
|
121
|
-
cause
|
|
116
|
+
cause,
|
|
117
|
+
generationId
|
|
122
118
|
} = {}) {
|
|
123
|
-
super({ message, statusCode, cause });
|
|
119
|
+
super({ message, statusCode, cause, generationId });
|
|
124
120
|
this[_a3] = true;
|
|
125
121
|
// used in isInstance
|
|
126
122
|
this.name = name2;
|
|
@@ -140,9 +136,10 @@ var GatewayRateLimitError = class extends (_b4 = GatewayError, _a4 = symbol4, _b
|
|
|
140
136
|
constructor({
|
|
141
137
|
message = "Rate limit exceeded",
|
|
142
138
|
statusCode = 429,
|
|
143
|
-
cause
|
|
139
|
+
cause,
|
|
140
|
+
generationId
|
|
144
141
|
} = {}) {
|
|
145
|
-
super({ message, statusCode, cause });
|
|
142
|
+
super({ message, statusCode, cause, generationId });
|
|
146
143
|
this[_a4] = true;
|
|
147
144
|
// used in isInstance
|
|
148
145
|
this.name = name3;
|
|
@@ -155,21 +152,27 @@ var GatewayRateLimitError = class extends (_b4 = GatewayError, _a4 = symbol4, _b
|
|
|
155
152
|
|
|
156
153
|
// src/errors/gateway-model-not-found-error.ts
|
|
157
154
|
import { z } from "zod/v4";
|
|
155
|
+
import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
|
|
158
156
|
var name4 = "GatewayModelNotFoundError";
|
|
159
157
|
var marker5 = `vercel.ai.gateway.error.${name4}`;
|
|
160
158
|
var symbol5 = Symbol.for(marker5);
|
|
161
|
-
var modelNotFoundParamSchema =
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
var modelNotFoundParamSchema = lazySchema(
|
|
160
|
+
() => zodSchema(
|
|
161
|
+
z.object({
|
|
162
|
+
modelId: z.string()
|
|
163
|
+
})
|
|
164
|
+
)
|
|
165
|
+
);
|
|
164
166
|
var _a5, _b5;
|
|
165
167
|
var GatewayModelNotFoundError = class extends (_b5 = GatewayError, _a5 = symbol5, _b5) {
|
|
166
168
|
constructor({
|
|
167
169
|
message = "Model not found",
|
|
168
170
|
statusCode = 404,
|
|
169
171
|
modelId,
|
|
170
|
-
cause
|
|
172
|
+
cause,
|
|
173
|
+
generationId
|
|
171
174
|
} = {}) {
|
|
172
|
-
super({ message, statusCode, cause });
|
|
175
|
+
super({ message, statusCode, cause, generationId });
|
|
173
176
|
this[_a5] = true;
|
|
174
177
|
// used in isInstance
|
|
175
178
|
this.name = name4;
|
|
@@ -190,9 +193,10 @@ var GatewayInternalServerError = class extends (_b6 = GatewayError, _a6 = symbol
|
|
|
190
193
|
constructor({
|
|
191
194
|
message = "Internal server error",
|
|
192
195
|
statusCode = 500,
|
|
193
|
-
cause
|
|
196
|
+
cause,
|
|
197
|
+
generationId
|
|
194
198
|
} = {}) {
|
|
195
|
-
super({ message, statusCode, cause });
|
|
199
|
+
super({ message, statusCode, cause, generationId });
|
|
196
200
|
this[_a6] = true;
|
|
197
201
|
// used in isInstance
|
|
198
202
|
this.name = name5;
|
|
@@ -214,9 +218,10 @@ var GatewayResponseError = class extends (_b7 = GatewayError, _a7 = symbol7, _b7
|
|
|
214
218
|
statusCode = 502,
|
|
215
219
|
response,
|
|
216
220
|
validationError,
|
|
217
|
-
cause
|
|
221
|
+
cause,
|
|
222
|
+
generationId
|
|
218
223
|
} = {}) {
|
|
219
|
-
super({ message, statusCode, cause });
|
|
224
|
+
super({ message, statusCode, cause, generationId });
|
|
220
225
|
this[_a7] = true;
|
|
221
226
|
// used in isInstance
|
|
222
227
|
this.name = name6;
|
|
@@ -230,63 +235,103 @@ var GatewayResponseError = class extends (_b7 = GatewayError, _a7 = symbol7, _b7
|
|
|
230
235
|
};
|
|
231
236
|
|
|
232
237
|
// src/errors/create-gateway-error.ts
|
|
233
|
-
|
|
238
|
+
import {
|
|
239
|
+
lazySchema as lazySchema2,
|
|
240
|
+
safeValidateTypes,
|
|
241
|
+
zodSchema as zodSchema2
|
|
242
|
+
} from "@ai-sdk/provider-utils";
|
|
243
|
+
async function createGatewayErrorFromResponse({
|
|
234
244
|
response,
|
|
235
245
|
statusCode,
|
|
236
246
|
defaultMessage = "Gateway request failed",
|
|
237
247
|
cause,
|
|
238
248
|
authMethod
|
|
239
249
|
}) {
|
|
240
|
-
|
|
250
|
+
var _a8;
|
|
251
|
+
const parseResult = await safeValidateTypes({
|
|
252
|
+
value: response,
|
|
253
|
+
schema: gatewayErrorResponseSchema
|
|
254
|
+
});
|
|
241
255
|
if (!parseResult.success) {
|
|
256
|
+
const rawGenerationId = typeof response === "object" && response !== null && "generationId" in response ? response.generationId : void 0;
|
|
242
257
|
return new GatewayResponseError({
|
|
243
258
|
message: `Invalid error response format: ${defaultMessage}`,
|
|
244
259
|
statusCode,
|
|
245
260
|
response,
|
|
246
261
|
validationError: parseResult.error,
|
|
247
|
-
cause
|
|
262
|
+
cause,
|
|
263
|
+
generationId: rawGenerationId
|
|
248
264
|
});
|
|
249
265
|
}
|
|
250
|
-
const validatedResponse = parseResult.
|
|
266
|
+
const validatedResponse = parseResult.value;
|
|
251
267
|
const errorType = validatedResponse.error.type;
|
|
252
268
|
const message = validatedResponse.error.message;
|
|
269
|
+
const generationId = (_a8 = validatedResponse.generationId) != null ? _a8 : void 0;
|
|
253
270
|
switch (errorType) {
|
|
254
271
|
case "authentication_error":
|
|
255
272
|
return GatewayAuthenticationError.createContextualError({
|
|
256
273
|
apiKeyProvided: authMethod === "api-key",
|
|
257
274
|
oidcTokenProvided: authMethod === "oidc",
|
|
258
275
|
statusCode,
|
|
259
|
-
cause
|
|
276
|
+
cause,
|
|
277
|
+
generationId
|
|
260
278
|
});
|
|
261
279
|
case "invalid_request_error":
|
|
262
|
-
return new GatewayInvalidRequestError({
|
|
280
|
+
return new GatewayInvalidRequestError({
|
|
281
|
+
message,
|
|
282
|
+
statusCode,
|
|
283
|
+
cause,
|
|
284
|
+
generationId
|
|
285
|
+
});
|
|
263
286
|
case "rate_limit_exceeded":
|
|
264
|
-
return new GatewayRateLimitError({
|
|
287
|
+
return new GatewayRateLimitError({
|
|
288
|
+
message,
|
|
289
|
+
statusCode,
|
|
290
|
+
cause,
|
|
291
|
+
generationId
|
|
292
|
+
});
|
|
265
293
|
case "model_not_found": {
|
|
266
|
-
const modelResult =
|
|
267
|
-
validatedResponse.error.param
|
|
268
|
-
|
|
294
|
+
const modelResult = await safeValidateTypes({
|
|
295
|
+
value: validatedResponse.error.param,
|
|
296
|
+
schema: modelNotFoundParamSchema
|
|
297
|
+
});
|
|
269
298
|
return new GatewayModelNotFoundError({
|
|
270
299
|
message,
|
|
271
300
|
statusCode,
|
|
272
|
-
modelId: modelResult.success ? modelResult.
|
|
273
|
-
cause
|
|
301
|
+
modelId: modelResult.success ? modelResult.value.modelId : void 0,
|
|
302
|
+
cause,
|
|
303
|
+
generationId
|
|
274
304
|
});
|
|
275
305
|
}
|
|
276
306
|
case "internal_server_error":
|
|
277
|
-
return new GatewayInternalServerError({
|
|
307
|
+
return new GatewayInternalServerError({
|
|
308
|
+
message,
|
|
309
|
+
statusCode,
|
|
310
|
+
cause,
|
|
311
|
+
generationId
|
|
312
|
+
});
|
|
278
313
|
default:
|
|
279
|
-
return new GatewayInternalServerError({
|
|
314
|
+
return new GatewayInternalServerError({
|
|
315
|
+
message,
|
|
316
|
+
statusCode,
|
|
317
|
+
cause,
|
|
318
|
+
generationId
|
|
319
|
+
});
|
|
280
320
|
}
|
|
281
321
|
}
|
|
282
|
-
var gatewayErrorResponseSchema =
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
322
|
+
var gatewayErrorResponseSchema = lazySchema2(
|
|
323
|
+
() => zodSchema2(
|
|
324
|
+
z2.object({
|
|
325
|
+
error: z2.object({
|
|
326
|
+
message: z2.string(),
|
|
327
|
+
type: z2.string().nullish(),
|
|
328
|
+
param: z2.unknown().nullish(),
|
|
329
|
+
code: z2.union([z2.string(), z2.number()]).nullish()
|
|
330
|
+
}),
|
|
331
|
+
generationId: z2.string().nullish()
|
|
332
|
+
})
|
|
333
|
+
)
|
|
334
|
+
);
|
|
290
335
|
|
|
291
336
|
// src/errors/as-gateway-error.ts
|
|
292
337
|
function asGatewayError(error, authMethod) {
|
|
@@ -329,24 +374,31 @@ function extractApiCallResponse(error) {
|
|
|
329
374
|
|
|
330
375
|
// src/errors/parse-auth-method.ts
|
|
331
376
|
import { z as z3 } from "zod/v4";
|
|
377
|
+
import {
|
|
378
|
+
lazySchema as lazySchema3,
|
|
379
|
+
safeValidateTypes as safeValidateTypes2,
|
|
380
|
+
zodSchema as zodSchema3
|
|
381
|
+
} from "@ai-sdk/provider-utils";
|
|
332
382
|
var GATEWAY_AUTH_METHOD_HEADER = "ai-gateway-auth-method";
|
|
333
|
-
function parseAuthMethod(headers) {
|
|
334
|
-
const result =
|
|
335
|
-
headers[GATEWAY_AUTH_METHOD_HEADER]
|
|
336
|
-
|
|
337
|
-
|
|
383
|
+
async function parseAuthMethod(headers) {
|
|
384
|
+
const result = await safeValidateTypes2({
|
|
385
|
+
value: headers[GATEWAY_AUTH_METHOD_HEADER],
|
|
386
|
+
schema: gatewayAuthMethodSchema
|
|
387
|
+
});
|
|
388
|
+
return result.success ? result.value : void 0;
|
|
338
389
|
}
|
|
339
|
-
var gatewayAuthMethodSchema =
|
|
340
|
-
z3.literal("api-key"),
|
|
341
|
-
|
|
342
|
-
]);
|
|
390
|
+
var gatewayAuthMethodSchema = lazySchema3(
|
|
391
|
+
() => zodSchema3(z3.union([z3.literal("api-key"), z3.literal("oidc")]))
|
|
392
|
+
);
|
|
343
393
|
|
|
344
394
|
// src/gateway-fetch-metadata.ts
|
|
345
395
|
import {
|
|
346
396
|
createJsonErrorResponseHandler,
|
|
347
397
|
createJsonResponseHandler,
|
|
348
398
|
getFromApi,
|
|
349
|
-
|
|
399
|
+
lazySchema as lazySchema4,
|
|
400
|
+
resolve,
|
|
401
|
+
zodSchema as zodSchema4
|
|
350
402
|
} from "@ai-sdk/provider-utils";
|
|
351
403
|
import { z as z4 } from "zod/v4";
|
|
352
404
|
var GatewayFetchMetadata = class {
|
|
@@ -359,7 +411,7 @@ var GatewayFetchMetadata = class {
|
|
|
359
411
|
url: `${this.config.baseURL}/config`,
|
|
360
412
|
headers: await resolve(this.config.headers()),
|
|
361
413
|
successfulResponseHandler: createJsonResponseHandler(
|
|
362
|
-
|
|
414
|
+
gatewayAvailableModelsResponseSchema
|
|
363
415
|
),
|
|
364
416
|
failedResponseHandler: createJsonErrorResponseHandler({
|
|
365
417
|
errorSchema: z4.any(),
|
|
@@ -369,7 +421,7 @@ var GatewayFetchMetadata = class {
|
|
|
369
421
|
});
|
|
370
422
|
return value;
|
|
371
423
|
} catch (error) {
|
|
372
|
-
throw asGatewayError(error);
|
|
424
|
+
throw await asGatewayError(error);
|
|
373
425
|
}
|
|
374
426
|
}
|
|
375
427
|
async getCredits() {
|
|
@@ -378,7 +430,9 @@ var GatewayFetchMetadata = class {
|
|
|
378
430
|
const { value } = await getFromApi({
|
|
379
431
|
url: `${baseUrl.origin}/v1/credits`,
|
|
380
432
|
headers: await resolve(this.config.headers()),
|
|
381
|
-
successfulResponseHandler: createJsonResponseHandler(
|
|
433
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
434
|
+
gatewayCreditsResponseSchema
|
|
435
|
+
),
|
|
382
436
|
failedResponseHandler: createJsonErrorResponseHandler({
|
|
383
437
|
errorSchema: z4.any(),
|
|
384
438
|
errorToMessage: (data) => data
|
|
@@ -387,44 +441,53 @@ var GatewayFetchMetadata = class {
|
|
|
387
441
|
});
|
|
388
442
|
return value;
|
|
389
443
|
} catch (error) {
|
|
390
|
-
throw asGatewayError(error);
|
|
444
|
+
throw await asGatewayError(error);
|
|
391
445
|
}
|
|
392
446
|
}
|
|
393
447
|
};
|
|
394
|
-
var
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
448
|
+
var gatewayAvailableModelsResponseSchema = lazySchema4(
|
|
449
|
+
() => zodSchema4(
|
|
450
|
+
z4.object({
|
|
451
|
+
models: z4.array(
|
|
452
|
+
z4.object({
|
|
453
|
+
id: z4.string(),
|
|
454
|
+
name: z4.string(),
|
|
455
|
+
description: z4.string().nullish(),
|
|
456
|
+
pricing: z4.object({
|
|
457
|
+
input: z4.string(),
|
|
458
|
+
output: z4.string(),
|
|
459
|
+
input_cache_read: z4.string().nullish(),
|
|
460
|
+
input_cache_write: z4.string().nullish()
|
|
461
|
+
}).transform(
|
|
462
|
+
({ input, output, input_cache_read, input_cache_write }) => ({
|
|
463
|
+
input,
|
|
464
|
+
output,
|
|
465
|
+
...input_cache_read ? { cachedInputTokens: input_cache_read } : {},
|
|
466
|
+
...input_cache_write ? { cacheCreationInputTokens: input_cache_write } : {}
|
|
467
|
+
})
|
|
468
|
+
).nullish(),
|
|
469
|
+
specification: z4.object({
|
|
470
|
+
specificationVersion: z4.literal("v3"),
|
|
471
|
+
provider: z4.string(),
|
|
472
|
+
modelId: z4.string()
|
|
473
|
+
}),
|
|
474
|
+
modelType: z4.enum(["language", "embedding", "image"]).nullish()
|
|
475
|
+
})
|
|
476
|
+
)
|
|
477
|
+
})
|
|
478
|
+
)
|
|
479
|
+
);
|
|
480
|
+
var gatewayCreditsResponseSchema = lazySchema4(
|
|
481
|
+
() => zodSchema4(
|
|
482
|
+
z4.object({
|
|
483
|
+
balance: z4.string(),
|
|
484
|
+
total_used: z4.string()
|
|
485
|
+
}).transform(({ balance, total_used }) => ({
|
|
486
|
+
balance,
|
|
487
|
+
totalUsed: total_used
|
|
488
|
+
}))
|
|
489
|
+
)
|
|
490
|
+
);
|
|
428
491
|
|
|
429
492
|
// src/gateway-language-model.ts
|
|
430
493
|
import {
|
|
@@ -440,7 +503,7 @@ var GatewayLanguageModel = class {
|
|
|
440
503
|
constructor(modelId, config) {
|
|
441
504
|
this.modelId = modelId;
|
|
442
505
|
this.config = config;
|
|
443
|
-
this.specificationVersion = "
|
|
506
|
+
this.specificationVersion = "v3";
|
|
444
507
|
this.supportedUrls = { "*/*": [/.*/] };
|
|
445
508
|
}
|
|
446
509
|
get provider() {
|
|
@@ -486,7 +549,7 @@ var GatewayLanguageModel = class {
|
|
|
486
549
|
warnings
|
|
487
550
|
};
|
|
488
551
|
} catch (error) {
|
|
489
|
-
throw asGatewayError(error, parseAuthMethod(resolvedHeaders));
|
|
552
|
+
throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders));
|
|
490
553
|
}
|
|
491
554
|
}
|
|
492
555
|
async doStream(options) {
|
|
@@ -541,7 +604,7 @@ var GatewayLanguageModel = class {
|
|
|
541
604
|
response: { headers: responseHeaders }
|
|
542
605
|
};
|
|
543
606
|
} catch (error) {
|
|
544
|
-
throw asGatewayError(error, parseAuthMethod(resolvedHeaders));
|
|
607
|
+
throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders));
|
|
545
608
|
}
|
|
546
609
|
}
|
|
547
610
|
isFilePart(part) {
|
|
@@ -575,7 +638,7 @@ var GatewayLanguageModel = class {
|
|
|
575
638
|
}
|
|
576
639
|
getModelConfigHeaders(modelId, streaming) {
|
|
577
640
|
return {
|
|
578
|
-
"ai-language-model-specification-version": "
|
|
641
|
+
"ai-language-model-specification-version": "3",
|
|
579
642
|
"ai-language-model-id": modelId,
|
|
580
643
|
"ai-language-model-streaming": String(streaming)
|
|
581
644
|
};
|
|
@@ -585,17 +648,19 @@ var GatewayLanguageModel = class {
|
|
|
585
648
|
// src/gateway-embedding-model.ts
|
|
586
649
|
import {
|
|
587
650
|
combineHeaders as combineHeaders2,
|
|
588
|
-
createJsonResponseHandler as createJsonResponseHandler3,
|
|
589
651
|
createJsonErrorResponseHandler as createJsonErrorResponseHandler3,
|
|
652
|
+
createJsonResponseHandler as createJsonResponseHandler3,
|
|
653
|
+
lazySchema as lazySchema5,
|
|
590
654
|
postJsonToApi as postJsonToApi2,
|
|
591
|
-
resolve as resolve3
|
|
655
|
+
resolve as resolve3,
|
|
656
|
+
zodSchema as zodSchema5
|
|
592
657
|
} from "@ai-sdk/provider-utils";
|
|
593
658
|
import { z as z6 } from "zod/v4";
|
|
594
659
|
var GatewayEmbeddingModel = class {
|
|
595
660
|
constructor(modelId, config) {
|
|
596
661
|
this.modelId = modelId;
|
|
597
662
|
this.config = config;
|
|
598
|
-
this.specificationVersion = "
|
|
663
|
+
this.specificationVersion = "v3";
|
|
599
664
|
this.maxEmbeddingsPerCall = 2048;
|
|
600
665
|
this.supportsParallelCalls = true;
|
|
601
666
|
}
|
|
@@ -624,7 +689,7 @@ var GatewayEmbeddingModel = class {
|
|
|
624
689
|
await resolve3(this.config.o11yHeaders)
|
|
625
690
|
),
|
|
626
691
|
body: {
|
|
627
|
-
|
|
692
|
+
values,
|
|
628
693
|
...providerOptions ? { providerOptions } : {}
|
|
629
694
|
},
|
|
630
695
|
successfulResponseHandler: createJsonResponseHandler3(
|
|
@@ -641,10 +706,11 @@ var GatewayEmbeddingModel = class {
|
|
|
641
706
|
embeddings: responseBody.embeddings,
|
|
642
707
|
usage: (_a8 = responseBody.usage) != null ? _a8 : void 0,
|
|
643
708
|
providerMetadata: responseBody.providerMetadata,
|
|
644
|
-
response: { headers: responseHeaders, body: rawValue }
|
|
709
|
+
response: { headers: responseHeaders, body: rawValue },
|
|
710
|
+
warnings: []
|
|
645
711
|
};
|
|
646
712
|
} catch (error) {
|
|
647
|
-
throw asGatewayError(error, parseAuthMethod(resolvedHeaders));
|
|
713
|
+
throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders));
|
|
648
714
|
}
|
|
649
715
|
}
|
|
650
716
|
getUrl() {
|
|
@@ -652,16 +718,238 @@ var GatewayEmbeddingModel = class {
|
|
|
652
718
|
}
|
|
653
719
|
getModelConfigHeaders() {
|
|
654
720
|
return {
|
|
655
|
-
"ai-embedding-model-specification-version": "
|
|
721
|
+
"ai-embedding-model-specification-version": "3",
|
|
656
722
|
"ai-model-id": this.modelId
|
|
657
723
|
};
|
|
658
724
|
}
|
|
659
725
|
};
|
|
660
|
-
var gatewayEmbeddingResponseSchema =
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
726
|
+
var gatewayEmbeddingResponseSchema = lazySchema5(
|
|
727
|
+
() => zodSchema5(
|
|
728
|
+
z6.object({
|
|
729
|
+
embeddings: z6.array(z6.array(z6.number())),
|
|
730
|
+
usage: z6.object({ tokens: z6.number() }).nullish(),
|
|
731
|
+
providerMetadata: z6.record(z6.string(), z6.record(z6.string(), z6.unknown())).optional()
|
|
732
|
+
})
|
|
733
|
+
)
|
|
734
|
+
);
|
|
735
|
+
|
|
736
|
+
// src/gateway-image-model.ts
|
|
737
|
+
import {
|
|
738
|
+
combineHeaders as combineHeaders3,
|
|
739
|
+
convertUint8ArrayToBase64,
|
|
740
|
+
createJsonResponseHandler as createJsonResponseHandler4,
|
|
741
|
+
createJsonErrorResponseHandler as createJsonErrorResponseHandler4,
|
|
742
|
+
postJsonToApi as postJsonToApi3,
|
|
743
|
+
resolve as resolve4
|
|
744
|
+
} from "@ai-sdk/provider-utils";
|
|
745
|
+
import { z as z7 } from "zod/v4";
|
|
746
|
+
var GatewayImageModel = class {
|
|
747
|
+
constructor(modelId, config) {
|
|
748
|
+
this.modelId = modelId;
|
|
749
|
+
this.config = config;
|
|
750
|
+
this.specificationVersion = "v3";
|
|
751
|
+
// Set a very large number to prevent client-side splitting of requests
|
|
752
|
+
this.maxImagesPerCall = Number.MAX_SAFE_INTEGER;
|
|
753
|
+
}
|
|
754
|
+
get provider() {
|
|
755
|
+
return this.config.provider;
|
|
756
|
+
}
|
|
757
|
+
async doGenerate({
|
|
758
|
+
prompt,
|
|
759
|
+
n,
|
|
760
|
+
size,
|
|
761
|
+
aspectRatio,
|
|
762
|
+
seed,
|
|
763
|
+
files,
|
|
764
|
+
mask,
|
|
765
|
+
providerOptions,
|
|
766
|
+
headers,
|
|
767
|
+
abortSignal
|
|
768
|
+
}) {
|
|
769
|
+
var _a8;
|
|
770
|
+
const resolvedHeaders = await resolve4(this.config.headers());
|
|
771
|
+
try {
|
|
772
|
+
const {
|
|
773
|
+
responseHeaders,
|
|
774
|
+
value: responseBody,
|
|
775
|
+
rawValue
|
|
776
|
+
} = await postJsonToApi3({
|
|
777
|
+
url: this.getUrl(),
|
|
778
|
+
headers: combineHeaders3(
|
|
779
|
+
resolvedHeaders,
|
|
780
|
+
headers != null ? headers : {},
|
|
781
|
+
this.getModelConfigHeaders(),
|
|
782
|
+
await resolve4(this.config.o11yHeaders)
|
|
783
|
+
),
|
|
784
|
+
body: {
|
|
785
|
+
prompt,
|
|
786
|
+
n,
|
|
787
|
+
...size && { size },
|
|
788
|
+
...aspectRatio && { aspectRatio },
|
|
789
|
+
...seed && { seed },
|
|
790
|
+
...providerOptions && { providerOptions },
|
|
791
|
+
...files && {
|
|
792
|
+
files: files.map((file) => maybeEncodeImageFile(file))
|
|
793
|
+
},
|
|
794
|
+
...mask && { mask: maybeEncodeImageFile(mask) }
|
|
795
|
+
},
|
|
796
|
+
successfulResponseHandler: createJsonResponseHandler4(
|
|
797
|
+
gatewayImageResponseSchema
|
|
798
|
+
),
|
|
799
|
+
failedResponseHandler: createJsonErrorResponseHandler4({
|
|
800
|
+
errorSchema: z7.any(),
|
|
801
|
+
errorToMessage: (data) => data
|
|
802
|
+
}),
|
|
803
|
+
...abortSignal && { abortSignal },
|
|
804
|
+
fetch: this.config.fetch
|
|
805
|
+
});
|
|
806
|
+
return {
|
|
807
|
+
images: responseBody.images,
|
|
808
|
+
// Always base64 strings from server
|
|
809
|
+
warnings: (_a8 = responseBody.warnings) != null ? _a8 : [],
|
|
810
|
+
providerMetadata: responseBody.providerMetadata,
|
|
811
|
+
response: {
|
|
812
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
813
|
+
modelId: this.modelId,
|
|
814
|
+
headers: responseHeaders
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
} catch (error) {
|
|
818
|
+
throw asGatewayError(error, await parseAuthMethod(resolvedHeaders));
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
getUrl() {
|
|
822
|
+
return `${this.config.baseURL}/image-model`;
|
|
823
|
+
}
|
|
824
|
+
getModelConfigHeaders() {
|
|
825
|
+
return {
|
|
826
|
+
"ai-image-model-specification-version": "3",
|
|
827
|
+
"ai-model-id": this.modelId
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
function maybeEncodeImageFile(file) {
|
|
832
|
+
if (file.type === "file" && file.data instanceof Uint8Array) {
|
|
833
|
+
return {
|
|
834
|
+
...file,
|
|
835
|
+
data: convertUint8ArrayToBase64(file.data)
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
return file;
|
|
839
|
+
}
|
|
840
|
+
var providerMetadataEntrySchema = z7.object({
|
|
841
|
+
images: z7.array(z7.unknown()).optional()
|
|
842
|
+
}).catchall(z7.unknown());
|
|
843
|
+
var gatewayImageResponseSchema = z7.object({
|
|
844
|
+
images: z7.array(z7.string()),
|
|
845
|
+
// Always base64 strings over the wire
|
|
846
|
+
warnings: z7.array(
|
|
847
|
+
z7.object({
|
|
848
|
+
type: z7.literal("other"),
|
|
849
|
+
message: z7.string()
|
|
850
|
+
})
|
|
851
|
+
).optional(),
|
|
852
|
+
providerMetadata: z7.record(z7.string(), providerMetadataEntrySchema).optional()
|
|
853
|
+
});
|
|
854
|
+
|
|
855
|
+
// src/tool/perplexity-search.ts
|
|
856
|
+
import {
|
|
857
|
+
createProviderToolFactoryWithOutputSchema,
|
|
858
|
+
lazySchema as lazySchema6,
|
|
859
|
+
zodSchema as zodSchema6
|
|
860
|
+
} from "@ai-sdk/provider-utils";
|
|
861
|
+
import { z as z8 } from "zod";
|
|
862
|
+
var perplexitySearchInputSchema = lazySchema6(
|
|
863
|
+
() => zodSchema6(
|
|
864
|
+
z8.object({
|
|
865
|
+
query: z8.union([z8.string(), z8.array(z8.string())]).describe(
|
|
866
|
+
"Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
|
|
867
|
+
),
|
|
868
|
+
max_results: z8.number().optional().describe(
|
|
869
|
+
"Maximum number of search results to return (1-20, default: 10)"
|
|
870
|
+
),
|
|
871
|
+
max_tokens_per_page: z8.number().optional().describe(
|
|
872
|
+
"Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
|
|
873
|
+
),
|
|
874
|
+
max_tokens: z8.number().optional().describe(
|
|
875
|
+
"Maximum total tokens across all search results (default: 25000, max: 1000000)"
|
|
876
|
+
),
|
|
877
|
+
country: z8.string().optional().describe(
|
|
878
|
+
"Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
|
|
879
|
+
),
|
|
880
|
+
search_domain_filter: z8.array(z8.string()).optional().describe(
|
|
881
|
+
"List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
|
|
882
|
+
),
|
|
883
|
+
search_language_filter: z8.array(z8.string()).optional().describe(
|
|
884
|
+
"List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
|
|
885
|
+
),
|
|
886
|
+
search_after_date: z8.string().optional().describe(
|
|
887
|
+
"Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
888
|
+
),
|
|
889
|
+
search_before_date: z8.string().optional().describe(
|
|
890
|
+
"Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
891
|
+
),
|
|
892
|
+
last_updated_after_filter: z8.string().optional().describe(
|
|
893
|
+
"Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
894
|
+
),
|
|
895
|
+
last_updated_before_filter: z8.string().optional().describe(
|
|
896
|
+
"Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
897
|
+
),
|
|
898
|
+
search_recency_filter: z8.enum(["day", "week", "month", "year"]).optional().describe(
|
|
899
|
+
"Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
|
|
900
|
+
)
|
|
901
|
+
})
|
|
902
|
+
)
|
|
903
|
+
);
|
|
904
|
+
var perplexitySearchOutputSchema = lazySchema6(
|
|
905
|
+
() => zodSchema6(
|
|
906
|
+
z8.union([
|
|
907
|
+
// Success response
|
|
908
|
+
z8.object({
|
|
909
|
+
results: z8.array(
|
|
910
|
+
z8.object({
|
|
911
|
+
title: z8.string(),
|
|
912
|
+
url: z8.string(),
|
|
913
|
+
snippet: z8.string(),
|
|
914
|
+
date: z8.string().optional(),
|
|
915
|
+
lastUpdated: z8.string().optional()
|
|
916
|
+
})
|
|
917
|
+
),
|
|
918
|
+
id: z8.string()
|
|
919
|
+
}),
|
|
920
|
+
// Error response
|
|
921
|
+
z8.object({
|
|
922
|
+
error: z8.enum([
|
|
923
|
+
"api_error",
|
|
924
|
+
"rate_limit",
|
|
925
|
+
"timeout",
|
|
926
|
+
"invalid_input",
|
|
927
|
+
"unknown"
|
|
928
|
+
]),
|
|
929
|
+
statusCode: z8.number().optional(),
|
|
930
|
+
message: z8.string()
|
|
931
|
+
})
|
|
932
|
+
])
|
|
933
|
+
)
|
|
934
|
+
);
|
|
935
|
+
var perplexitySearchToolFactory = createProviderToolFactoryWithOutputSchema({
|
|
936
|
+
id: "gateway.perplexity_search",
|
|
937
|
+
inputSchema: perplexitySearchInputSchema,
|
|
938
|
+
outputSchema: perplexitySearchOutputSchema
|
|
664
939
|
});
|
|
940
|
+
var perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
|
|
941
|
+
|
|
942
|
+
// src/gateway-tools.ts
|
|
943
|
+
var gatewayTools = {
|
|
944
|
+
/**
|
|
945
|
+
* Search the web using Perplexity's Search API for real-time information,
|
|
946
|
+
* news, research papers, and articles.
|
|
947
|
+
*
|
|
948
|
+
* Provides ranked search results with advanced filtering options including
|
|
949
|
+
* domain, language, date range, and recency filters.
|
|
950
|
+
*/
|
|
951
|
+
perplexitySearch
|
|
952
|
+
};
|
|
665
953
|
|
|
666
954
|
// src/vercel-environment.ts
|
|
667
955
|
import { getContext } from "@vercel/oidc";
|
|
@@ -675,7 +963,7 @@ async function getVercelRequestId() {
|
|
|
675
963
|
import { withUserAgentSuffix } from "@ai-sdk/provider-utils";
|
|
676
964
|
|
|
677
965
|
// src/version.ts
|
|
678
|
-
var VERSION = true ? "0.0.0-
|
|
966
|
+
var VERSION = true ? "0.0.0-4115c213-20260122152721" : "0.0.0-test";
|
|
679
967
|
|
|
680
968
|
// src/gateway-provider.ts
|
|
681
969
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
@@ -685,10 +973,10 @@ function createGatewayProvider(options = {}) {
|
|
|
685
973
|
let metadataCache = null;
|
|
686
974
|
const cacheRefreshMillis = (_a8 = options.metadataCacheRefreshMillis) != null ? _a8 : 1e3 * 60 * 5;
|
|
687
975
|
let lastFetchTime = 0;
|
|
688
|
-
const baseURL = (_b8 = withoutTrailingSlash(options.baseURL)) != null ? _b8 : "https://ai-gateway.vercel.sh/
|
|
976
|
+
const baseURL = (_b8 = withoutTrailingSlash(options.baseURL)) != null ? _b8 : "https://ai-gateway.vercel.sh/v3/ai";
|
|
689
977
|
const getHeaders = async () => {
|
|
690
|
-
|
|
691
|
-
|
|
978
|
+
try {
|
|
979
|
+
const auth = await getGatewayAuthToken(options);
|
|
692
980
|
return withUserAgentSuffix(
|
|
693
981
|
{
|
|
694
982
|
Authorization: `Bearer ${auth.token}`,
|
|
@@ -698,12 +986,14 @@ function createGatewayProvider(options = {}) {
|
|
|
698
986
|
},
|
|
699
987
|
`ai-sdk/gateway/${VERSION}`
|
|
700
988
|
);
|
|
989
|
+
} catch (error) {
|
|
990
|
+
throw GatewayAuthenticationError.createContextualError({
|
|
991
|
+
apiKeyProvided: false,
|
|
992
|
+
oidcTokenProvided: false,
|
|
993
|
+
statusCode: 401,
|
|
994
|
+
cause: error
|
|
995
|
+
});
|
|
701
996
|
}
|
|
702
|
-
throw GatewayAuthenticationError.createContextualError({
|
|
703
|
-
apiKeyProvided: false,
|
|
704
|
-
oidcTokenProvided: false,
|
|
705
|
-
statusCode: 401
|
|
706
|
-
});
|
|
707
997
|
};
|
|
708
998
|
const createO11yHeaders = () => {
|
|
709
999
|
const deploymentId = loadOptionalSetting({
|
|
@@ -750,7 +1040,10 @@ function createGatewayProvider(options = {}) {
|
|
|
750
1040
|
metadataCache = metadata;
|
|
751
1041
|
return metadata;
|
|
752
1042
|
}).catch(async (error) => {
|
|
753
|
-
throw
|
|
1043
|
+
throw await asGatewayError(
|
|
1044
|
+
error,
|
|
1045
|
+
await parseAuthMethod(await getHeaders())
|
|
1046
|
+
);
|
|
754
1047
|
});
|
|
755
1048
|
}
|
|
756
1049
|
return metadataCache ? Promise.resolve(metadataCache) : pendingMetadata;
|
|
@@ -761,7 +1054,10 @@ function createGatewayProvider(options = {}) {
|
|
|
761
1054
|
headers: getHeaders,
|
|
762
1055
|
fetch: options.fetch
|
|
763
1056
|
}).getCredits().catch(async (error) => {
|
|
764
|
-
throw
|
|
1057
|
+
throw await asGatewayError(
|
|
1058
|
+
error,
|
|
1059
|
+
await parseAuthMethod(await getHeaders())
|
|
1060
|
+
);
|
|
765
1061
|
});
|
|
766
1062
|
};
|
|
767
1063
|
const provider = function(modelId) {
|
|
@@ -772,13 +1068,20 @@ function createGatewayProvider(options = {}) {
|
|
|
772
1068
|
}
|
|
773
1069
|
return createLanguageModel(modelId);
|
|
774
1070
|
};
|
|
1071
|
+
provider.specificationVersion = "v3";
|
|
775
1072
|
provider.getAvailableModels = getAvailableModels;
|
|
776
1073
|
provider.getCredits = getCredits;
|
|
777
1074
|
provider.imageModel = (modelId) => {
|
|
778
|
-
|
|
1075
|
+
return new GatewayImageModel(modelId, {
|
|
1076
|
+
provider: "gateway",
|
|
1077
|
+
baseURL,
|
|
1078
|
+
headers: getHeaders,
|
|
1079
|
+
fetch: options.fetch,
|
|
1080
|
+
o11yHeaders: createO11yHeaders()
|
|
1081
|
+
});
|
|
779
1082
|
};
|
|
780
1083
|
provider.languageModel = createLanguageModel;
|
|
781
|
-
|
|
1084
|
+
const createEmbeddingModel = (modelId) => {
|
|
782
1085
|
return new GatewayEmbeddingModel(modelId, {
|
|
783
1086
|
provider: "gateway",
|
|
784
1087
|
baseURL,
|
|
@@ -787,6 +1090,9 @@ function createGatewayProvider(options = {}) {
|
|
|
787
1090
|
o11yHeaders: createO11yHeaders()
|
|
788
1091
|
});
|
|
789
1092
|
};
|
|
1093
|
+
provider.embeddingModel = createEmbeddingModel;
|
|
1094
|
+
provider.textEmbeddingModel = createEmbeddingModel;
|
|
1095
|
+
provider.tools = gatewayTools;
|
|
790
1096
|
return provider;
|
|
791
1097
|
}
|
|
792
1098
|
var gateway = createGatewayProvider();
|
|
@@ -801,15 +1107,11 @@ async function getGatewayAuthToken(options) {
|
|
|
801
1107
|
authMethod: "api-key"
|
|
802
1108
|
};
|
|
803
1109
|
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
};
|
|
810
|
-
} catch (e) {
|
|
811
|
-
return null;
|
|
812
|
-
}
|
|
1110
|
+
const oidcToken = await getVercelOidcToken();
|
|
1111
|
+
return {
|
|
1112
|
+
token: oidcToken,
|
|
1113
|
+
authMethod: "oidc"
|
|
1114
|
+
};
|
|
813
1115
|
}
|
|
814
1116
|
export {
|
|
815
1117
|
GatewayAuthenticationError,
|