@ai-sdk/gateway 4.0.0-canary.90 → 4.0.0-canary.92
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 +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/docs/00-ai-gateway.mdx +26 -0
- package/package.json +4 -4
- package/src/gateway-provider-options.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
+
## 4.0.0-canary.92
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [6c93e36]
|
|
8
|
+
- Updated dependencies [f617ac2]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-canary.44
|
|
10
|
+
|
|
11
|
+
## 4.0.0-canary.91
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- d4d4a5e: Add `serviceTier: 'flex' | 'priority'` to `GatewayProviderOptions`.
|
|
16
|
+
|
|
3
17
|
## 4.0.0-canary.90
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -594,6 +594,7 @@ declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
594
594
|
providerTimeouts?: {
|
|
595
595
|
byok?: Record<string, number> | undefined;
|
|
596
596
|
} | undefined;
|
|
597
|
+
serviceTier?: "flex" | "priority" | undefined;
|
|
597
598
|
}>;
|
|
598
599
|
type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
|
|
599
600
|
|
package/dist/index.js
CHANGED
|
@@ -1961,7 +1961,7 @@ async function getVercelRequestId() {
|
|
|
1961
1961
|
}
|
|
1962
1962
|
|
|
1963
1963
|
// src/version.ts
|
|
1964
|
-
var VERSION = true ? "4.0.0-canary.
|
|
1964
|
+
var VERSION = true ? "4.0.0-canary.92" : "0.0.0-test";
|
|
1965
1965
|
|
|
1966
1966
|
// src/gateway-provider.ts
|
|
1967
1967
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
package/docs/00-ai-gateway.mdx
CHANGED
|
@@ -874,6 +874,32 @@ The following gateway provider options are available:
|
|
|
874
874
|
|
|
875
875
|
For full details, see [Provider Timeouts](https://vercel.com/docs/ai-gateway/models-and-providers/provider-timeouts).
|
|
876
876
|
|
|
877
|
+
- **serviceTier** _'flex' | 'priority'_
|
|
878
|
+
|
|
879
|
+
Unified service tier intent. The gateway translates it into whichever
|
|
880
|
+
per-provider option each provider expects, and overrides any tier
|
|
881
|
+
also set in the per-provider options. Leave unset for provider
|
|
882
|
+
default. See the [OpenAI](/providers/ai-sdk-providers/openai),
|
|
883
|
+
[Google Generative AI](/providers/ai-sdk-providers/google-generative-ai),
|
|
884
|
+
and [Google Vertex AI](/providers/ai-sdk-providers/google-vertex)
|
|
885
|
+
provider docs for tier semantics, model availability, and graceful
|
|
886
|
+
downgrade behavior on each provider.
|
|
887
|
+
|
|
888
|
+
```ts
|
|
889
|
+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
|
|
890
|
+
import { generateText } from 'ai';
|
|
891
|
+
|
|
892
|
+
const { text } = await generateText({
|
|
893
|
+
model: 'openai/gpt-5-mini',
|
|
894
|
+
prompt: 'Hello',
|
|
895
|
+
providerOptions: {
|
|
896
|
+
gateway: {
|
|
897
|
+
serviceTier: 'priority',
|
|
898
|
+
} satisfies GatewayProviderOptions,
|
|
899
|
+
},
|
|
900
|
+
});
|
|
901
|
+
```
|
|
902
|
+
|
|
877
903
|
You can combine these options to have fine-grained control over routing and tracking:
|
|
878
904
|
|
|
879
905
|
```ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/gateway",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.0.0-canary.
|
|
4
|
+
"version": "4.0.0-canary.92",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@vercel/oidc": "3.2.0",
|
|
34
34
|
"@ai-sdk/provider": "4.0.0-canary.17",
|
|
35
|
-
"@ai-sdk/provider-utils": "5.0.0-canary.
|
|
35
|
+
"@ai-sdk/provider-utils": "5.0.0-canary.44"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "22.19.19",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"tsx": "4.19.2",
|
|
41
41
|
"typescript": "5.8.3",
|
|
42
42
|
"zod": "3.25.76",
|
|
43
|
-
"@ai-
|
|
44
|
-
"@
|
|
43
|
+
"@vercel/ai-tsconfig": "0.0.0",
|
|
44
|
+
"@ai-sdk/test-server": "2.0.0-canary.6"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"zod": "^3.25.76 || ^4.1.8"
|
|
@@ -104,6 +104,13 @@ const gatewayProviderOptions = lazySchema(() =>
|
|
|
104
104
|
byok: z.record(z.string(), z.number().int().min(1000)).optional(),
|
|
105
105
|
})
|
|
106
106
|
.optional(),
|
|
107
|
+
/**
|
|
108
|
+
* Unified service tier intent. Translated by the gateway into the
|
|
109
|
+
* per-provider option each provider expects, and overrides any tier
|
|
110
|
+
* also set in the per-provider options. Leave unset for provider
|
|
111
|
+
* default.
|
|
112
|
+
*/
|
|
113
|
+
serviceTier: z.enum(['flex', 'priority']).optional(),
|
|
107
114
|
}),
|
|
108
115
|
),
|
|
109
116
|
);
|