@ai-sdk/gateway 4.0.136 → 4.0.138
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 +19 -0
- package/README.md +3 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/gateway-image-model-settings.ts +2 -0
- package/src/gateway-language-model-settings.ts +1 -3
- package/src/gateway-provider.ts +22 -0
- package/src/gateway-realtime-model-settings.ts +0 -1
- package/src/gateway-video-model-settings.ts +0 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/gateway",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.138",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@ai-sdk/provider": "4.0.
|
|
34
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
33
|
+
"@ai-sdk/provider": "4.0.37",
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.76",
|
|
35
35
|
"@vercel/oidc": "3.2.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -23,6 +23,8 @@ export type GatewayImageModelId =
|
|
|
23
23
|
| 'openai/gpt-image-2'
|
|
24
24
|
| 'openai/gpt-image-2.5-flare'
|
|
25
25
|
| 'openai/gpt-image-2.5-sunburst'
|
|
26
|
+
| 'openai/gpt-image-2.6-flare'
|
|
27
|
+
| 'openai/gpt-image-2.6-sunburst'
|
|
26
28
|
| 'prodia/flux-fast-schnell'
|
|
27
29
|
| 'recraft/recraft-v2'
|
|
28
30
|
| 'recraft/recraft-v3'
|
|
@@ -90,23 +90,21 @@ export type GatewayModelId =
|
|
|
90
90
|
| 'google/gemini-3-flash-batch'
|
|
91
91
|
| 'google/gemini-3-pro-image'
|
|
92
92
|
| 'google/gemini-3.1-flash-image'
|
|
93
|
-
| 'google/gemini-3.1-flash-image-preview'
|
|
94
93
|
| 'google/gemini-3.1-flash-lite'
|
|
95
94
|
| 'google/gemini-3.1-flash-lite-batch'
|
|
96
95
|
| 'google/gemini-3.1-flash-lite-image'
|
|
97
96
|
| 'google/gemini-3.1-pro-preview'
|
|
98
97
|
| 'google/gemini-3.1-pro-preview-batch'
|
|
99
98
|
| 'google/gemini-3.5-flash'
|
|
100
|
-
| 'google/gemini-3.5-flash-batch'
|
|
101
99
|
| 'google/gemini-3.5-flash-lite'
|
|
102
100
|
| 'google/gemini-3.5-flash-lite-batch'
|
|
103
101
|
| 'google/gemini-3.6-flash'
|
|
104
102
|
| 'google/gemini-3.6-flash-batch'
|
|
105
103
|
| 'google/gemini-3.7-flash'
|
|
106
|
-
| 'google/gemini-3.7-flash-batch'
|
|
107
104
|
| 'google/gemini-3.8-flash'
|
|
108
105
|
| 'google/gemini-4-argon'
|
|
109
106
|
| 'google/gemini-nano-banana-2.1'
|
|
107
|
+
| 'google/gemini-omni-1.2-flash'
|
|
110
108
|
| 'google/gemini-omni-flash-preview'
|
|
111
109
|
| 'google/gemma-4-26b-a4b-it'
|
|
112
110
|
| 'google/gemma-4-31b-it'
|
package/src/gateway-provider.ts
CHANGED
|
@@ -310,6 +310,14 @@ export interface GatewayProviderSettings {
|
|
|
310
310
|
* API key or Vercel access token that is being sent using the `Authorization`
|
|
311
311
|
* header. It defaults to the `AI_GATEWAY_API_KEY` environment variable.
|
|
312
312
|
* A callback is resolved before each request and must return a non-empty key.
|
|
313
|
+
*
|
|
314
|
+
* If neither `apiKey` nor `AI_GATEWAY_API_KEY` is set to a non-empty value,
|
|
315
|
+
* the provider authenticates with the Vercel OIDC token instead, resolved for
|
|
316
|
+
* each request. On Vercel deployments this requires no configuration. For
|
|
317
|
+
* local development, run `vercel env pull` or `vercel dev` to get a token.
|
|
318
|
+
* A non-empty configured API key is always used instead of OIDC, even if the
|
|
319
|
+
* key is invalid. If no OIDC token is available either, requests fail with a
|
|
320
|
+
* `GatewayAuthenticationError` ("No authentication provided").
|
|
313
321
|
*/
|
|
314
322
|
apiKey?: Resolvable<string>;
|
|
315
323
|
|
|
@@ -792,6 +800,20 @@ export function createGateway(
|
|
|
792
800
|
|
|
793
801
|
export const gateway = createGateway();
|
|
794
802
|
|
|
803
|
+
/**
|
|
804
|
+
* Resolves the credential for a Gateway request, in this order:
|
|
805
|
+
*
|
|
806
|
+
* 1. The `apiKey` setting (a string, or a callback resolved per request).
|
|
807
|
+
* 2. The `AI_GATEWAY_API_KEY` environment variable.
|
|
808
|
+
* 3. The Vercel OIDC token from `getVercelOidcToken()`. It is available
|
|
809
|
+
* automatically on Vercel deployments, and locally after `vercel env pull`
|
|
810
|
+
* or under `vercel dev`.
|
|
811
|
+
*
|
|
812
|
+
* A non-empty configured API key is never replaced by OIDC, even if the key is
|
|
813
|
+
* invalid. An empty string option or environment variable falls through to
|
|
814
|
+
* OIDC; a callback must return a non-empty key. Callers wrap a failure here in a
|
|
815
|
+
* `GatewayAuthenticationError` ("No authentication provided").
|
|
816
|
+
*/
|
|
795
817
|
export async function getGatewayAuthToken(
|
|
796
818
|
options: GatewayProviderSettings,
|
|
797
819
|
): Promise<{ token: string; authMethod: 'api-key' | 'oidc' }> {
|
|
@@ -17,8 +17,6 @@ export type GatewayVideoModelId =
|
|
|
17
17
|
| 'bytedance/seedance-v1.0-pro'
|
|
18
18
|
| 'bytedance/seedance-v1.0-pro-fast'
|
|
19
19
|
| 'bytedance/seedance-v1.5-pro'
|
|
20
|
-
| 'google/veo-3.0-fast-generate-001'
|
|
21
|
-
| 'google/veo-3.0-generate-001'
|
|
22
20
|
| 'google/veo-3.1-fast-generate-001'
|
|
23
21
|
| 'google/veo-3.1-generate-001'
|
|
24
22
|
| 'google/veo-3.1-lite-generate-001'
|