@ai-sdk/gateway 3.0.119 → 3.0.120
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 +6 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/00-ai-gateway.mdx +26 -0
- package/package.json +1 -1
- package/src/gateway-provider-options.ts +7 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -568,6 +568,7 @@ declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
568
568
|
providerTimeouts?: {
|
|
569
569
|
byok?: Record<string, number> | undefined;
|
|
570
570
|
} | undefined;
|
|
571
|
+
serviceTier?: "flex" | "priority" | undefined;
|
|
571
572
|
}>;
|
|
572
573
|
type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
|
|
573
574
|
|
package/dist/index.d.ts
CHANGED
|
@@ -568,6 +568,7 @@ declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
568
568
|
providerTimeouts?: {
|
|
569
569
|
byok?: Record<string, number> | undefined;
|
|
570
570
|
} | undefined;
|
|
571
|
+
serviceTier?: "flex" | "priority" | undefined;
|
|
571
572
|
}>;
|
|
572
573
|
type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
|
|
573
574
|
|
package/dist/index.js
CHANGED
|
@@ -1627,7 +1627,7 @@ async function getVercelRequestId() {
|
|
|
1627
1627
|
}
|
|
1628
1628
|
|
|
1629
1629
|
// src/version.ts
|
|
1630
|
-
var VERSION = true ? "3.0.
|
|
1630
|
+
var VERSION = true ? "3.0.120" : "0.0.0-test";
|
|
1631
1631
|
|
|
1632
1632
|
// src/gateway-provider.ts
|
|
1633
1633
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
package/dist/index.mjs
CHANGED
|
@@ -1672,7 +1672,7 @@ async function getVercelRequestId() {
|
|
|
1672
1672
|
}
|
|
1673
1673
|
|
|
1674
1674
|
// src/version.ts
|
|
1675
|
-
var VERSION = true ? "3.0.
|
|
1675
|
+
var VERSION = true ? "3.0.120" : "0.0.0-test";
|
|
1676
1676
|
|
|
1677
1677
|
// src/gateway-provider.ts
|
|
1678
1678
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
package/docs/00-ai-gateway.mdx
CHANGED
|
@@ -844,6 +844,32 @@ The following gateway provider options are available:
|
|
|
844
844
|
|
|
845
845
|
For full details, see [Provider Timeouts](https://vercel.com/docs/ai-gateway/models-and-providers/provider-timeouts).
|
|
846
846
|
|
|
847
|
+
- **serviceTier** _'flex' | 'priority'_
|
|
848
|
+
|
|
849
|
+
Unified service tier intent. The gateway translates it into whichever
|
|
850
|
+
per-provider option each provider expects, and overrides any tier
|
|
851
|
+
also set in the per-provider options. Leave unset for provider
|
|
852
|
+
default. See the [OpenAI](/providers/ai-sdk-providers/openai),
|
|
853
|
+
[Google Generative AI](/providers/ai-sdk-providers/google-generative-ai),
|
|
854
|
+
and [Google Vertex AI](/providers/ai-sdk-providers/google-vertex)
|
|
855
|
+
provider docs for tier semantics, model availability, and graceful
|
|
856
|
+
downgrade behavior on each provider.
|
|
857
|
+
|
|
858
|
+
```ts
|
|
859
|
+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
|
|
860
|
+
import { generateText } from 'ai';
|
|
861
|
+
|
|
862
|
+
const { text } = await generateText({
|
|
863
|
+
model: 'openai/gpt-5-mini',
|
|
864
|
+
prompt: 'Hello',
|
|
865
|
+
providerOptions: {
|
|
866
|
+
gateway: {
|
|
867
|
+
serviceTier: 'priority',
|
|
868
|
+
} satisfies GatewayProviderOptions,
|
|
869
|
+
},
|
|
870
|
+
});
|
|
871
|
+
```
|
|
872
|
+
|
|
847
873
|
You can combine these options to have fine-grained control over routing and tracking:
|
|
848
874
|
|
|
849
875
|
```ts
|
package/package.json
CHANGED
|
@@ -101,6 +101,13 @@ const gatewayProviderOptions = lazySchema(() =>
|
|
|
101
101
|
byok: z.record(z.string(), z.number().int().min(1000)).optional(),
|
|
102
102
|
})
|
|
103
103
|
.optional(),
|
|
104
|
+
/**
|
|
105
|
+
* Unified service tier intent. Translated by the gateway into the
|
|
106
|
+
* per-provider option each provider expects, and overrides any tier
|
|
107
|
+
* also set in the per-provider options. Leave unset for provider
|
|
108
|
+
* default.
|
|
109
|
+
*/
|
|
110
|
+
serviceTier: z.enum(['flex', 'priority']).optional(),
|
|
104
111
|
}),
|
|
105
112
|
),
|
|
106
113
|
);
|